Initial commit mit MkDocs-Dokumentation

This commit is contained in:
2026-03-04 14:18:33 +00:00
parent 6115090da1
commit 31d3e36597
97 changed files with 27518 additions and 1 deletions

View File

@@ -0,0 +1,137 @@
# Entwicklungsumgebung
---
## Voraussetzungen
- Node.js >= 20.19.0
- Alle [externen Tools](../getting-started/prerequisites.md) installiert
---
## Schnellstart
```bash
./start.sh
```
Das Skript startet automatisch:
- **Backend** auf Port 3001 (mit Nodemon für Hot-Reload)
- **Frontend** auf Port 5173 (mit Vite HMR)
---
## Manuelle Entwicklungsumgebung
### Terminal 1 Backend
```bash
cd backend
npm install
npm run dev
```
Backend läuft auf `http://localhost:3001` mit **Nodemon** Neustart bei Dateiänderungen.
### Terminal 2 Frontend
```bash
cd frontend
npm install
npm run dev
```
Frontend läuft auf `http://localhost:5173` mit **Vite HMR** sofortige Browser-Updates.
---
## Vite-Proxy
Im Entwicklungsmodus proxied Vite alle API- und WebSocket-Anfragen zum Backend:
```js
// frontend/vite.config.js
server: {
proxy: {
'/api': {
target: 'http://localhost:3001',
changeOrigin: true
},
'/ws': {
target: 'ws://localhost:3001',
ws: true
}
}
}
```
Das bedeutet: Im Browser macht das Frontend Anfragen an `localhost:5173/api/...` Vite leitet diese an `localhost:3001/api/...` weiter.
---
## Remote-Entwicklung
Falls Ripster auf einem entfernten Server entwickelt wird (z.B. Homeserver), muss die Vite-Konfiguration angepasst werden:
```env
# frontend/.env.local
VITE_API_BASE=http://192.168.1.100:3001
VITE_WS_URL=ws://192.168.1.100:3001
VITE_HMR_HOST=192.168.1.100
VITE_HMR_PORT=5173
```
---
## Log-Level für Entwicklung
```env
# backend/.env
LOG_LEVEL=debug
```
Im Debug-Modus werden alle Ausgaben der externen Tools (MakeMKV, HandBrake) vollständig geloggt.
---
## Stoppen
```bash
./kill.sh
```
---
## Linting & Type-Checking
```bash
# Frontend (ESLint)
cd frontend && npm run lint
# Backend hat keine separaten Lint-Scripts,
# nutze direkt eslint falls konfiguriert
```
---
## Deployment-Script
Das `deploy-ripster.sh`-Script überträgt Code auf einen Remote-Server per SSH:
```bash
./deploy-ripster.sh
```
**Was das Script tut:**
1. `rsync` synchronisiert den Code (Backend-Quellcode ohne `data/`)
2. Die Datenbank (`backend/data/`) wird **nicht** überschrieben
3. Verbindung via SSH (konfigurierbar im Script)
**Anpassung des Scripts:**
```bash
# deploy-ripster.sh
REMOTE_HOST="192.168.1.100"
REMOTE_USER="michael"
REMOTE_PATH="/home/michael/ripster"
```

21
docs/deployment/index.md Normal file
View File

@@ -0,0 +1,21 @@
# Deployment
<div class="grid cards" markdown>
- :material-laptop: **Entwicklungsumgebung**
---
Lokale Entwicklungsumgebung einrichten.
[:octicons-arrow-right-24: Entwicklung](development.md)
- :material-server: **Produktion**
---
Ripster auf einem Server dauerhaft betreiben.
[:octicons-arrow-right-24: Produktion](production.md)
</div>

View File

@@ -0,0 +1,193 @@
# Produktions-Deployment
---
## Empfohlene Architektur
```
Internet / Heimnetz
nginx (Reverse Proxy)
┌────┴────┐
│ │
Backend Frontend
:3001 (statische Dateien)
```
---
## systemd-Service
Für ein dauerhaftes Betreiben als systemd-Service:
```bash
sudo nano /etc/systemd/system/ripster.service
```
```ini
[Unit]
Description=Ripster - Disc Ripping Service
After=network.target
[Service]
Type=simple
User=michael
WorkingDirectory=/home/michael/ripster
ExecStart=/bin/bash /home/michael/ripster/start.sh
ExecStop=/bin/bash /home/michael/ripster/kill.sh
Restart=on-failure
RestartSec=10s
# Umgebungsvariablen
Environment=NODE_ENV=production
Environment=PORT=3001
Environment=LOG_LEVEL=info
[Install]
WantedBy=multi-user.target
```
```bash
# Service aktivieren und starten
sudo systemctl daemon-reload
sudo systemctl enable ripster
sudo systemctl start ripster
# Status prüfen
sudo systemctl status ripster
# Logs anzeigen
journalctl -u ripster -f
```
---
## Frontend-Build
Für Produktion das Frontend bauen:
```bash
cd frontend
npm run build
```
Die statischen Dateien landen in `frontend/dist/`.
---
## nginx-Konfiguration
```nginx
# /etc/nginx/sites-available/ripster
server {
listen 80;
server_name ripster.local;
# Statisches Frontend
root /home/michael/ripster/frontend/dist;
index index.html;
# SPA Fallback (React Router)
location / {
try_files $uri $uri/ /index.html;
}
# API-Proxy zum Backend
location /api/ {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# WebSocket-Proxy
location /ws {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
```
```bash
sudo ln -s /etc/nginx/sites-available/ripster /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
```
---
## Nur-Backend-Produktion (ohne nginx)
Falls kein Reverse Proxy gewünscht ist, kann das Backend die Frontend-Dateien direkt ausliefern:
```bash
# Frontend bauen
cd frontend && npm run build
# Backend startet und serviert frontend/dist/
cd backend && NODE_ENV=production npm start
```
Das Backend ist so konfiguriert, dass es im Produktionsmodus die `frontend/dist/`-Dateien als statische Assets ausliefert.
---
## Datenbank-Backup
```bash
# Datenbank sichern
cp backend/data/ripster.db backend/data/ripster.db.backup.$(date +%Y%m%d)
# Oder mit SQLite-eigenem Backup-Befehl
sqlite3 backend/data/ripster.db ".backup '/mnt/backup/ripster.db'"
```
!!! tip "Automatisches Backup"
Cron-Job für tägliches Backup:
```cron
0 3 * * * sqlite3 /home/michael/ripster/backend/data/ripster.db ".backup '/mnt/backup/ripster-$(date +\%Y\%m\%d).db'"
```
---
## Log-Rotation
Ripster rotiert Logs automatisch täglich. Falls zusätzlich systemd-Journal-Rotation gewünscht ist:
```bash
# /etc/logrotate.d/ripster
/home/michael/ripster/backend/logs/*.log {
daily
rotate 14
compress
missingok
notifempty
}
```
---
## Sicherheitshinweise
!!! warning "Heimnetz-Einsatz"
Ripster ist für den Einsatz im **lokalen Heimnetz** konzipiert und enthält **keine Authentifizierung**. Stelle sicher, dass der Dienst nicht öffentlich erreichbar ist.
Falls öffentlicher Zugang benötigt wird:
1. **Basic Auth** via nginx:
```bash
sudo htpasswd -c /etc/nginx/.htpasswd michael
```
```nginx
location / {
auth_basic "Ripster";
auth_basic_user_file /etc/nginx/.htpasswd;
# ...
}
```
2. **VPN-Zugang** (empfohlen): Zugriff nur über WireGuard/OpenVPN
3. **SSL/TLS**: Let's Encrypt mit certbot für HTTPS