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)
Describe the issue
The getting-started Compose files define a Postgres
pg_isreadyhealthcheck, but Kestra only waits forservice_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.javadocuments an "eagerly-initialized, fail-fast Hikari pool"). Neither file setsrestart:, so Compose's default isno: a first-boot connection failure exits and does not come back.The E2E compose file already does this correctly:
Repro
docker compose -f docker-compose.yml up -d docker compose ps # kestra can be Exited while postgres is still starting docker compose logs kestraRace is more likely when the Kestra image is already local (
pull_policy: alwaysotherwise delays start long enough for Postgres to be ready).Fix:
condition: service_healthy(and a shorter healthcheck interval, e.g. 5s). Considerrestart: unless-stoppedonkestra.Environment
37e4d38)