add /health/live and /health/ready hive-wide health endpoints

This commit is contained in:
damocles 2026-07-31 19:30:29 +02:00 committed by mara
commit b39bf67cb3
3 changed files with 140 additions and 10 deletions

View file

@ -259,16 +259,16 @@ let
'';
# Dashboard: nginx static-serves the dist, c0re is API-only. Routing
# is by PATH, never content-type. c0re serves exactly two prefixes —
# `/api/` (all dashboard data + actions + the SSE streams) and
# `/webhook/` (knowledge push + config-PR approval triggers, HMAC-
# guarded) — so those proxy to c0re and everything else serves the
# dist with an SPA fallback to index.html. Path routing is
# deterministic where an Accept-header split would make the SAME url
# behave differently by content-type (e.g. `/api/state` fetched with
# `Accept: text/html` wrongly getting index.html). A new top-level
# c0re route prefix (beyond /api + /webhook) needs a matching
# location added here.
# is by PATH, never content-type. c0re serves exactly three prefixes —
# `/api/` (all dashboard data + actions + the SSE streams), `/webhook/`
# (knowledge push + config-PR approval triggers, HMAC-guarded), and
# `/health/` (liveness + readiness) — so those proxy to c0re and
# everything else serves the dist with an SPA fallback to index.html.
# Path routing is deterministic where an Accept-header split would make
# the SAME url behave differently by content-type (e.g. `/api/state`
# fetched with `Accept: text/html` wrongly getting index.html). A new
# top-level c0re route prefix (beyond /api + /webhook + /health) needs
# a matching location added here.
dashboardProxyLocation = {
"/" = {
root = dashboardDist;
@ -294,6 +294,15 @@ let
# for these endpoints; hive-c0re verifies it in the handler.
proxyPass = "http://${cfg.upstreamHost}:${toString cfg.upstreamPort}";
};
"/health/" = {
# No dashboardAuth here either, for a different reason than
# /webhook/: an external uptime monitor generally can't do
# interactive HTTP Basic. The endpoints themselves are scoped to
# status + warning kind/message (see hive-c0re/src/dashboard/
# health.rs) — no tokens, no agent detail — so exposing them
# unauthenticated isn't a new secret surface.
proxyPass = "http://${cfg.upstreamHost}:${toString cfg.upstreamPort}";
};
};
in
{