diff --git a/docker-compose.yml b/docker-compose.yml index e269cdf..9823c08 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,13 @@ services: - media_data:/media expose: - "3000" + # /health is unauthenticated; start_period covers the boot-time migrations. + healthcheck: + test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost:3000/health"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s frontend: build: @@ -43,9 +50,16 @@ services: restart: unless-stopped env_file: .env depends_on: - - app + app: + condition: service_healthy expose: - "3001" + healthcheck: + test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost:3001/"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 15s caddy: image: caddy:2-alpine @@ -56,9 +70,13 @@ services: volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data + # Gate on readiness so Caddy doesn't proxy to a not-yet-listening upstream + # (which otherwise shows brief 502s on boot/restart). depends_on: - - app - - frontend + app: + condition: service_healthy + frontend: + condition: service_healthy volumes: postgres_data: