Files
Khaemhat/docs/adr/0012-endpoint-di-salute.md
T
Alby96andClaude Opus 5.5 12277733f5
CI / Build and test (SQLite) (pull_request) Successful in 43s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / YAML check (pull_request) Successful in 15s
CI / Docker image (pull_request) Successful in 59s
feat: bootstrap solution, Docker image and Gitea pipelines (M0)
Start development with the skeleton every later milestone builds on, so
that code, image and release path exist and are verified from day one.

- Khaemhat.sln with the ten projects of SPEC section 3 and six MSTest
  projects; shared build rules with warnings as errors, analyzers and
  Central Package Management restricted to the allowlist.
- Architecture tests and scripts/check-packages.sh fail on any project
  reference or package that SPEC does not allow.
- Khaemhat.Web serves an Italian "under construction" page with the
  official icons and version, plus /health/live, /health/ready and
  /health (ADR 0012); honours KHAEMHAT_URLS and KHAEMHAT_LOG_LEVEL.
- docker/Dockerfile (non-root app user aligned to PUID/PGID by the
  entrypoint, pg_dump 17, healthcheck, OCI and Unraid labels) and
  compose files for PostgreSQL and a standalone SQLite demo.
- Gitea Actions: ci.yml (build, tests, image smoke test, PostgreSQL
  16/17 on tags, YAML check), release.yml (image and release from a
  vX.Y.Z tag, skipping versions already published) and wiki.yml.
- Development scripts, VS Code launch/tasks for debugging, and ADR
  0012-0017 deciding the M0 open points of docs/STATUS.md.

Closes #1, #2, #3, #4, #5, #114

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 11:53:39 +01:00

1.8 KiB

ADR 0012 - Endpoint di salute

  • Stato: accettata
  • Data: 2026-11-11
  • Modifica: SPEC §16.1, §20 (M0); chiude il punto aperto 5 di docs/STATUS.md (issue #114)

Contesto

SPEC nomina /health/live (usato da HEALTHCHECK, dal compose e dal template Unraid) e un endpoint /health di base in M0, ma non definisce la readiness né il contenuto delle risposte. Un controllo di liveness che dipende dal database fa riavviare il container quando il database è solo lento.

Decisione

Endpoint Risposta Significato
GET /health/live 200 text/plain "live" il processo risponde. Non tocca database, cache né file. È l'unico usato da HEALTHCHECK e dal compose
GET /health/ready 200 "ready" oppure 503 "starting" l'istanza può servire richieste: database di sistema raggiungibile, migrazioni di sistema applicate, bootstrap concluso. In M0 non ci sono dipendenze e risponde sempre 200; i controlli si aggiungono in M1-M2
GET /health 200 application/json {status, live, ready, version, revision} riepilogo per l'amministratore e per la pagina Stato sistema; status è ok o starting

Regole:

  • risposte senza autenticazione e senza dati sensibili: niente versioni dei componenti, connection string, nomi di aziende o percorsi. La versione del prodotto è pubblica (compare anche nella pagina di accesso);
  • la modalità manutenzione di un'azienda non cambia la salute dell'istanza;
  • le metriche (formato e percorso) si decidono in M2 con un ADR separato.

Conseguenze

  • HealthEndpoints in Khaemhat.Web/Hosting mappa i tre percorsi; i test web li chiamano su un host reale.
  • In M1-M2 la readiness legge lo stato di StartupOrchestrator; un orchestratore esterno (Kubernetes o simili) può usare /health/ready senza modifiche all'immagine.