docs: updater/README.md erstellt (cross-platform, FreeBSD+Linux), Komponenten-Tabelle ergänzt

This commit is contained in:
cynfo3000 2026-03-06 10:07:15 +01:00
parent 0698c26a29
commit 138a43e69b
2 changed files with 103 additions and 1 deletions

View File

@ -38,6 +38,7 @@ Client ──► Backend:ProxyPort ──► WebSocket (Binary) ──► Agent
| **Backend** | REST API, WebSocket Hub, Tunnel Manager, PostgreSQL + TimescaleDB | [docs/BACKEND.md](docs/BACKEND.md) | | **Backend** | REST API, WebSocket Hub, Tunnel Manager, PostgreSQL + TimescaleDB | [docs/BACKEND.md](docs/BACKEND.md) |
| **Agent BSD** | OPNsense/FreeBSD Agent — Installation, Firmware, OTA-Updates, OPNsense-Updates | [agent-bsd/README.md](agent-bsd/README.md) | | **Agent BSD** | OPNsense/FreeBSD Agent — Installation, Firmware, OTA-Updates, OPNsense-Updates | [agent-bsd/README.md](agent-bsd/README.md) |
| **Agent Linux** | Linux/Proxmox Agent — Installation, Monitoring, Remote-Commands | [agent-linux/README.md](agent-linux/README.md) | | **Agent Linux** | Linux/Proxmox Agent — Installation, Monitoring, Remote-Commands | [agent-linux/README.md](agent-linux/README.md) |
| **Updater** | OTA-Update-Daemon fuer Agent-Binaries (FreeBSD + Linux, cross-platform) | [updater/README.md](updater/README.md) |
| **Frontend** | React + Vite + TailwindCSS Web-Frontend | [docs/FRONTEND.md](docs/FRONTEND.md) | | **Frontend** | React + Vite + TailwindCSS Web-Frontend | [docs/FRONTEND.md](docs/FRONTEND.md) |
| **API** | Vollstaendige REST API mit allen Endpoints | [docs/API.md](docs/API.md) | | **API** | Vollstaendige REST API mit allen Endpoints | [docs/API.md](docs/API.md) |
@ -149,7 +150,7 @@ rmm/
│ ├── monitor/monitor.go │ ├── monitor/monitor.go
│ ├── api/ # REST Handler, Auth, Middleware │ ├── api/ # REST Handler, Auth, Middleware
│ └── ws/ # WebSocket Hub, Tunnel Manager │ └── ws/ # WebSocket Hub, Tunnel Manager
├── updater/main.go # Separater Update-Daemon ├── updater/ # OTA-Update-Daemon (FreeBSD + Linux)
├── frontend/ # React + Vite + TailwindCSS ├── frontend/ # React + Vite + TailwindCSS
│ └── src/ │ └── src/
├── opnsense-plugin/ # OPNsense MVC Plugin + Installer ├── opnsense-plugin/ # OPNsense MVC Plugin + Installer

101
updater/README.md Normal file
View File

@ -0,0 +1,101 @@
# RMM Updater
Separater Update-Daemon für RMM-Agents. Läuft neben dem Agent und übernimmt
OTA-Updates (Over-the-Air) ohne manuelle Eingriffe.
**Cross-Platform:** Ein Quellcode, zwei Build-Targets — FreeBSD (OPNsense) und Linux.
Die Plattform wird zur Laufzeit per `runtime.GOOS` erkannt.
---
## Wie es funktioniert
1. Backend setzt `update_requested = true` für einen Agent (manuell oder via Frontend)
2. Updater pollt alle 60s: `GET /api/v1/firmware?platform=<freebsd|linux>`
3. Wenn neue Version verfügbar: ZIP-Bundle herunterladen + SHA256 prüfen
4. Agent stoppen → Binary ersetzen → Agent starten
5. Bei Fehler: automatischer Rollback auf `.bak`-Backup
6. `update_requested` wird zurückgesetzt
---
## Plattform-spezifische Pfade
| | FreeBSD (OPNsense) | Linux |
|--|--|--|
| Agent-Binary | `/usr/local/rmm/rmm-agent` | `/usr/local/bin/rmm-agent` |
| Updater-Binary | `/usr/local/rmm/rmm-updater` | `/usr/local/bin/rmm-updater` |
| Config | `/usr/local/etc/rmm-agent/config.yaml` | `/etc/rmm/config.yaml` |
| Service stoppen | `service rmm-agent stop` | `systemctl stop rmm-agent` |
| Service starten | `service rmm-agent start` | `systemctl start rmm-agent` |
| Logs | `/var/log/rmm-updater.log` | `journalctl -u rmm-updater` |
| ZIP-Name Agent | `rmm-agent` | `rmm-agent-linux` |
| ZIP-Name Updater | `rmm-updater-freebsd` | `rmm-updater-linux` |
---
## Konfiguration
Liest dieselbe `config.yaml` wie der Agent — keine eigene Konfigurationsdatei nötig.
```yaml
backend_url: "https://BACKEND_IP:8443"
api_key: "DEIN_API_KEY"
insecure: true
```
---
## Bauen
```bash
# Auf dem Build-Server
cd /opt/rmm
# FreeBSD
make updater-freebsd VERSION=1.0.3
# → build/rmm-updater-freebsd
# Linux
make updater-linux VERSION=1.0.3
# → build/rmm-updater-linux
# Beides + Agent in einem ZIP (empfohlen)
make release VERSION=1.0.3
# → build/release/rmm-freebsd-1.0.3.zip (rmm-agent + rmm-updater-freebsd + install.sh)
# → build/release/rmm-linux-1.0.3.zip (rmm-agent-linux + rmm-updater-linux + install.sh)
```
---
## Service-Management
### FreeBSD (OPNsense)
```bash
service rmm_updater status
service rmm_updater start | stop | restart
tail -f /var/log/rmm-updater.log
```
### Linux
```bash
systemctl status rmm-updater
systemctl start | stop | restart rmm-updater
journalctl -u rmm-updater -f
```
---
## Update manuell auslösen (API)
```bash
# Einzelnen Agent updaten
curl -sk -X POST "https://BACKEND_IP:8443/api/v1/agents/AGENT_ID/request-update" \
-H "X-API-Key: DEIN_API_KEY"
# Alle Agents updaten
curl -sk -X POST "https://BACKEND_IP:8443/api/v1/agents/request-update-all" \
-H "X-API-Key: DEIN_API_KEY"
```