Files
whattoplay/UBERSPACE.md
Felix Förtsch 0fe09f01f8 add simple Uberspace deployment option (simpler than Cloudflare)
Instead of the complex Cloudflare Worker setup with CORS proxy,
you can now deploy both PWA and backend on Uberspace (~5€/month).

Changes:
- Add Express.js backend server (server/index.js)
- Update ConfigService to support VITE_API_URL env variable
- Make base path configurable via VITE_BASE_PATH
- Add comprehensive Uberspace deployment guide
- Add .env.production.example for configuration

Deployment options:
1. Uberspace (recommended): Simple, all-in-one hosting
2. GitHub Pages + Cloudflare Workers: Free but complex setup

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-06 20:50:56 +01:00

2.6 KiB

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

# SSH auf deinen Uberspace
ssh <username>@<servername>.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:

[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:

supervisorctl reread
supervisorctl update
supervisorctl start whattoplay-server
supervisorctl status

2. PWA deployen

# Auf deinem lokalen Rechner
# Build mit Uberspace URL als base
npm run build

# Upload nach Uberspace
rsync -avz dist/ <username>@<servername>.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:

// 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:

# .env.development
VITE_API_URL=http://localhost:3000

# .env.production
VITE_API_URL=https://your-username.uber.space

Dann in ConfigService.ts:

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:

uberspace web domain add your-domain.com

Dann DNS Records setzen:

A     @    <IP von uberspace>
CNAME www  <servername>.uberspace.de

Logs

# Server logs
supervisorctl tail whattoplay-server

# Webserver logs
tail -f ~/logs/webserver/access_log

Updates deployen

# 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