Skip to content

docker-compose.yml ignores Postgres healthcheck so Kestra can exit on first boot #19369

Description

@ayush-singh-0601

Describe the issue

The getting-started Compose files define a Postgres pg_isready healthcheck, but Kestra only waits for service_started:

    healthcheck:
      test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
      interval: 30s
      timeout: 10s
      retries: 10
    depends_on:
      postgres:
        condition: service_started

Same pattern in docker-compose-dind.yml. Compose only waits for the container process to start, not for Postgres to accept connections.

JDBC pools are eager and fail-fast at boot (cli/src/main/java/io/kestra/cli/Kestra.java documents an "eagerly-initialized, fail-fast Hikari pool"). Neither file sets restart:, so Compose's default is no: a first-boot connection failure exits and does not come back.

The E2E compose file already does this correctly:

    depends_on:
      init:
        condition: service_completed_successfully
      postgres:
        condition: service_healthy

Repro

docker compose -f docker-compose.yml up -d
docker compose ps   # kestra can be Exited while postgres is still starting
docker compose logs kestra

Race is more likely when the Kestra image is already local (pull_policy: always otherwise delays start long enough for Postgres to be ready).

Fix: condition: service_healthy (and a shorter healthcheck interval, e.g. 5s). Consider restart: unless-stopped on kestra.

Environment

  • Kestra Version: develop (37e4d38)

Activity

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

Metadata

Metadata

Assignees

Labels

area/devopsNeeds devops code changesgood first issueGreat issue for new contributors

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions