0.28.4 — nomos healthcheck via binary subcommand (distroless has no wget)
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
ci / web (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

The nomos runtime image is gcr.io/distroless/static (no shell/wget), so the
wget-based healthcheck (D5) could never run — nomos showed docker-unhealthy
despite serving /healthz fine. Add a 'nomos healthcheck' subcommand that
self-probes NOMOS_LISTEN/healthz (exit 0 on 200), and point the compose
healthcheck at ["/nomos", "healthcheck"].
This commit is contained in:
2026-08-08 22:09:18 +02:00
parent 137a2afb8d
commit a30c024ef8
3 changed files with 28 additions and 4 deletions

View File

@@ -1 +1 @@
0.28.3
0.28.4

View File

@@ -186,6 +186,28 @@ func main() {
srv.Shutdown(context.Background())
clientPool.closeAll()
case "healthcheck":
// Self-probe for Docker healthcheck. The nomos runtime image is
// distroless (no shell/wget), so the container can't run wget — the
// binary probes its own /healthz instead. Exit 0 on 200, 1 otherwise.
addr := os.Getenv("NOMOS_LISTEN")
if addr == "" {
addr = ":8092"
}
host := addr
if strings.HasPrefix(host, ":") {
host = "127.0.0.1" + host
}
client := &http.Client{Timeout: 3 * time.Second}
resp, err := client.Get("http://" + strings.TrimPrefix(host, "http://") + "/healthz")
if err != nil {
os.Exit(1)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
os.Exit(1)
}
default:
fmt.Fprintf(os.Stderr, "unknown command: %s\n", os.Args[1])
os.Exit(1)

View File

@@ -233,8 +233,10 @@ services:
stop_grace_period: 10s
mem_limit: 512m
cpus: 1.0
# nomos runs on a distroless image (no shell/wget), so the healthcheck
# uses the binary's own `healthcheck` subcommand to self-probe /healthz.
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8092/healthz"]
test: ["CMD", "/nomos", "healthcheck"]
interval: 30s
timeout: 5s
retries: 3