Switch Ghost healthcheck to nc (BusyBox wget lacks --max-redirect)#8
Merged
Conversation
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>
2412a31 to
0583f29
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the healthcheck's
wget --spider -S --max-redirect=0 ... | grep HTTP/1withnc -z localhost 2368.Why
#7 landed a healthcheck using
wget --max-redirect=0to avoid following Ghost's http→https redirect. That works on GNU wget but not on the BusyBox wget shipped inghost: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:
nc -zis 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.shpassesdocker compose config --quietparses the new healthcheckdocker psshows ghost(healthy)within 60s, site responds through Traefik🤖 Generated with Claude Code