Sped up pnpm dev cold start via tighter compose dev healthchecks#28991
Sped up pnpm dev cold start via tighter compose dev healthchecks#289919larsons wants to merge 4 commits into
Conversation
Docker's default healthcheck interval is 30s. The ghost-dev service declared no interval, so after start_period elapses, compose up --wait sat ~5s waiting for the next probe even though backend was already listening. mysql/redis/mailpit already use interval: 1s — match them. Cold pnpm dev gateway-ready stage drops ~4.5s on a 22.4s baseline.
Pairs with the interval:1s tightening — interval:1s + retries:10 + start_period:5s only tolerated ~15s of cold boot. retries:50 widens the window to ~55s, comfortably covering slower hardware where Ghost boot takes 30-90s.
The Caddy gateway came up fast (<1s) but was blocked behind ghost-dev's healthcheck via depends_on: service_healthy. Caddy retries its upstream on connect-refuse so the brief 502 window during ghost-dev boot is self-healing. compose up --wait now returns when the gateway is running, not when the backend is healthy. Composed with the healthcheck interval tightening, cold pnpm dev docker_up stage converges close to backend_log_ready.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:build |
✅ Succeeded | 9s | View ↗ |
nx run ghost:build:assets |
✅ Succeeded | 2s | View ↗ |
nx run ghost:build:tsc |
✅ Succeeded | 6s | View ↗ |
nx run-many -t lint -p ghost-monorepo |
✅ Succeeded | <1s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | 1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-30 14:06:26 UTC
The retries:300 approach kept probing every second indefinitely — fine for cold-boot detection but noisy in steady state. start_interval/interval gives both behaviors: 1Hz probing during the 120s start_period for fast compose --wait clearance, then 30s interval once healthy. Tolerance: start_period 120s of grace + retries:3 × interval:30s = 210s before unhealthy. Covers cold boots well past the 60-90s the team sees on bigger workspaces.
5561677 to
b1de7f0
Compare

Changes
compose.dev.yaml: ghost-dev healthcheck gainsinterval: 1s(was Docker default 30s) andretries: 50(was 10) — matches sibling services and widens cold-boot tolerance to ~55s.compose.dev.yaml: ghost-dev-gatewaydepends_onghost-dev relaxed toservice_started(wasservice_healthy). Caddy gateway comes up immediately;compose up --waitno longer blocks on backend healthcheck.Measured
Cold
pnpm devmean: 22.4s → 15.2s on a 3-trial benchmark, same hardware, identical reset protocol.Tradeoff
Gateway accepts /ghost/ requests before backend is listening (~11s window). Smoke shows ~3 502s + 1 503 over a ~6s window if the admin tab is open auto-reloading during cold boot; no impact if the user waits for the terminal ready signal. No per-retry log spam since
lb_try_durationis unset.