feat: expose server mode in /health and /ready endpoints #39

Closed
opened 2026-02-08 21:40:04 +00:00 by forbes · 0 comments
Owner

Summary

Clients need to know the server's operational state to adjust UI behavior (disable writes, show banners).

Proposed modes

Mode Meaning
normal Full read/write
read-only DB reads work, writes return 503
degraded DB up, MinIO unreachable (file ops fail)

Changes to existing endpoints

Add mode field to both existing endpoints:

GET /health
{ "status": "ok", "mode": "normal" }

GET /ready
{
  "status": "ok",
  "mode": "degraded",
  "database": "ok",
  "minio": "unreachable",
  "sse_clients": 2
}

Mode also pushed via SSE server.state event when it changes (depends on #38).

Acceptance criteria

  • mode field added to /health and /ready responses
  • Mode derived from actual connectivity checks, not just config
  • read-only mode settable via config flag or SIGUSR1
  • Write endpoints return 503 with {"error":"server_read_only"} when in read-only mode
## Summary Clients need to know the server's operational state to adjust UI behavior (disable writes, show banners). ## Proposed modes | Mode | Meaning | |------|---------| | `normal` | Full read/write | | `read-only` | DB reads work, writes return 503 | | `degraded` | DB up, MinIO unreachable (file ops fail) | ## Changes to existing endpoints Add `mode` field to both existing endpoints: ```json GET /health { "status": "ok", "mode": "normal" } GET /ready { "status": "ok", "mode": "degraded", "database": "ok", "minio": "unreachable", "sse_clients": 2 } ``` Mode also pushed via SSE `server.state` event when it changes (depends on #38). ## Acceptance criteria - [ ] `mode` field added to `/health` and `/ready` responses - [ ] Mode derived from actual connectivity checks, not just config - [ ] `read-only` mode settable via config flag or `SIGUSR1` - [ ] Write endpoints return 503 with `{"error":"server_read_only"}` when in read-only mode
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#39