Fixes #1. - New `logto: {status, responseTimeMs, error?}` field in /health response - Configurable via LOGTO_HEALTH_URL env (default: auth.lacompagniemaximus.com OIDC discovery endpoint) - 3s timeout via AbortController; /health stays HTTP 200 even if Logto is down - getCpuPercent converted to async (setTimeout-based delay) so the 500ms CPU sample and the Logto fetch run concurrently via Promise.all; total latency stays max(500ms, <=3000ms) instead of the sum - Commit project CLAUDE.md (previously untracked) with the new field documented Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
831 B
Markdown
28 lines
831 B
Markdown
# VPS Health API
|
|
|
|
API sante minimaliste pour le VPS. ~127 lignes, Node 22 + HTTP natif.
|
|
|
|
## Endpoints
|
|
|
|
- `GET /health` — CPU, memoire, disque, uptime, logto (`{status, responseTimeMs, error?}`)
|
|
- `GET /defenseurs` — contenu de status.json (rapports defenseurs)
|
|
|
|
## Auth
|
|
|
|
- Bearer token via env `HEALTH_TOKEN`
|
|
- Fail-closed : si `HEALTH_TOKEN` non configure, toutes les requetes sont refusees
|
|
|
|
## Config
|
|
|
|
- Port : `3001` (env `PORT`)
|
|
- `LOGTO_HEALTH_URL` : URL du `.well-known/openid-configuration` (default auth.lacompagniemaximus.com)
|
|
- Bind-mount : `/data/defenseurs/status.json` read-only
|
|
|
|
## Deploy
|
|
|
|
Coolify auto-rebuild depuis push Forgejo. Aucune action manuelle requise.
|
|
|
|
## Gotchas
|
|
|
|
- Pas d'Express — HTTP natif Node.js uniquement
|
|
- Le `status.json` est ecrit par le Sergent defenseurs, pas par cette API (read-only)
|