feat: boka push ingest and stale monitoring (todo 04)

Add token- and IP-protected ingest.php, boka status checks in monitor.php,
and document the two-repo push workflow. Todo 04 marked complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Frank Schwenk
2026-06-12 14:51:19 +02:00
parent 2440fbf974
commit 9b18b11f32
10 changed files with 240 additions and 31 deletions
+16 -11
View File
@@ -17,12 +17,15 @@ Siehe auch: [`todo/03-monitoring-pull-phase1.md`](todo/03-monitoring-pull-phase1
- Optional: TCP-Checks (Gitea SSH, RustDesk)
- Bei Fehler: E-Mail / Telegram (nach 2. Versuch, 2 Min Abstand → weniger Fehlalarme)
### Ebene 2 — Push (Cron auf boka, alle 5 Min)
### Ebene 2 — Push (Cron auf boka, alle 5 Min) — **implementiert** (2026-06-12)
- Kleines Skript postet JSON an `ingest.php` auf dem Webspace (Token-geschützt)
- Payload z. B.: `load`, `disk_percent`, `mem_available`, `containers_running`, `containers_unhealthy`
- Webspace-Cron: **kein Push seit 15 Min** → Server oder Netzwerk tot
- Optional: `disk > 85%`, `unhealthy > 0`, Backup-Heartbeat
- Skript `~/server/scripts/push-status.sh` postet JSON an `ingest.php` (Token + IP-Whitelist)
- Payload: `load`, `disk_percent`, `mem_available_mb`, `containers_running`, `containers_unhealthy`
- `ingest.php` speichert nach `private/data/boka-status.json`
- `monitor.php` prüft: kein Push seit 15 Min → „boka silent“; optional Disk &gt; 85 %, unhealthy &gt; 0, Backup &gt; 25h
- Sicherheit: `BOKA_IP=89.163.231.180` — nur Requests von dieser IP werden akzeptiert (zusätzlich zum Token)
**Zwei Repos:** PHP in diesem Repo (Pull + Ingest); Push-Skript + Cron im boka-Repo (`~/server`). Deploy-Ablauf: [`todo/04-monitoring-push-boka.md`](todo/04-monitoring-push-boka.md); boka-seitig `docs/MONITORING-WORKFLOW.md`.
---
@@ -131,8 +134,8 @@ Siehe auch: [`todo/03-monitoring-pull-phase1.md`](todo/03-monitoring-pull-phase1
- API-Health für Stacks mit Backend (bringtake, medis, affen, …)
- Latenz-Schwelle
- Backup-Heartbeat (sobald `todo/05-automated-backups.md` erledigt)
- Push-Status von boka
- Backup-Heartbeat (sobald Backups existieren) — Ingest-Feld `backup_last_success` vorbereitet
- ~~Push-Status von boka~~ → erledigt (Todo 04)
### Phase 3 (low)
@@ -140,14 +143,16 @@ Siehe auch: [`todo/03-monitoring-pull-phase1.md`](todo/03-monitoring-pull-phase1
---
## Dateien (geplant)
## Dateien
| Ort | Datei | Zweck |
|-----|-------|--------|
| Webspace | `monitor.php` | Cron: Pull-Checks, Alarm |
| Webspace | `ingest.php` | Empfang Push von boka |
| Webspace | `monitor.php` | Cron: Pull-Checks + boka-Stale/Schwellen |
| Webspace | `ingest.php` | Empfang Push von boka (Token + IP) |
| Webspace | `private/data/boka-status.json` | Letzter Push-Stand |
| boka | `~/server/scripts/push-status.sh` | Sammelt Metriken, POST an Webspace |
| boka | Crontab | `*/5 * * * *` push-status + ggf. nach Backup |
| boka | `~/server/config/push.env` | `INGEST_URL`, `PUSH_TOKEN` |
| boka | Crontab | `*/5 * * * *` push-status |
---