From c7487d8c093aea2f15c4a126d140154d27a43f06 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Wed, 8 Jul 2026 02:44:14 -0600 Subject: [PATCH] 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 --- blueprints/erpnext-v16/docker-compose.yml | 27 ++++++----------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/blueprints/erpnext-v16/docker-compose.yml b/blueprints/erpnext-v16/docker-compose.yml index da7ea9f1..3201b4d7 100644 --- a/blueprints/erpnext-v16/docker-compose.yml +++ b/blueprints/erpnext-v16/docker-compose.yml @@ -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