Wait for postgres and redis health in Compose

This commit is contained in:
2026-06-07 02:38:25 +03:00
parent 2e645694e4
commit e6c6cd9b92
2 changed files with 40 additions and 8 deletions

View File

@@ -18,8 +18,10 @@ services:
environment:
ACTION_EXECUTION_MODE: worker
depends_on:
- postgres
- redis
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
worker:
@@ -31,8 +33,10 @@ services:
environment:
ACTION_EXECUTION_MODE: worker
depends_on:
- postgres
- redis
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
frontend:
@@ -60,6 +64,12 @@ services:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 12
start_period: 5s
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
@@ -67,6 +77,12 @@ services:
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 12
start_period: 2s
volumes:
- redis_data:/data
restart: unless-stopped