Skip to content

Commit a5cfa72

Browse files
authored
Merge pull request #249 from DataIntegrationGroup/TAM-Add-DB-HealthCheck
[NO TICKET] Add db healthcheck to docker-compose file
2 parents b29543a + 7136b07 commit a5cfa72

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

docker-compose.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ services:
1212
- 5432:5432
1313
volumes:
1414
- postgres_data:/var/lib/postgresql/data
15+
healthcheck:
16+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
17+
interval: 2s
18+
timeout: 5s
19+
retries: 20
1520

1621
app:
1722
build:
@@ -27,11 +32,12 @@ services:
2732
ports:
2833
- 8000:8000
2934
depends_on:
30-
- db
35+
db:
36+
condition: service_healthy # <-- wait for DB to be ready
3137
links:
3238
- db
3339
volumes:
3440
- .:/app
3541

3642
volumes:
37-
postgres_data:
43+
postgres_data:

0 commit comments

Comments
 (0)