Skip to content

devops(docker): add healthchecks for db and api services (#10) - #77

Open
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:feat/docker-healthchecks-10
Open

devops(docker): add healthchecks for db and api services (#10)#77
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:feat/docker-healthchecks-10

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 3, 2026

Copy link
Copy Markdown

Summary

Fixes #10docker-compose.yml had no healthcheck: blocks, so depends_on: [db] only waited for the container to start, not for Postgres to accept connections. On a cold start the API could attempt DB connections and fail.

Changes

docker-compose.yml

  • Added a pg_isready -U stellarsend -d stellarsend healthcheck for the db service (interval 5s, retries 10, start_period 10s).
  • Added a curl -f http://localhost:3000/health healthcheck for the api service using the existing GET /health liveness probe (interval 10s, retries 5, start_period 30s).
  • Upgraded depends_on: [db] to depends_on: db: condition: service_healthy so the API only starts after Postgres is proven ready.

Dockerfile

  • Added curl to the runtime stage install (ca-certificates libssl3 curl) so the healthcheck command is available inside the final image.

Testing

  • docker compose up now waits for db to pass pg_isready before starting api.
  • docker compose ps will show both services healthy.
  • The existing GET /health endpoint (liveness probe) is used as the API healthcheck target — no new code needed.

Closes #10

)

- Add pg_isready-based healthcheck for the db (postgres:16-alpine) service
  so depends_on waits until Postgres is ready to accept connections, not
  just until the container has started.
- Add curl /health-based healthcheck for the api service using the
  existing GET /health liveness probe.
- Upgrade depends_on: [db] to depends_on: db: condition: service_healthy
  so the API container only starts after the DB is proven healthy.
- Add curl to the Dockerfile runtime stage so the healthcheck command
  is available in the final image.

Fixes StellarSend#10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker-compose.yml has no healthchecks for api or db services

1 participant