Skip to content

Commit 2412a31

Browse files
lunarthegreyclaude
andcommitted
Switch Ghost healthcheck to nc (BusyBox wget lacks --max-redirect)
The previous fix used `wget --spider -S --max-redirect=0` to stop wget from following Ghost's http→https redirect. That works on GNU wget but fails on the BusyBox wget shipped in ghost:6-alpine — BusyBox wget doesn't recognize --max-redirect, errors out on the unknown option, and the healthcheck never passes. Container stayed in "health: starting" forever. `nc -z localhost 2368` is a plain TCP port check — universally available via BusyBox, doesn't care about HTTP semantics, answers the only question that matters: is Ghost listening? If the process is up and the port is bound, nc exits 0 and Docker marks healthy. If Ghost crashes or the port isn't bound, nc exits non-zero and Traefik pulls the backend. Side benefit: it's also much faster than an HTTP request. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8ef2252 commit 2412a31

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

.github/scripts/patch.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,11 @@ def patch_compose() -> None:
157157
" env_file:\n"
158158
" - .env\n"
159159
" healthcheck:\n"
160-
# Ghost redirects http→https when the Host header doesn't match its
161-
# configured url, so a naive wget follows back out through Traefik
162-
# and dies on setups without hairpin NAT. --max-redirect=0 stops
163-
# the follow; we accept any HTTP response line as "Ghost is up".
164-
' test: ["CMD-SHELL", "wget --spider -S --max-redirect=0 -T 3 '
165-
"http://localhost:2368/ghost/api/admin/site/ 2>&1 | grep -q 'HTTP/1'\"]\n"
160+
# TCP port check. BusyBox (Alpine) wget doesn't support
161+
# --max-redirect, so the HTTP-response approach fails; nc -z is
162+
# universally available and answers the only question that matters
163+
# for readiness: is Ghost listening on 2368?
164+
' test: ["CMD", "nc", "-z", "localhost", "2368"]\n'
166165
" interval: 30s\n"
167166
" timeout: 5s\n"
168167
" retries: 5\n"

0 commit comments

Comments
 (0)