mirror of
https://github.com/Dokploy/templates.git
synced 2026-07-10 00:15:28 +02:00
fix: db healthcheck window too short and blocking depends_on aborted deploy
The deploy failed with 'dependency failed to start: container db-1 is unhealthy'. Root cause: the MariaDB 11.8 healthcheck allowed only ~40s (start_period 10s + 3x10s retries) before flagging the container unhealthy, which is not enough for the first-boot datadir initialization on a modest VPS. Since create-site depended on db:service_healthy, docker compose up -d aborted the whole deploy. Fixes, following the pattern of the existing working erpnext template: - Extend the db healthcheck window (start_period 120s, 30 retries) so first-boot initialization does not mark the container unhealthy. - Drop depends_on from the one-shot create-site and migration jobs and gate create-site with wait-for-it (db/redis) inside its command, so docker compose up -d returns without blocking on the multi-minute site creation and cannot fail on transient health states. Verified on a fresh deploy: all services up, create-site installed frappe + erpnext and enabled the scheduler, frontend serves the ERPNext login page with HTTP 200. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -172,18 +172,12 @@ services:
|
||||
replicas: ${CREATE_SITE:-0}
|
||||
restart_policy:
|
||||
condition: none
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis-cache:
|
||||
condition: service_healthy
|
||||
redis-queue:
|
||||
condition: service_healthy
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
entrypoint: ["bash", "-c"]
|
||||
command:
|
||||
- >
|
||||
wait-for-it -t 300 $${DB_HOST}:$${DB_PORT};
|
||||
wait-for-it -t 120 redis-cache:6379;
|
||||
wait-for-it -t 120 redis-queue:6379;
|
||||
export start=`date +%s`;
|
||||
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
|
||||
[[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
|
||||
@@ -222,17 +216,10 @@ services:
|
||||
replicas: ${MIGRATE:-0}
|
||||
restart_policy:
|
||||
condition: none
|
||||
depends_on:
|
||||
frontend:
|
||||
condition: service_healthy
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
create-site:
|
||||
condition: service_completed_successfully
|
||||
entrypoint: ["bash", "-c"]
|
||||
command:
|
||||
- >
|
||||
curl -f -H "Host: ${SITE_NAME}" http://frontend:8080/api/method/ping || { echo "Site busy"; exit 0; };
|
||||
curl -f -H "Host: ${SITE_NAME}" http://frontend:8080/api/method/ping || { echo "Site not reachable yet, skipping migration"; exit 0; };
|
||||
bench --site all set-config -p maintenance_mode 1;
|
||||
bench --site all set-config -p pause_scheduler 1;
|
||||
bench --site all migrate;
|
||||
@@ -250,10 +237,10 @@ services:
|
||||
condition: always
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
start_period: 10s
|
||||
interval: 10s
|
||||
start_period: 120s
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
retries: 30
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
|
||||
Reference in New Issue
Block a user