Fix startup issue with postgres on first start. Implement health check of postgres and delay django container until it's healthy.

This commit is contained in:
Mario Hüttel 2024-11-17 16:50:10 +01:00
parent d2ce635f05
commit fc5fa9f740

View File

@ -20,7 +20,8 @@ services:
networks:
- backendnet
depends_on:
- "shimatta-kenkyusho-db"
shimatta-kenkyusho-db:
condition: service_healthy
shimatta-kenkyusho-db:
image: postgres:16.5-alpine
@ -31,6 +32,11 @@ services:
- "${PGDATA:-./run/pgdata}:/var/lib/postgresql/data"
networks:
- backendnet
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
backendnet: