Skip to content

Commit

Permalink
Merge pull request #1172 from AlexandreCarlton/wait-for-postgres-to-b…
Browse files Browse the repository at this point in the history
…e-ready-in-compose

Ensure `db` is ready to accept connections prior to migration
  • Loading branch information
Naramsim authored Dec 13, 2024
2 parents ac05b6e + 81b2917 commit b3e0687
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ services:
POSTGRES_DB: ${POSTGRES_DB:-pokeapi}
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: pg_isready
interval: 1s
timeout: 5s
retries: 10
restart: always

app:
Expand All @@ -28,8 +33,10 @@ services:
- db
- cache
depends_on:
- db
- cache
db:
condition: service_healthy
cache:
condition: service_started
restart: always

web:
Expand Down

0 comments on commit b3e0687

Please sign in to comment.