Repository navigation
fix(docker): derive the HEALTHCHECK probe address from HOST - #2504
Merged
Merged
Conversation
The probe fetched a hardcoded 127.0.0.1, which agrees with the image's default HOST=0.0.0.0 only because a wildcard bind also listens on loopback. Pinning HOST to one interface left the server healthy but the container reported unhealthy. Move the probe into scripts/docker-healthcheck.mjs, copied into the runtime stage, and connect to the address HOST binds, mapping a wildcard to the loopback of its own family. Covered by node --test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
2 tasks done
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Port whitespace handling and scoped IPv6 addresses can still make a running container unhealthy.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Fixes #2424 by deriving the Docker healthcheck target from the configured bind address.
Changes:
- Adds a tested healthcheck probe with wildcard handling.
- Runs the probe from the Docker runtime image.
- Documents
HOST-aware healthchecks.
| File | Description |
|---|---|
scripts/docker-healthcheck.mjs |
Builds and probes the healthcheck URL. |
scripts/docker-healthcheck.test.mjs |
Tests address derivation, probing, and Docker wiring. |
Dockerfile |
Installs and runs the new probe. |
docs/docker.md |
Documents healthcheck behavior. |
README.md |
Adds the probe to the repository map. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…does (#2504 review) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
…to v2/fix/2424-healthcheck-host
Member
Author
|
Copilot round 1: 2 findings, replied inline in each thread.
The branch also picked up the |
2 tasks done
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.

Closes #2424
What
The Docker
HEALTHCHECKfetched a hardcodedhttp://127.0.0.1:$CLIENT_PORT/. That agrees with the image's defaultHOST=0.0.0.0only because a wildcard bind also listens on loopback. OverridingHOSTto one interface (-e HOST=172.17.0.2) left the server running fine while the container reported unhealthy. This is the narrowed diagnosis from the maintainer comment. Of the two shapes it proposed, this PR takes the first: derive the probe address fromHOST.How
scripts/docker-healthcheck.mjs(new): builds the probe URL fromHOSTandCLIENT_PORT.HOSTis a bind address, so a wildcard is mapped to the loopback of its own address family:0.0.0.0,::ffff:0:0and an empty value go to127.0.0.1, and::goes to[::1]. Any other host is probed as given, with IPv6 bracketed and a zone id stripped. Legacy spellings (HOST=0,0x0,::0) are canonicalized withnew URL(), the same primitivecore/node/hostUrl.tsuses. The image installs only the packed tarball and cannot importcore/. AHOSTno server could bind makes the probe exit 1 (unhealthy) rather than crash.Dockerfile: copies the script from the builder stage into the runtime stage and runs it asHEALTHCHECK CMD ["node", …]. The probe is a file rather than the oldnode -eone-liner so that it can be tested.docs/docker.mdsays the healthcheck followsHOST. The READMEscripts/entry mentions the probe.Verification
scripts/docker-healthcheck.test.mjs(24 tests, runs undertest:scripts):HOST→ URL tableprobe()against a real listener: 2xx, 503, nothing listening, and an unparseable hostHEALTHCHECKruns the exact path the runtime stage copies to--ip 172.30.0.10 -e HOST=172.30.0.10healthyHOST=0.0.0.0)healthydocker execin the pinned containernpm run local:gateis green.🤖 Generated with Claude Code