All-in-one Uberspace deployment: - Backend: Node.js Express on port 3000 (/api/*) - Frontend: Static files served by Apache (/) - URL: https://wtp.uber.space Removed: - GitHub Actions workflow - Cloudflare Worker setup service - CloudflareSetupPage component - CloudflareService - 404.html (GitHub Pages redirect) - Cloudflare menu item from Settings Simplified: - Use VITE_BASE_PATH and VITE_API_URL for config - Single deployment target (no multi-env complexity) Co-Authored-By: Claude <noreply@anthropic.com>
154 lines
2.6 KiB
Markdown
154 lines
2.6 KiB
Markdown
# 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 <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`:
|
|
|
|
```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/ <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`:
|
|
|
|
```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 @ <IP von uberspace>
|
|
CNAME www <servername>.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
|