Watch
0
0
Fork
You've already forked hyperhive
0

swarm daemons: opt-in /healthz and /readyz listener, and /readyz on the controller

This commit is contained in:
atlas 2026-11-18 13:52:36 +01:00 • committed by mara
commit c21b158884

View file

@ -265,3 +265,38 @@ under a tight sandbox, but its network isn't restricted, which the design page
spells out. The settings, limits and reasons:
[`stt.md`](../../4-implementation/swarm/stt.md) and
[Host setup](../../4-implementation/swarm/stt.md#host-setup).
### Health endpoints
The queue daemons (`swarm-stt`, `swarm-review-classifier`,
`swarm-notify-router`, `swarm-builder`, `swarm-claude-login`),
`swarm-nats-auth` and the three auth responders (`swarm-logs-auth`,
`swarm-metrics-auth`, `swarm-authelia-bridge`) can serve two probe endpoints.
They answer 200 or 503 and send no body.
- `GET /healthz` is 200 while the daemon's main loop is running. The loop
beats as it takes messages, so a loop that stops polling turns the answer to 503
after 30 seconds (5 minutes for `swarm-notify-router`, whose loop handles a
batch of events between beats). Before the loop's first beat the answer is
200: waiting on the secret store at startup doesn't count as stuck. A
daemon that only serves requests (the three auth responders) beats from a task
on its runtime, so `/healthz` shows the runtime still runs tasks, not that
its accept loop is healthy.
- `GET /readyz` is 200 while the daemon has what it needs to work: its queue
connection works (`swarm-stt`, `swarm-review-classifier`,
`swarm-notify-router`, `swarm-builder`, `swarm-claude-login`,
`swarm-nats-auth`), or it has bound its socket (the three auth responders).
Nothing listens by default. Set `SWARM_STT_HEALTH_ADDR`,
`SWARM_REVIEW_CLASSIFIER_HEALTH_ADDR`, `SWARM_NOTIFY_ROUTER_HEALTH_ADDR`,
`SWARM_BUILDER_HEALTH_ADDR`, `SWARM_CLAUDE_LOGIN_HEALTH_ADDR` or
`SWARM_AUTHELIA_BRIDGE_HEALTH_ADDR` to a `host:port` to bind the listener. For
`swarm-nats-auth`, `swarm-logs-auth` and `swarm-metrics-auth`, pass
`--health-addr`, or set `SWARM_NATS_AUTH_HEALTH_ADDR`,
`SWARM_LOGS_AUTH_HEALTH_ADDR` or `SWARM_METRICS_AUTH_HEALTH_ADDR`; the flag
wins. No NixOS module sets one. The listener stops on the same SIGTERM as the
daemon.
`swarm-controller` serves `GET /readyz` on its existing socket, next to
`/health`. It answers 200 while the queue connection works and the secret store
accepts the controller's login, and 503 otherwise.