Repository navigation
Feat(docker): the image reports its own health (#49) - #68
Merged
Merged
Conversation
The image is FROM scratch, so a Compose healthcheck has no shell, wget or curl to run, and self-hosters on Compose-based platforms had no health status without customizing the image. `zennotes-server healthcheck` asks the server already running in the container for /healthz, using the same bind and base path, and exits 0 or 1. It ignores any HTTP proxy and follows no redirects, so only the server's own 200 counts. The Dockerfile's HEALTHCHECK runs it, using the timings lewxdev proposed in the issue. It means the server is answering, not that the vault is readable.
…oxies (#49) A review of this branch found three ways the new probe misled Docker. A [::] bind called ::1, which does not exist where IPv6 is off, so a working server read unhealthy and Traefik kept the site at 404. Go's [::] listener also takes IPv4, so every wildcard now calls 127.0.0.1. The URL was concatenated, so a base path the server accepts, like /100%, failed to parse and read unhealthy for good. It is now built with url.URL. A proxy that reads Docker health routes nothing until the first probe, which took 5s on current Docker. --start-interval=1s brings that to about 1s; Docker 24 ignores it and stays at 30s, as before. The README now says so and shows the opt-out.
Merged
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.
For #49. The issue stays open until this is merged, then it gets its own comment and close.
The image is
FROM scratch, so a Compose healthcheck had nothing to run. This addszennotes-server healthcheck, which calls/healthzon the server already running in the container, using the same bind and base path, and exits 0 or 1. The Dockerfile'sHEALTHCHECKruns it, with the timings proposed in the issue, and the README's Docker section now describes it. A pass means the server is answering, not that the vault is readable.Run against a real arm64 image:
HEALTHCHECKis on the image, and the container readshealthywith an auth token set.ZENNOTES_BASE_PATH=/zenit readshealthy./zen/healthzanswers 200 and/healthzanswers 404, so the probe uses the base path.unhealthy, thenhealthyagain once loopback returns.unhealthyonce the 3s probe timeout hits.healthy, anddepends_on: service_healthyholds a dependent service back until they do.healthcheck nowonly probes and exits 1 when nothing is listening. It does not start a second server.go vet ./...,go test ./...and the CI nix build pass locally. No amd64 image was run; CI builds it.