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>
386 lines
9.5 KiB
Markdown
386 lines
9.5 KiB
Markdown
# Neuen Gameserver zum GSM hinzufügen
|
|
|
|
Diese Anleitung beschreibt alle Schritte, um einen neuen Gameserver in das Gameserver Management (GSM) System zu integrieren.
|
|
|
|
## Voraussetzungen
|
|
|
|
- Proxmox LXC Container oder VM für den Gameserver
|
|
- SSH-Zugang vom GSM Server (192.168.2.30) zum neuen Server
|
|
- Freie IP-Adresse im Netzwerk (192.168.2.x)
|
|
|
|
## Schritt 1: Server aufsetzen
|
|
|
|
### 1.1 LXC Container / VM erstellen
|
|
|
|
Auf Proxmox (192.168.2.20) einen neuen Container oder VM erstellen:
|
|
- **LXC** für leichtgewichtige Server (Factorio, Palworld, etc.)
|
|
- **VM** für Server die spezielle Kernel-Features brauchen (Minecraft mit hohem RAM)
|
|
|
|
Empfohlene Ressourcen je nach Spiel:
|
|
| Spiel | CPU Cores | RAM | Speicher |
|
|
|-------|-----------|-----|----------|
|
|
| Factorio | 2 | 2 GB | 20 GB |
|
|
| Minecraft (Modded) | 4-6 | 8-16 GB | 50 GB |
|
|
| Palworld | 4 | 16 GB | 30 GB |
|
|
| Project Zomboid | 4 | 8 GB | 30 GB |
|
|
| V Rising | 2 | 4 GB | 20 GB |
|
|
|
|
### 1.2 Basis-Setup
|
|
|
|
```bash
|
|
# System updaten
|
|
apt update && apt upgrade -y
|
|
|
|
# Grundlegende Pakete
|
|
apt install -y curl wget screen htop
|
|
```
|
|
|
|
### 1.3 SteamCMD installieren (für Steam-Spiele)
|
|
|
|
```bash
|
|
# 32-bit Bibliotheken
|
|
apt install -y lib32gcc-s1
|
|
|
|
# Steam User erstellen
|
|
useradd -m -s /bin/bash steam
|
|
|
|
# SteamCMD installieren
|
|
su - steam
|
|
mkdir steamcmd && cd steamcmd
|
|
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
|
|
tar -xvzf steamcmd_linux.tar.gz
|
|
```
|
|
|
|
### 1.4 Dedicated Server installieren
|
|
|
|
```bash
|
|
# Als steam User
|
|
./steamcmd.sh +force_install_dir /opt/<spielname> +login anonymous +app_update <APP_ID> validate +quit
|
|
```
|
|
|
|
Steam App IDs:
|
|
- Palworld: `2394010`
|
|
- Project Zomboid: `380870`
|
|
- V Rising: `1829350`
|
|
- Factorio: `427520` (oder manuell von factorio.com)
|
|
|
|
## Schritt 2: Service erstellen (systemd oder PM2)
|
|
|
|
### Option A: Systemd Service (empfohlen für root-Zugang)
|
|
|
|
Erstelle `/etc/systemd/system/<spielname>.service`:
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=<Spielname> Dedicated Server
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=steam
|
|
Group=steam
|
|
WorkingDirectory=/opt/<spielname>
|
|
ExecStart=/opt/<spielname>/start.sh
|
|
Restart=on-failure
|
|
RestartSec=10
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
Aktivieren:
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
apt install -y prometheus-node-exporter
|
|
systemctl enable prometheus-node-exporter
|
|
systemctl start prometheus-node-exporter
|
|
```
|
|
|
|
Prüfen ob Port 9100 erreichbar ist:
|
|
```bash
|
|
curl http://localhost:9100/metrics | head
|
|
```
|
|
|
|
## Schritt 4: SSH-Zugang einrichten
|
|
|
|
Auf dem GSM Server (192.168.2.30):
|
|
|
|
```bash
|
|
# Public Key kopieren
|
|
ssh-copy-id -i /root/.ssh/id_ed25519.pub root@192.168.2.XX
|
|
```
|
|
|
|
Testen:
|
|
```bash
|
|
ssh root@192.168.2.XX "hostname"
|
|
```
|
|
|
|
## Schritt 5: DNS Eintrag erstellen
|
|
|
|
### 5.1 Cloudflare DDNS Container aktualisieren
|
|
|
|
Auf dem Raspberry Pi (192.168.2.10):
|
|
|
|
```bash
|
|
cd /home/alex
|
|
nano docker-compose.yml
|
|
```
|
|
|
|
Neue Domain zur `CF_DOMAINS` Umgebungsvariable hinzufügen:
|
|
```yaml
|
|
environment:
|
|
- CF_DOMAINS=gsm.zeasy.dev,factorio.zeasy.dev,<neuer-name>.zeasy.dev
|
|
```
|
|
|
|
Container neu starten:
|
|
```bash
|
|
docker-compose up -d cloudflare-ddns
|
|
```
|
|
|
|
### 5.2 Port Forwarding im Router
|
|
|
|
Benötigte Ports im Router freigeben:
|
|
| Spiel | Ports |
|
|
|-------|-------|
|
|
| Palworld | 8211/UDP, 27015/UDP |
|
|
| Minecraft | 25565/TCP |
|
|
| Factorio | 34197/UDP |
|
|
| Project Zomboid | 16261/UDP, 16262/UDP |
|
|
| V Rising | 9876/UDP, 9877/UDP |
|
|
|
|
## Schritt 6: GSM Backend konfigurieren
|
|
|
|
### 6.1 config.json erweitern
|
|
|
|
Auf dem GSM Server `/opt/gameserver-monitor/backend/config.json`:
|
|
|
|
```json
|
|
{
|
|
"id": "<spielname>",
|
|
"name": "<Anzeigename>",
|
|
"host": "192.168.2.XX",
|
|
"type": "<spielname>",
|
|
"runtime": "systemd",
|
|
"serviceName": "<service-name>",
|
|
"rconPort": XXXXX,
|
|
"rconPassword": "<passwort>",
|
|
"workDir": "/opt/<spielname>",
|
|
"configPath": "/pfad/zur/config"
|
|
}
|
|
```
|
|
|
|
### 6.2 SSH-Funktionen hinzufügen (optional)
|
|
|
|
Falls Config-Editor benötigt wird, in `backend/services/ssh.js`:
|
|
|
|
```javascript
|
|
const <SPIELNAME>_CONFIG_PATH = "/pfad/zu/configs";
|
|
const <SPIELNAME>_ALLOWED_FILES = ["config1.ini", "config2.ini"];
|
|
|
|
export async function list<Spielname>Configs(server) {
|
|
// Implementation
|
|
}
|
|
|
|
export async function read<Spielname>Config(server, filename) {
|
|
// Implementation
|
|
}
|
|
|
|
export async function write<Spielname>Config(server, filename, content) {
|
|
// Implementation
|
|
}
|
|
```
|
|
|
|
### 6.3 Routes hinzufügen (optional)
|
|
|
|
In `backend/routes/servers.js` neue Endpoints für Config-Editor.
|
|
|
|
### 6.4 Backend neustarten
|
|
|
|
```bash
|
|
pm2 restart gameserver-backend
|
|
pm2 logs gameserver-backend --lines 20
|
|
```
|
|
|
|
## Schritt 7: Prometheus konfigurieren
|
|
|
|
Auf dem GSM Server `/etc/prometheus/prometheus.yml`:
|
|
|
|
```yaml
|
|
- job_name: "<spielname>"
|
|
static_configs:
|
|
- targets: ["192.168.2.XX:9100"]
|
|
```
|
|
|
|
Prometheus neustarten:
|
|
```bash
|
|
systemctl restart prometheus
|
|
```
|
|
|
|
## Schritt 8: Frontend erweitern
|
|
|
|
### 8.1 Server-Info in ServerCard.jsx
|
|
|
|
```javascript
|
|
const serverInfo = {
|
|
// ...bestehende Server
|
|
<spielname>: {
|
|
address: '<spielname>.zeasy.dev:<port>',
|
|
logo: '/<spielname>.png',
|
|
links: [
|
|
{ label: 'Steam', url: 'https://store.steampowered.com/app/XXXXXX' }
|
|
]
|
|
}
|
|
}
|
|
|
|
// In getServerInfo():
|
|
if (name.includes('<spielname>')) return serverInfo.<spielname>
|
|
```
|
|
|
|
### 8.2 Logo in ServerDetail.jsx
|
|
|
|
```javascript
|
|
if (name.includes("<spielname>")) return "/<spielname>.png"
|
|
```
|
|
|
|
### 8.3 ActivityLog Labels
|
|
|
|
```javascript
|
|
const serverLabels = {
|
|
// ...
|
|
<spielname>: '<Anzeigename>'
|
|
}
|
|
```
|
|
|
|
### 8.4 API-Funktionen (falls Config-Editor)
|
|
|
|
In `frontend/src/api.js`:
|
|
|
|
```javascript
|
|
export async function get<Spielname>Configs(token) {
|
|
return fetchAPI('/servers/<spielname>/config', {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
})
|
|
}
|
|
// etc.
|
|
```
|
|
|
|
### 8.5 Config-Editor Komponente (optional)
|
|
|
|
Neue Datei `frontend/src/components/<Spielname>ConfigEditor.jsx` erstellen (basierend auf bestehenden Editoren).
|
|
|
|
### 8.6 Icon hinzufügen
|
|
|
|
PNG-Datei nach `frontend/public/<spielname>.png` kopieren (idealerweise 64x64 oder 128x128 Pixel).
|
|
|
|
### 8.7 Frontend bauen und deployen
|
|
|
|
```bash
|
|
cd /opt/gameserver-monitor/frontend
|
|
npm run build
|
|
```
|
|
|
|
## Schritt 9: Anzeigeeinstellungen konfigurieren (optional)
|
|
|
|
Nach dem Hinzufügen eines Servers können Superadmins die Anzeigeeinstellungen direkt im Web-Interface bearbeiten.
|
|
|
|
### 9.1 Anzeigeeinstellungen im Frontend
|
|
|
|
1. Als Superadmin einloggen
|
|
2. Server-Detailansicht öffnen
|
|
3. Tab **"Anzeige"** auswählen
|
|
4. Folgende Felder können bearbeitet werden:
|
|
- **Verbindungsadresse**: Die Adresse die Spielern zum Verbinden angezeigt wird (z.B. `palworld.zeasy.dev:8211`)
|
|
- **Hinweis**: Zusätzliche Informationen wie Passwort, Version, etc. (z.B. `Passwort: geheim123`)
|
|
5. Speichern klicken
|
|
|
|
### 9.2 Verhalten der Anzeigeeinstellungen
|
|
|
|
- **Datenbankwerte haben Priorität**: Wenn Anzeigeeinstellungen in der Datenbank gesetzt sind, überschreiben diese die Standardwerte aus dem Code
|
|
- **Fallback auf Standardwerte**: Wenn keine Datenbankeinstellungen existieren, werden die hartkodierten Standardwerte aus `ServerCard.jsx` verwendet
|
|
- **Minecraft Sonderfall**: Der Standard-Hinweis "Whitelist erforderlich" wird nur angezeigt, wenn kein eigener Hinweis gesetzt wurde
|
|
|
|
### 9.3 Technische Details
|
|
|
|
**Datenbank-Tabelle** (`users.sqlite`):
|
|
```sql
|
|
CREATE TABLE server_display_settings (
|
|
server_id TEXT PRIMARY KEY,
|
|
address TEXT,
|
|
hint TEXT,
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
```
|
|
|
|
**API-Endpoints**:
|
|
- `GET /api/servers/display-settings` - Alle Einstellungen abrufen (für Dashboard)
|
|
- `GET /api/servers/:id/display-settings` - Einstellungen für einen Server (Superadmin)
|
|
- `PUT /api/servers/:id/display-settings` - Einstellungen speichern (Superadmin)
|
|
|
|
**Dateien**:
|
|
- Backend: `backend/routes/servers.js`, `backend/db/init.js`
|
|
- Frontend: `frontend/src/pages/ServerDetail.jsx`, `frontend/src/components/ServerCard.jsx`, `frontend/src/api.js`
|
|
|
|
## Checkliste
|
|
|
|
- [ ] Server aufgesetzt und Spiel installiert
|
|
- [ ] Systemd Service erstellt und aktiviert
|
|
- [ ] Node Exporter installiert
|
|
- [ ] SSH-Zugang vom GSM Server eingerichtet
|
|
- [ ] DNS Eintrag erstellt
|
|
- [ ] Port Forwarding konfiguriert
|
|
- [ ] Backend config.json erweitert
|
|
- [ ] Prometheus Target hinzugefügt
|
|
- [ ] Frontend ServerCard/ServerDetail erweitert
|
|
- [ ] Server-Icon hinzugefügt
|
|
- [ ] Frontend gebaut
|
|
- [ ] Backend neugestartet
|
|
- [ ] Anzeigeeinstellungen konfiguriert (Verbindungsadresse, Hinweis)
|
|
|
|
## Aktuelle Server-Übersicht
|
|
|
|
| Server | IP | Typ | Ports |
|
|
|--------|-----|-----|-------|
|
|
| GSM Monitor | 192.168.2.30 | LXC | 3000, 9090 |
|
|
| Factorio | 192.168.2.50 | LXC | 34197/UDP |
|
|
| Minecraft | 192.168.2.51 | VM | 25565/TCP |
|
|
| 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 |
|