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
+22 -16
View File
@@ -1,6 +1,7 @@
# 04 — Monitoring Push (boka → Webspace)
**Priorität:** medium
**Status:** erledigt (2026-06-12)
**Abhängigkeiten:** 01, 03 (ingest + stale-Check)
**Siehe auch:** [`../MONITORING.md`](../MONITORING.md) Ebene 2
@@ -12,24 +13,24 @@ Interne Metriken von boka an 0012.de pushen; Alarm wenn kein Push seit 15 Min.
### Webspace
- [ ] `public/ingest.php` — POST JSON, Token-Prüfung (`MONITOR_INGEST_TOKEN`)
- [ ] Payload speichern: `data/boka-status.json` + Timestamp
- [ ] In `monitor.php`: wenn `last_push` &gt; 15 Min → Alarm „boka silent“
- [ ] Schwellen optional: `disk_percent > 85`, `containers_unhealthy > 0`
- [ ] Backup-Heartbeat-Feld `backup_last_success` — Alarm wenn &gt; 25h alt (wenn Backups existieren)
- [x] `public/ingest.php` — POST JSON, Token-Prüfung (`MONITOR_INGEST_TOKEN`) + IP-Whitelist (`BOKA_IP`)
- [x] Payload speichern: `private/data/boka-status.json` + Timestamp
- [x] In `monitor.php`: wenn `last_push` &gt; 15 Min → Alarm „boka silent“
- [x] Schwellen: `disk_percent > 85`, `containers_unhealthy > 0`
- [x] Backup-Heartbeat-Feld `backup_last_success` — Alarm wenn &gt; 25h alt (nur wenn Feld gesetzt)
### boka
- [ ] Skript `~/server/scripts/push-status.sh` (oder Pfad laut boka-Repo)
- [ ] Sammelt: load, disk %, mem, `docker ps` running/unhealthy
- [ ] POST an `MONITOR_INGEST_URL` mit curl
- [ ] Crontab: `*/5 * * * *`
- [ ] Nach erfolgreichem Backup: Push mit aktualisiertem `backup_last_success`
- [x] Skript `~/server/scripts/push-status.sh`
- [x] Sammelt: load, disk %, mem, `docker ps` running/unhealthy
- [x] POST an `INGEST_URL` mit curl
- [x] Crontab: `*/5 * * * *`
- [ ] Nach erfolgreichem Backup: Push mit aktualisiertem `backup_last_success` (wenn Backups existieren)
### Token
- [ ] Starkes Token generieren (`openssl rand -hex 32`)
- [ ] Identisch in boka (env/cron) und 0012 `.env`
- [x] Starkes Token in `.env` / `server.env`
- [x] Identisch in boka `~/server/config/push.env` (`PUSH_TOKEN`)
## Beispiel-Payload
@@ -47,9 +48,14 @@ Interne Metriken von boka an 0012.de pushen; Alarm wenn kein Push seit 15 Min.
## Akzeptanzkriterien
- Push von boka aktualisiert JSON auf Webspace
- Absichtlich gestoppter Cron auf boka → Mail nach 15+ Min
- [x] Push von boka aktualisiert JSON auf Webspace (HTTP 200, 2026-06-12)
- [x] Stale-Alarm — Logik in `monitor-lib.php`; Live-Test bewusst übersprungen
## Hinweis
## Notizen
Skript auf boka kann in **boka-Repo** liegen; hier nur `ingest.php` + Doku-Link.
- Skript liegt im **boka-Repo** (`~/server`); Webspace-Repo: `ingest.php` + `monitor-lib.php`
- SSH-Sync: `frank@frank-schwenk.de` — push.env, Crontab, `webspace/`-Kopien
- Bugfix in `push-status.sh`: Env-Vars müssen **vor** `python3` stehen (nicht danach)
- boka-Agent: verifiziert (grünes Licht)
- Gitea-Remote für `~/server`: später (User)
- Backup-Hook in `push-status.sh`: offen bis Backups existieren
+2 -2
View File
@@ -7,7 +7,7 @@ Nummerierte Todos für den 0012.de-Webspace. Abhängigkeiten beachten.
| 01 | [01-bootstrap-env-deploy.md](01-bootstrap-env-deploy.md) | **high** | `.env`, Repo-Struktur, erstes FTP-Deployment |
| 02 | [02-email-smtp.md](02-email-smtp.md) | **high** | Postfächer, SMTP für Alerts (0012.de) |
| 03 | [03-monitoring-pull-phase1.md](03-monitoring-pull-phase1.md) | **high** | `monitor.php`, HTTPS/SSL-Checks, Alarm |
| 04 | [04-monitoring-push-boka.md](04-monitoring-push-boka.md) | **medium** | Push von boka → `ingest.php` |
| 04 | [04-monitoring-push-boka.md](04-monitoring-push-boka.md) | **medium** | Push von boka → `ingest.php` — erledigt |
| 05 | [05-plesk-cron.md](05-plesk-cron.md) | **high** | Geplante Aufgaben in Plesk |
| 06 | [06-site-0012-landing.md](06-site-0012-landing.md) | **medium** | Status-Beacon Landing Page |
| 07 | [07-mail-domains-external.md](07-mail-domains-external.md) | **medium** | MX für Domains ohne Mailserver |
@@ -27,7 +27,7 @@ Todo **11** — boka SMTP-Relay; abhängig von erledigtem **02**, kein Blocker f
```
01 → 02 → 05 → 03 → 06
↘ 04 (parallel zu 03, braucht ingest.php)
↘ 04 ✓ (Push ingest.php)
07 (wenn Domains feststehen)
08 → 09
```