fix(serve): mount /healthz on the public origin #44

Merged
libretech merged 1 commits from fix/healthz-routing into main 2026-04-29 15:16:31 +02:00
Owner

The new deploy workflow's health check (and the in-container
`/librenotes healthcheck` invocation) both hit `/healthz` on
the public origin and were returning 404. Cause: `cmd/librenotes/serve.go`
mounts `apiHandler` only at `/auth/` and `/api/`, so `/healthz`
falls through to the static file server.

This patch mounts `/healthz` on the root mux directly and adds a
small `serve_test.go` that exercises the routing topology so the
regression cannot reappear silently.

Verified locally:

```
$ /tmp/librenotes-bin serve &
$ curl -s -o /dev/null -w '%{http_code}\n' http://localhost:18080/healthz
200
$ go test ./cmd/librenotes/
ok git.librete.ch/public/librenotes/cmd/librenotes 0.011s
```

Once merged this should turn the next deploy run green end-to-end.

Stacks on top of #43 (already merged).

The new deploy workflow's health check (and the in-container \`/librenotes healthcheck\` invocation) both hit \`/healthz\` on the public origin and were returning 404. Cause: \`cmd/librenotes/serve.go\` mounts \`apiHandler\` only at \`/auth/\` and \`/api/\`, so \`/healthz\` falls through to the static file server. This patch mounts \`/healthz\` on the root mux directly and adds a small \`serve_test.go\` that exercises the routing topology so the regression cannot reappear silently. Verified locally: \`\`\` $ /tmp/librenotes-bin serve & $ curl -s -o /dev/null -w '%{http_code}\n' http://localhost:18080/healthz 200 $ go test ./cmd/librenotes/ ok git.librete.ch/public/librenotes/cmd/librenotes 0.011s \`\`\` Once merged this should turn the next deploy run green end-to-end. Stacks on top of #43 (already merged).
libretech added 1 commit 2026-04-29 15:16:21 +02:00
fix(serve): mount /healthz on the public origin
CI / ci (pull_request) Failing after 5m38s
2508d4fe28
The /healthz route was registered inside httpapi.Server.Routes() but
the root mux only attached that handler at /auth/ and /api/, so any
request to /healthz fell through to the static file server and got
404'd. Caddy's reverse-proxy and the deploy workflow's curl-based
health check both hit the public origin, so the in-container
healthcheck reported 'unhealthy' and CI never marked the deploy as
verified.

Mount /healthz on the root mux explicitly. Add a serve_test.go that
asserts the same routing topology so the regression cannot return
silently.
libretech merged commit 3c31b79a8d into main 2026-04-29 15:16:31 +02:00
Sign in to join this conversation.