Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(compose): add depends_on health checks for PostgreSQL#741

Open
zhfeng wants to merge 1 commit into
Kong:masterfrom
zhfeng:fix/depends-on-healthcheck
Open

fix(compose): add depends_on health checks for PostgreSQL#741
zhfeng wants to merge 1 commit into
Kong:masterfrom
zhfeng:fix/depends-on-healthcheck

Conversation

@zhfeng

@zhfeng zhfeng commented Jun 10, 2026

Copy link
Copy Markdown

Summary

  • Add condition: service_healthy to depends_on for kong-migrations and kong-migrations-up services so they wait for PostgreSQL to be healthy before running migrations
  • Add depends_on to the kong service to wait for both the database (healthy) and migrations (completed) before starting

Problem

When running docker-compose --profile database up, Kong starts before PostgreSQL is ready, causing connection errors:

init_by_lua error: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: connection refused

This requires a manual restart of the Kong container after PostgreSQL is ready.

Test plan

  • Run docker-compose --profile database up from a clean state
  • Verify Kong starts successfully without needing a manual restart
  • Verify curl http://localhost:8001/ returns Kong's Admin API response

🤖 Generated with Claude Code

Kong's kong and migration services start before PostgreSQL is ready,
causing connection errors. Add `condition: service_healthy` to
depends_on so services wait for the DB health check to pass before
starting.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@CLAassistant

CLAassistant commented Jun 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

2 participants