Skip to content

Commit

Permalink
Add healthcheck to Postgres & make API depend on it
Browse files Browse the repository at this point in the history
Now the backend only starts, when the Postgres instance is running & healthy.
  • Loading branch information
AltayAkkus authored May 9, 2024
1 parent dc843b7 commit c236723
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ services:
container_name: postgres
image: 'postgres:15'
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
ports:
- '5432:5432'
env_file:
Expand All @@ -26,7 +31,8 @@ services:
links:
- postgres
depends_on:
- postgres
postgres:
condition: service_healthy
networks:
- default

Expand Down

0 comments on commit c236723

Please sign in to comment.