fix(cfold): wait for ghost db in entrypoint
This commit is contained in:
@ -30,16 +30,23 @@
|
|||||||
# applies on both (persists untracked across the head checkout) — a recipe-PR candidate too.
|
# applies on both (persists untracked across the head checkout) — a recipe-PR candidate too.
|
||||||
# Grace-only; masks no defect; weakens no test.
|
# 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
|
# 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 a new app task before the new
|
# upgrade concurrently replaces mysql 8.0 with mysql 8.4; swarm starts the new app task before the
|
||||||
# db service name is resolvable/ready, so Ghost exits immediately with `ENOTFOUND <stack>_db` and the
|
# replacement db service is accepting connections, so Ghost exits immediately with
|
||||||
# rolling update pauses before the next retry. A 15s delay makes the retried app start after mysql is
|
# `ENOTFOUND`/`ECONNREFUSED` against `${STACK_NAME}_db` and swarm pauses the rolling update BEFORE any
|
||||||
# back, which preserves the real upgrade/assertion while removing a transient service-discovery race.
|
# 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:
|
services:
|
||||||
app:
|
app:
|
||||||
deploy:
|
entrypoint:
|
||||||
restart_policy:
|
- sh
|
||||||
delay: 15s
|
- -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:
|
healthcheck:
|
||||||
start_period: 15m
|
start_period: 15m
|
||||||
db:
|
db:
|
||||||
|
|||||||
Reference in New Issue
Block a user