This repository was archived by the owner on Jun 19, 2026. It is now read-only.
fix: Docker healthcheck cascade — service_started → service_healthy#174
Open
GoThundercats wants to merge 2 commits into
Open
fix: Docker healthcheck cascade — service_started → service_healthy#174GoThundercats wants to merge 2 commits into
GoThundercats wants to merge 2 commits into
Conversation
Problems fixed: - redis: add healthcheck (redis-cli ping) so backend can depend on service_healthy - backend: add healthcheck (/health endpoint) + start_period=30s for init-db - backend Dockerfile: add HEALTHCHECK instruction + curl to apt deps - nginx: upgrade depends_on backend to service_healthy; add healthcheck - app/Dockerfile: add HEALTHCHECK via wget (nginx:alpine compatible) All service_started conditions upgraded to service_healthy via audit. The /health endpoint already existed in app/__init__.py.
Author
|
Updated the PR to include a comprehensive healthcheck audit. Beyond the initial backend/nginx race condition, I've also added health-aware dependencies for the redis-exporter and frontend-dev services to ensure the monitoring stack and dev-server boot reliably. |
Author
|
👋 Just following up — happy to address any feedback or make adjustments if this needs changes before review. Let me know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the cold-start 502 race condition identified during a Docker audit.
Only
postgreshad a healthcheck;redis,backend, andnginxwereall using
service_started, meaning containers started before dependencieswere actually ready to serve traffic.
Problems Fixed
redisredis-cli pinghealthcheckbackendservice_startedservice_healthy+ own healthcheck addednginx[backend]condition: service_healthypackages/backend/DockerfileHEALTHCHECKinstructionHEALTHCHECKpointing at/healthapp/DockerfileHEALTHCHECKinstructionHEALTHCHECKviawget(Alpine-compatible)Changes
docker-compose.yml— redis healthcheck block; backend healthcheck block withstart_period: 30s(coversflask init-dbtime); nginxdepends_onupgraded tocondition: service_healthy; nginx healthcheck via/nginx_statuspackages/backend/Dockerfile— addedcurlto apt deps; addedHEALTHCHECKinstructionapp/Dockerfile— addedHEALTHCHECKviawget --spider(BusyBox-compatible)Health Chain After Fix
The
/healthendpoint (GET → {"status": "ok"}) already exists inpackages/backend/app/__init__.py— no application code changes needed.Testing
docker compose up --build docker compose ps # all services should reach 'healthy' state