# Uberspace Deployment Einfacheres Setup: Hoste sowohl PWA als auch Backend auf Uberspace. ## Voraussetzungen - Uberspace Account (https://uberspace.de) - SSH Zugriff - Node.js (bereits auf Uberspace vorinstalliert) ## 1. Backend deployen ```bash # SSH auf deinen Uberspace ssh @.uberspace.de # Repository klonen cd ~ git clone https://github.com/felixfoertsch/whattoplay.git cd whattoplay/server # Dependencies installieren npm install # Backend als Service einrichten uberspace web backend set / --http --port 3000 ``` ### Backend als Daemon (automatischer Start) Erstelle `~/etc/services.d/whattoplay-server.ini`: ```ini [program:whattoplay-server] directory=%(ENV_HOME)s/whattoplay/server command=node index.js autostart=yes autorestart=yes startsecs=60 environment=PORT="3000" ``` Starte den Service: ```bash supervisorctl reread supervisorctl update supervisorctl start whattoplay-server supervisorctl status ``` ## 2. PWA deployen ```bash # Auf deinem lokalen Rechner # Build mit Uberspace URL als base npm run build # Upload nach Uberspace rsync -avz dist/ @.uberspace.de:~/html/ # Oder direkt auf Uberspace builden: cd ~/whattoplay npm install npm run build cp -r dist/* ~/html/ ``` ## 3. Vite Config anpassen Für Uberspace Deployment brauchst du keine spezielle `base`: ```typescript // vite.config.ts export default defineConfig({ // base: "/whattoplay/", // <- entfernen für Uberspace plugins: [react()], // ... }); ``` ## 4. App Config anpassen Für Development kannst du die `.env` nutzen: ```bash # .env.development VITE_API_URL=http://localhost:3000 # .env.production VITE_API_URL=https://your-username.uber.space ``` Dann in `ConfigService.ts`: ```typescript static getApiUrl(endpoint: string): string { const baseUrl = import.meta.env.VITE_API_URL || ''; return `${baseUrl}${endpoint}`; } ``` ## 5. Domain einrichten (optional) Falls du eine eigene Domain hast: ```bash uberspace web domain add your-domain.com ``` Dann DNS Records setzen: ``` A @ CNAME www .uberspace.de ``` ## Logs ```bash # Server logs supervisorctl tail whattoplay-server # Webserver logs tail -f ~/logs/webserver/access_log ``` ## Updates deployen ```bash # Backend update cd ~/whattoplay git pull cd server npm install supervisorctl restart whattoplay-server # PWA update cd ~/whattoplay npm install npm run build cp -r dist/* ~/html/ ``` ## Kosten Uberspace: ~5€/Monat (pay what you want, Minimum 1€) - Unbegrenzter Traffic - SSH Zugriff - Node.js, PHP, Python, Ruby Support - MySQL/PostgreSQL Datenbanken - Deutlich einfacher als Cloudflare Workers Setup