fix(feat): prevent startup stall by waiting for Postgres/Redis and add healthcheck #3319
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.
What is this PR about?
Dokploy can start before Postgres/Redis in orchestrators like Docker Swarm, leading to a permanent stalled state where the process never recovers.
This PR adds a lightweight container entrypoint (
docker-entrypoint.sh) that waits for real Postgres and Redis connectivity before starting Dokploy; using already available Node tools without introducing new installs in the image; and a Docker HEALTHCHECK that uses the existing/api/healthendpoint.No application code changes, no new runtime dependencies, opt-out via env var.
Environment variables
DOKPLOY_WAIT_FOR_DEPS(default:1)Enable or disable waiting for PostgreSQL and Redis before starting Dokploy.
DOKPLOY_WAIT_TIMEOUT_SECONDS(default:600)Maximum time (per dependency) to wait before exiting with error.
DOKPLOY_WAIT_INTERVAL_SECONDS(default:2)Delay between retry attempts.
DATABASE_URL(required unlessPOSTGRES_URLis set)PostgreSQL connection string used for startup readiness checks.
POSTGRES_URL(optional)Override PostgreSQL URL used only for startup readiness checks.
REDIS_HOST(required)Redis hostname used by Dokploy and startup checks.
REDIS_PORT(default:6379)Redis port used for startup checks.
REDIS_URL(optional)Override Redis connection URL used only for startup readiness checks.
Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
None
Screenshots (if applicable)
None