From d44f799de945d0775933aad58726d46509154a64 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Sat, 13 Jun 2026 03:58:51 +0000 Subject: [PATCH] fix(cfold): wait for ghost db in entrypoint --- tests/ghost/compose.ccci.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/ghost/compose.ccci.yml b/tests/ghost/compose.ccci.yml index 040b156..b393752 100644 --- a/tests/ghost/compose.ccci.yml +++ b/tests/ghost/compose.ccci.yml @@ -30,16 +30,23 @@ # applies on both (persists untracked across the head checkout) — a recipe-PR candidate too. # Grace-only; masks no defect; weakens no test. # -# The app also needs a LONGER restart delay during the base→head crossover. On current Ghost heads the -# upgrade concurrently replaces mysql 8.0 with mysql 8.4; swarm starts a new app task before the new -# db service name is resolvable/ready, so Ghost exits immediately with `ENOTFOUND _db` and the -# rolling update pauses before the next retry. A 15s delay makes the retried app start after mysql is -# back, which preserves the real upgrade/assertion while removing a transient service-discovery race. +# The app also needs a DB-ready wait during the base→head crossover. On current Ghost heads the +# upgrade concurrently replaces mysql 8.0 with mysql 8.4; swarm starts the new app task before the +# replacement db service is accepting connections, so Ghost exits immediately with +# `ENOTFOUND`/`ECONNREFUSED` against `${STACK_NAME}_db` and swarm pauses the rolling update BEFORE any +# delayed retry can help. Wrapping the app command with a tiny TCP-ready wait preserves the real +# upgrade/assertion while removing this transient service-ordering race. services: app: - deploy: - restart_policy: - delay: 15s + entrypoint: + - sh + - -ec + - | + host="$$database__connection__host" + until node -e 'const net=require("net"); const host=process.argv[1]; const socket=net.connect({host, port: 3306}, () => { socket.end(); process.exit(0); }); socket.on("error", () => process.exit(1)); setTimeout(() => process.exit(1), 1000);' "$$host"; do + sleep 2 + done + exec /abra-entrypoint.sh node current/index.js healthcheck: start_period: 15m db: