Cleanup repo, add Gitea CI/CD workflow, improve error handling
All checks were successful
Deploy GSM / deploy (push) Successful in 1m25s

- Remove temp files and reorganize docs
- Add .gitea/workflows/deploy.yml for automated deployment
- Add unreachable host checks to server routes (/:id, logs, start/stop/restart)
- Add unreachable checks to config routes (zomboid, terraria, openttd)
- Return HTTP 503 with unreachable flag instead of crashing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alexander Zielonka
2026-01-09 12:15:32 +01:00
parent f2f9e02fb2
commit 2d9a5910fa
22 changed files with 181 additions and 2861 deletions

View File

@@ -0,0 +1,69 @@
# Handoff: Satisfactory Server Setup
**Datum**: 2026-01-08
**Status**: Windows VM Installation blockiert
## Aktueller Stand
### Was passiert ist
1. Linux LXC mit Docker für Satisfactory aufgesetzt
2. Festgestellt: **SatisfactoryPlus Mod ist nur für Windows** verfügbar (kein LinuxServer Build)
3. LXC 105 wieder gelöscht
4. Windows Server 2022 VM Erstellung gestartet
5. **Problem**: Windows Installer findet keine Festplatte (VirtIO Treiber werden nicht erkannt)
### Das Problem
- Windows Installer zeigt "no signed device drivers were found"
- VirtIO ISO eingebunden, aber Treiber werden nicht akzeptiert
- Vermutlich Secure Boot oder falscher Controller-Typ
## Nächste Schritte morgen
### 1. VM-Konfiguration prüfen
```bash
ssh root@192.168.2.20 "qm config <VM-ID>"
```
- Welche VM-ID wurde verwendet? (nicht mehr 105)
- Prüfen: BIOS-Typ (SeaBIOS vs OVMF/UEFI)
- Prüfen: Secure Boot aktiviert?
### 2. Lösungsoptionen
**Option A: SeaBIOS statt UEFI**
- VM → Options → BIOS → SeaBIOS
- Kein Secure Boot Problem
**Option B: IDE Controller verwenden**
- Hard Disk detachen
- Neu hinzufügen mit Bus: IDE
- Langsamer aber funktioniert ohne Treiber
**Option C: VirtIO mit korrektem Treiber**
- Neueste VirtIO ISO: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
- Im Installer: Treiber laden → `viostor\2k22\amd64` (nicht vioscsi!)
### 3. Nach Windows Installation
- [ ] VirtIO Guest Tools installieren (`virtio-win-guest-tools.exe`)
- [ ] QEMU Guest Agent aktivieren
- [ ] Statische IP 192.168.2.54 setzen
- [ ] OpenSSH Server installieren (für GSM)
- [ ] Node Exporter für Windows installieren
- [ ] Satisfactory Dedicated Server installieren (Steam)
- [ ] Satisfactory Mod Manager (SMM) installieren
- [ ] SatisfactoryPlus Mod installieren
- [ ] GSM config.json erweitern
- [ ] Firewall Ports öffnen (7777, 15777, 15000)
## VM Empfohlene Specs
| Setting | Wert |
|---------|------|
| OS | Windows Server 2022 mit GUI |
| CPU | 4-6 vCPU |
| RAM | 20-24 GB |
| Disk | 100 GB |
| IP | 192.168.2.54 |
| BIOS | SeaBIOS (einfacher) |
## Relevante Dateien
- GSM Config: `/opt/gameserver-monitor/backend/config.json` (auf 192.168.2.30)
- Doku: `docs/satisfactory.md` (muss neu erstellt werden nach Setup)

View File

@@ -64,7 +64,9 @@ Steam App IDs:
- V Rising: `1829350`
- Factorio: `427520` (oder manuell von factorio.com)
## Schritt 2: Systemd Service erstellen
## Schritt 2: Service erstellen (systemd oder PM2)
### Option A: Systemd Service (empfohlen für root-Zugang)
Erstelle `/etc/systemd/system/<spielname>.service`:
@@ -92,6 +94,34 @@ systemctl daemon-reload
systemctl enable <spielname>
```
### Option B: PM2 (für User ohne root-Zugang)
PM2 eignet sich für Server, wo kein Root-Zugang verfügbar ist (z.B. externe VMs).
```bash
# NVM installieren
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.nvm/nvm.sh
# Node.js und PM2 installieren
nvm install --lts
npm install -g pm2
# Server starten (Beispiel Terraria)
cd /home/<user>/<spielordner>
pm2 start ./StartServer.sh --name <spielname>
# Speichern für Autostart
pm2 save
```
Für Autostart nach Reboot muss ein Admin den folgenden Befehl mit sudo ausführen:
```bash
sudo env PATH=$PATH:/home/<user>/.nvm/versions/node/<version>/bin pm2 startup systemd -u <user> --hp /home/<user>
```
In der GSM config.json `"runtime": "pm2"` und `"serviceName": "<pm2-prozessname>"` setzen.
## Schritt 3: Node Exporter installieren
Für Metriken im GSM Dashboard:
@@ -352,3 +382,4 @@ CREATE TABLE server_display_settings (
| V Rising | 192.168.2.52 | LXC | 9876-9877/UDP |
| Palworld | 192.168.2.53 | LXC | 8211/UDP, 27015/UDP |
| Project Zomboid | 10.0.30.66 | VM (extern) | 16261-16262/UDP |
| Terraria | 10.0.30.202 | VM (extern/VPN) | 7777/TCP |

338
docs/gsm.md Normal file
View File

@@ -0,0 +1,338 @@
# Gameserver Monitor (GSM) - Dokumentation
## Uebersicht
Der Gameserver Monitor ist eine Web-Applikation zur Ueberwachung und Verwaltung von Gameservern.
**URL:** https://monitor.dimension47.de
**Server:** 192.168.2.30 (LXC Container)
---
## Architektur
```
Browser
|
v
+------------------+
| nginx (Port 80) | Reverse Proxy
+--------+---------+
|
+-----+-----+
| |
v v
Frontend Backend
(dist/) (Port 3000)
| |
| +-----+-----+
| | | |
| v v v
| SQLite SSH RCON
| | | |
| | +-----+-----+
| | | |
| v v v
| users.db .50 .51 .52
| whitelist Facto MC VRis
|
+---> Prometheus (Port 9090)
|
v
Grafana (Port 3001)
```
---
## Tech Stack
| Komponente | Technologie |
|------------|-------------|
| Frontend | React 18 + Vite + TailwindCSS 4 + recharts |
| Backend | Node.js 20 + Express |
| Datenbank | SQLite (better-sqlite3) |
| Auth | JWT + bcrypt |
| Metrics | Prometheus + Node Exporter |
| Dashboards | Grafana |
| Reverse Proxy | nginx |
---
## Verzeichnisstruktur
```
/opt/gameserver-monitor/
|
+-- backend/
| +-- server.js # Express Server Entry
| +-- config.json # Server-Konfiguration
| +-- .env # JWT_SECRET
| +-- package.json
| |
| +-- routes/
| | +-- servers.js # /api/servers Endpoints
| | +-- auth.js # /api/auth Endpoints
| |
| +-- services/
| | +-- ssh.js # SSH-Verbindungen, Status, Uptime
| | +-- rcon.js # RCON-Kommunikation
| | +-- prometheus.js # Prometheus Queries
| | +-- factorio.js # Factorio Map-Gen Presets/Defaults
| |
| +-- middleware/
| | +-- auth.js # JWT Middleware
| |
| +-- db/
| +-- init.js # DB-Schema, Caches, Templates
| +-- users.sqlite # User-Datenbank (users, whitelist_cache, factorio_templates, factorio_world_settings)
|
+-- frontend/
+-- src/
| +-- main.jsx
| +-- App.jsx
| +-- api.js # API Client
| |
| +-- pages/
| | +-- Dashboard.jsx
| | +-- ServerDetail.jsx
| |
| +-- components/
| | +-- ServerCard.jsx
| | +-- MetricsChart.jsx
| | +-- LoginModal.jsx
| | +-- SettingsModal.jsx
| | +-- UserManagement.jsx
| | +-- FactorioWorldManager.jsx # Factorio Save-Verwaltung
| | +-- WorldGenForm.jsx # Map-Generation-Formular
| |
| +-- context/
| +-- UserContext.jsx
|
+-- public/
| +-- minecraft.png
| +-- factorio.png
| +-- vrising.png
| +-- navbarlogograuer.png
| +-- navbarlogoweiss.png
|
+-- dist/ # Build Output (wird von nginx served)
+-- index.html
+-- package.json
+-- vite.config.js
+-- tailwind.config.js
```
---
## API Endpoints
### Authentifizierung
| Method | Endpoint | Auth | Beschreibung |
|--------|----------|------|--------------|
| POST | /api/auth/login | - | Login, gibt JWT zurueck |
| GET | /api/auth/me | JWT | Aktueller User + Rolle |
| POST | /api/auth/change-password | JWT | Eigenes Passwort aendern |
| GET | /api/auth/users | superadmin | Alle User auflisten |
| POST | /api/auth/users | superadmin | Neuen User erstellen |
| PATCH | /api/auth/users/:id/role | superadmin | Rolle aendern |
| PATCH | /api/auth/users/:id/password | superadmin | Passwort setzen |
| DELETE | /api/auth/users/:id | superadmin | User loeschen |
### Server
| Method | Endpoint | Auth | Beschreibung |
|--------|----------|------|--------------|
| GET | /api/servers | optional | Alle Server mit Status/Metrics |
| GET | /api/servers/:id | optional | Einzelner Server |
| POST | /api/servers/:id/start | moderator | Server starten (body: `{save: "name"}` fuer Factorio) |
| POST | /api/servers/:id/stop | moderator | Server stoppen |
| POST | /api/servers/:id/restart | moderator | Server neustarten |
| GET | /api/servers/:id/logs | moderator | Console Logs |
| POST | /api/servers/:id/rcon | moderator | RCON Befehl senden |
| GET | /api/servers/:id/whitelist | optional | Whitelist (gecached) |
| GET | /api/servers/:id/metrics/history | optional | Prometheus History |
### Factorio World Management
| Method | Endpoint | Auth | Beschreibung |
|--------|----------|------|--------------|
| GET | /api/servers/factorio/saves | moderator | Liste aller Saves |
| GET | /api/servers/factorio/current-save | JWT | Aktuell geladener Save |
| GET | /api/servers/factorio/presets | moderator | Map-Gen Presets + Defaults |
| GET | /api/servers/factorio/presets/:name | moderator | Einzelnes Preset |
| GET | /api/servers/factorio/templates | moderator | Gespeicherte Templates |
| POST | /api/servers/factorio/templates | moderator | Template speichern |
| DELETE | /api/servers/factorio/templates/:id | moderator | Template loeschen |
| POST | /api/servers/factorio/create-world | moderator | Neue Welt erstellen |
| DELETE | /api/servers/factorio/saves/:name | moderator | Save loeschen |
| GET | /api/servers/factorio/saves/:name/settings | moderator | Erstellungs-Settings einer Welt |
---
## Rollensystem
| Rolle | Rechte |
|-------|--------|
| (kein Login) | Dashboard ansehen, Metriken sehen |
| user | Wie ohne Login |
| moderator | + Server starten/stoppen, Logs, RCON, Whitelist |
| superadmin | + Nutzerverwaltung |
---
## Server-Konfiguration
`/opt/gameserver-monitor/backend/config.json`:
```json
{
"servers": [
{
"id": "minecraft",
"name": "All the Mods 10 | Minecraft",
"host": "192.168.2.51",
"type": "minecraft",
"runtime": "screen",
"screenName": "minecraft",
"workDir": "/opt/minecraft",
"startCmd": "./run.sh",
"rconPort": 25575,
"rconPassword": "gsm-mc-2026"
},
{
"id": "factorio",
"name": "Factorio",
"host": "192.168.2.50",
"type": "factorio",
"runtime": "docker",
"containerName": "factorio",
"rconPort": 27015,
"rconPassword": "jieTig6IkixaKuu"
},
{
"id": "vrising",
"name": "V Rising",
"host": "192.168.2.52",
"type": "vrising",
"runtime": "systemd",
"serviceName": "vrising",
"workDir": "/home/steam/vrising"
}
]
}
```
### Runtime-Typen
| Runtime | Status-Check | Start | Stop | Uptime |
|---------|--------------|-------|------|--------|
| docker | docker inspect | docker start | docker stop | Container StartedAt |
| screen | screen -ls | screen -dmS | screen -X quit | ps -o etimes |
| systemd | systemctl is-active | systemctl start | systemctl stop | ActiveEnterTimestamp |
---
## Features
### Oeffentliches Dashboard
- Dashboard ist ohne Login sichtbar
- Login-Modal fuer Admins ueber "Sign in" Button
- Alle Server-Karten sichtbar, aber ohne Admin-Hints
### Gameserver-Uptime
- Zeigt Prozess-Uptime statt Host-Uptime
- Docker: Container-Laufzeit
- Screen: Session-Laufzeit
- Systemd: Service-Aktivzeit
### Whitelist-Caching (Minecraft)
- Whitelist wird serverseitig in SQLite gecached
- Anzeige auch wenn Server offline
- Bearbeitung nur wenn Server online
- Cache wird bei jeder Aenderung aktualisiert
### Factorio World Management
- **Worlds-Tab** in Server-Detail fuer Factorio-Server
- **Gesperrte Verwaltung** wenn Server laeuft/startet/stoppt
- **Save-Auswahl beim Start**: Klick auf "Start" bei einem Save startet den Server mit diesem Save
- **Current-Save-Anzeige**: Im Overview-Tab wird angezeigt, welcher Save beim Starten geladen wird
- **Neue Welt erstellen**:
- Vollstaendiges Map-Generation-Formular (Terrain, Ressourcen, Gegner, Evolution)
- Presets (Default, Rich Resources, Marathon, Death World, etc.)
- Templates speichern und laden
- Seed-Eingabe (optional)
- **World Settings anzeigen**:
- Info-Button bei jeder Welt zeigt Erstellungs-Einstellungen
- Legacy-Fallback fuer Welten vor diesem Feature
### Navbar-Logo
- Grau (navbarlogograuer.png) im Normalzustand
- Weiss (navbarlogoweiss.png) bei Hover
- Weiche CSS-Transition (300ms)
- Link zu https://zeasy.software
### Game-Logos
- Automatische Erkennung anhand Server-Name
- minecraft.png, factorio.png, vrising.png
- Angezeigt in ServerCard und ServerDetail
---
## Wartung
### Backend neustarten
```bash
ssh root@192.168.2.30
pkill -f 'node server.js'
cd /opt/gameserver-monitor/backend
node server.js &
```
### Frontend neu bauen
```bash
ssh root@192.168.2.30
cd /opt/gameserver-monitor/frontend
npm run build
nginx -s reload
```
### Logs pruefen
```bash
# Backend (laeuft im Hintergrund)
# Fehler werden auf stderr ausgegeben
# nginx
tail -f /var/log/nginx/error.log
tail -f /var/log/nginx/access.log
```
### Neuen Server hinzufuegen
1. config.json bearbeiten (siehe oben)
2. SSH-Key auf neuem Server hinterlegen
3. Node Exporter installieren (fuer Prometheus)
4. Backend neustarten
### User verwalten
- Ueber UI: Settings > Users (nur superadmin)
- Direkt in DB: `/opt/gameserver-monitor/backend/db/users.sqlite`
---
## Troubleshooting
### 502 Bad Gateway
- Backend laeuft nicht
- Loesung: Backend manuell starten
### Server zeigt "offline" obwohl online
- SSH-Verbindung fehlgeschlagen
- Loesung: SSH-Key pruefen, Firewall pruefen
### Whitelist leer
- RCON-Verbindung fehlgeschlagen
- Loesung: RCON-Port und Passwort pruefen
### Metrics zeigen 0
- Prometheus Target nicht erreichbar
- Loesung: Node Exporter auf Gameserver pruefen

224
docs/infrastructure.md Normal file
View File

@@ -0,0 +1,224 @@
# Homelab Infrastructure
## Netzwerktopologie
```
Internet
|
v
+------------------+
| Router/Modem | 62.155.227.77 (dynamisch, Telekom)
| 192.168.2.1 |
+--------+---------+
|
v
+-------------------------------------------------------------+
| LAN 192.168.2.0/24 |
+-------------------------------------------------------------+
| |
| +--------------+ +--------------+ +--------------+ |
| | Raspberry | | Proxmox | | Windows | |
| | Pi (Himbeer)| | Server | | PC | |
| | .10 | | .20 | | | |
| +------+-------+ +------+-------+ +--------------+ |
| | | |
| | +-------+-------+-------+ |
| | | | | | |
| | v v v v |
| | +-----+ +-----+ +-----+ +-----+ |
| | | .30 | | .50 | | .51 | | .52 | |
| | | LXC | | LXC | | VM | | VM | |
| | |Monit| |Facto| | MC | |VRis | |
| | +-----+ +-----+ +-----+ +-----+ |
| | |
+---------+---------------------------------------------------+
|
v
+-----------+
| Docker |
| Services |
+-----------+
```
---
## Server-Uebersicht
### Raspberry Pi (alex@Himbeer) - 192.168.2.10
**Rolle:** Reverse Proxy & DNS Management
| Service | Container | Funktion |
|---------|-----------|----------|
| Nginx Proxy Manager | nginx-proxy-manager | Reverse Proxy + SSL (Let's Encrypt) |
| Cloudflare DDNS | cloudflare-ddns | Dynamische DNS-Updates |
| Nextcloud | nextcloud | Cloud Storage |
| MariaDB | nextcloud-db | Nextcloud Datenbank |
**NPM Admin-UI:** http://192.168.2.10:81
**Cloudflare DDNS Domains:**
- home.dimension47.de
- factorio.dimension47.de
- minecraft.dimension47.de
- monitor.dimension47.de
- grafana.dimension47.de
---
### Proxmox Server - 192.168.2.20
**Rolle:** Virtualisierungshost
| VMID | Name | Typ | IP | Cores | RAM | Funktion |
|------|------|-----|-----|-------|-----|----------|
| 100 | atm10 | VM (QEMU) | .51 | 4 | 12 GB | Minecraft ATM 10 |
| 101 | factorio | LXC | .50 | 2 | 4 GB | Factorio Server |
| 102 | gameserver-monitor | LXC | .30 | 2 | 4 GB | Monitoring Webapp |
| 103 | vrising | VM (QEMU) | .52 | 4 | 12 GB | V Rising Server |
---
### Gameserver Monitor (root@192.168.2.30) - LXC 102
**Rolle:** Gameserver Ueberwachung & Administration
**URL:** https://monitor.dimension47.de
**Default Login:** admin / admin (Passwort aendern nach erstem Login!)
**Tech Stack:**
- OS: Debian 13 (Trixie)
- Frontend: React + Vite + TailwindCSS 4 + recharts
- Backend: Node.js + Express
- Auth: JWT + bcrypt + SQLite
- Monitoring: Prometheus + Grafana
- Reverse Proxy: nginx
**Features:**
- Oeffentliches Dashboard (ohne Login sichtbar)
- Live CPU/RAM Metriken (via SSH)
- Gameserver-Uptime (Prozess-Uptime statt Host-Uptime)
- Metrics History via Prometheus (15m/1h/6h/24h)
- Player Count + Spielerliste via RCON
- Game-Logos neben Servernamen
- Interaktives Navbar-Logo (Hover-Effekt, Link zu zeasy.software)
- Start/Stop/Restart Server (Moderator+)
- Console Logs (live, Moderator+)
- RCON Console (Moderator+)
- Minecraft Whitelist-Verwaltung mit serverseitigem Caching
- Rollensystem: user, moderator, superadmin
**Todos:**
- Auto-Shutdown: Gameserver automatisch abschalten wenn zu lange kein Spieler online war
**Prometheus Targets:**
- localhost:9100 (monitor)
- 192.168.2.50:9100 (factorio)
- 192.168.2.51:9100 (minecraft)
- 192.168.2.52:9100 (vrising)
**Grafana:** https://grafana.dimension47.de
---
### Factorio Server (root@192.168.2.50) - LXC 101
| Eigenschaft | Wert |
|-------------|------|
| Runtime | Docker |
| Container | factorio |
| Game Port | 34197/udp |
| RCON Port | 27015 |
| RCON Password | jieTig6IkixaKuu |
---
### Minecraft Server (root@192.168.2.51) - VM 100
| Eigenschaft | Wert |
|-------------|------|
| Modpack | All The Mods 10 (ATM10) |
| Runtime | screen |
| Screen Name | minecraft |
| Game Port | 25565 |
| RCON Port | 25575 |
| RCON Password | gsm-mc-2026 |
| Pfad | /opt/minecraft |
---
### V Rising Server (root@192.168.2.52) - VM 103
| Eigenschaft | Wert |
|-------------|------|
| Runtime | systemd |
| Service Name | vrising |
| Game Port | 9876/udp, 9877/udp |
| Pfad | /home/steam/vrising |
---
### Project Zomboid Server (pzuser@10.0.30.66) - Extern via WireGuard
| Eigenschaft | Wert |
|-------------|------|
| Runtime | screen |
| Screen Name | zomboid |
| RCON Port | 27015 |
| Pfad | /opt/pzserver |
| Log | /home/pzuser/Zomboid/server-console.txt |
| Netzwerk | Erreichbar via WireGuard-Tunnel "melih" |
---
## WireGuard VPN
Der Gameserver-Monitor (.30) nutzt einen WireGuard-Tunnel um externe Server (z.B. Zomboid auf 10.0.30.66) zu erreichen.
**Interface:** melih
**Lokale IP:** 10.0.200.201/32
### WireGuard Watchdog
Ein Cronjob prueft alle 2 Minuten ob der Tunnel aktiv ist und startet ihn bei Bedarf neu.
| Komponente | Wert |
|------------|------|
| Script | /usr/local/bin/wg-watchdog.sh |
| Cronjob | */2 * * * * |
| Timeout | 5 Minuten ohne Handshake |
| Log | /var/log/wg-watchdog.log |
---
## SSH-Zugang
Der Gameserver-Monitor (.30) hat SSH-Key-Zugang zu:
- 192.168.2.20 (Proxmox)
- 192.168.2.50 (Factorio)
- 192.168.2.51 (Minecraft)
- 192.168.2.52 (V Rising)
Key: /root/.ssh/id_ed25519
---
## Wartung
### Backend (PM2)
```bash
# Status pruefen
ssh root@192.168.2.30 "pm2 status"
# Logs anschauen
ssh root@192.168.2.30 "pm2 logs gameserver-backend --lines 50"
# Neu starten
ssh root@192.168.2.30 "pm2 restart gameserver-backend"
```
### Frontend neu bauen
```bash
ssh root@192.168.2.30 "cd /opt/gameserver-monitor/frontend && npm run build && nginx -s reload"
```

37
docs/todo.md Normal file
View File

@@ -0,0 +1,37 @@
# Homelab TODOs
## Prioritaet Hoch
- [ ] **GSM Modularisierung & Wiederverwendbarkeit**
- [ ] Server-Typen als Plugins auslagern (minecraft, factorio, vrising, ...)
- [ ] Generisches Interface fuer neue Gameserver-Typen
- [ ] Konfiguration per UI statt config.json
- [ ] Docker-Compose fuer einfaches Deployment
- [ ] Environment-basierte Konfiguration
- [ ] Multi-Instanz-Faehigkeit (mehrere Homelabs)
## Prioritaet Mittel
- [ ] Backup-Loesung fuer Gameserver-Welten
- [ ] Automatische Snapshots (taeglich)
- [ ] Offsite-Backup (Nextcloud/S3)
- [ ] Restore-Prozedur dokumentieren
- [ ] Monitoring-Alerts
- [ ] Discord Webhook bei Server-Crash
- [ ] Email-Benachrichtigung optional
- [ ] Alerting-Regeln in Prometheus/Grafana
- [ ] Automatische Restarts bei Crash
- [ ] Watchdog-Service implementieren
- [ ] Health-Checks definieren
- [ ] Restart-Limits (kein Endlos-Loop)
## Prioritaet Niedrig
- [ ] Dark/Light Mode Toggle im Frontend
- [ ] Server-Logs durchsuchbar machen
- [ ] Scheduled Restarts (z.B. taeglich 4 Uhr)
- [ ] Player-Statistiken (Spielzeit, Join-History)
- [ ] Changelog/Audit-Log fuer Admin-Aktionen