Skip to content

Switch Ghost healthcheck to nc (BusyBox wget lacks --max-redirect)#8

Merged
lunarthegrey merged 1 commit into
mainfrom
fix-healthcheck-busybox
Apr 24, 2026
Merged

Switch Ghost healthcheck to nc (BusyBox wget lacks --max-redirect)#8
lunarthegrey merged 1 commit into
mainfrom
fix-healthcheck-busybox

Conversation

@lunarthegrey
Copy link
Copy Markdown

Summary

Replace the healthcheck's wget --spider -S --max-redirect=0 ... | grep HTTP/1 with nc -z localhost 2368.

Why

#7 landed a healthcheck using wget --max-redirect=0 to avoid following Ghost's http→https redirect. That works on GNU wget but not on the BusyBox wget shipped in ghost:6-alpine — BusyBox wget doesn't recognize --max-redirect, errors with "unrecognized option", the healthcheck never passes, and the container stays stuck in (health: starting) forever.

Live deploy confirmed:

eab02f5beea1   ghost:6-alpine   "docker-entrypoint.s…"   2 minutes ago   Up About a minute (health: starting)

nc -z is a TCP port check — universally available via BusyBox, doesn't care about HTTP semantics, and answers the only thing that matters for readiness: is Ghost listening on 2368? If yes, exit 0 (healthy). If the process is dead or the port isn't bound, exit non-zero (Traefik pulls the backend).

Also faster than a full HTTP request — nc doesn't speak HTTP.

Test plan

  • bash .github/scripts/test-patch.sh passes
  • docker compose config --quiet parses the new healthcheck
  • After merge + sync + redeploy: docker ps shows ghost (healthy) within 60s, site responds through Traefik

🤖 Generated with Claude Code

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>
@lunarthegrey lunarthegrey force-pushed the fix-healthcheck-busybox branch from 2412a31 to 0583f29 Compare April 24, 2026 12:11
@lunarthegrey lunarthegrey merged commit 43b5a7a into main Apr 24, 2026
2 checks passed
@lunarthegrey lunarthegrey deleted the fix-healthcheck-busybox branch April 24, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant