Initial: Docker-Compose-Stack für Rapport Self-Hosting
Komplettes Bundle für eigene Rapport-Instanz: - Postgres mit Supabase-Extensions + Init-Script für Standard-Rollen - GoTrue (Auth) mit konfigurierbarem SMTP für Passwort-Reset-Mails - PostgREST (REST-API) - Realtime (Postgres-Changes für Live-Sync) - Storage-API (Bilder/Quittungen) - Kong als API-Gateway - Rapport-Frontend als Multi-Stage-Build (zieht Sources aus dem App-Repo) Plus: - scripts/sync-migrations.sh: holt SQL aus dem App-Repo - .env.example mit allen Pflicht-Secrets + optionalen SMTP-Werten - nginx.conf mit SPA-Routing - README mit Setup-Anleitung (Linux + macOS-Colima) - LICENSE (AGPL-3.0) Sync mit App-Repo: scripts/sync-migrations.sh holt die Migrations-SQL via git clone und legt sie nach volumes/db/init/migrations/. Bei jedem Rapport-Update erneut ausführen. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
# rapport-server
|
||||
|
||||
Self-Hosting-Stack für [Rapport](https://git.kgva.ch/karim/RAPPORT) — die Studio-Management-Software für Architekturbüros.
|
||||
|
||||
Dieses Repo enthält alles, um Rapport auf eigenem Server (Linux-VM, NAS, Mac Mini) zu hosten:
|
||||
|
||||
- **Postgres** (Datenbank)
|
||||
- **GoTrue** (Auth — Email-Login, Passwort-Reset, …)
|
||||
- **PostgREST** (REST-API auf der DB)
|
||||
- **Realtime** (Live-Sync zwischen Geräten)
|
||||
- **Storage** (Bilder, Quittungen)
|
||||
- **Kong** (API-Gateway)
|
||||
- **Rapport-Frontend** (nginx mit dem React-Build)
|
||||
|
||||
Alles als Docker-Compose. Komplett Open-Source.
|
||||
|
||||
---
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
| OS | Container-Runtime |
|
||||
|---|---|
|
||||
| **Linux** (Ubuntu 22.04+, Debian 12+, …) | Docker Engine + Compose v2 |
|
||||
| **macOS** (Mac Mini etc.) | [Colima](https://github.com/abiosoft/colima) + Docker CLI — **vollständig Open-Source** |
|
||||
|
||||
> Auf macOS funktioniert auch OrbStack oder Docker Desktop, beide sind aber proprietär. Colima ist die OSS-Alternative und für Selfhost ausreichend.
|
||||
|
||||
Plus: ein erreichbarer DNS-Name (für TLS) — z.B. `rapport.studio.ch`. Optional: Nginx Proxy Manager oder Caddy als Reverse-Proxy für SSL.
|
||||
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Repo klonen + Frontend-Sources holen
|
||||
|
||||
```bash
|
||||
git clone https://git.kgva.ch/karim/rapport-server.git
|
||||
cd rapport-server
|
||||
```
|
||||
|
||||
### 2. `.env` erstellen
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
In `.env` müssen mindestens diese drei Werte ersetzt werden:
|
||||
- `POSTGRES_PASSWORD` — Datenbank-Passwort (mind. 32 Zeichen zufällig)
|
||||
- `JWT_SECRET` — JWT-Signatur-Secret (mind. 32 Zeichen zufällig)
|
||||
- `SITE_URL` — die öffentliche URL deiner Rapport-Instanz (z.B. `https://app.rapport.studio.ch`)
|
||||
|
||||
Zufallswerte generieren:
|
||||
```bash
|
||||
openssl rand -hex 32 # für POSTGRES_PASSWORD und JWT_SECRET
|
||||
```
|
||||
|
||||
### 3. Migrations holen
|
||||
|
||||
Die SQL-Migrations stammen aus dem App-Repo. Einmal initial holen:
|
||||
|
||||
```bash
|
||||
./scripts/sync-migrations.sh
|
||||
```
|
||||
|
||||
(Bei späteren Rapport-Updates `sync-migrations.sh` erneut ausführen, dann `docker compose down && docker compose up -d`.)
|
||||
|
||||
### 4. Stack starten
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Erststart dauert ~1 Minute (Postgres initialisiert sich, Migrations laufen, Container starten).
|
||||
|
||||
### 5. Health-Check
|
||||
|
||||
```bash
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
Alle Container sollten `healthy` zeigen.
|
||||
|
||||
Frontend ist erreichbar auf `http://localhost:8080` — direkt im Browser öffnen oder über deinen Reverse-Proxy auf eine Domain mappen.
|
||||
|
||||
---
|
||||
|
||||
## Reverse-Proxy + HTTPS
|
||||
|
||||
Empfohlen: **Nginx Proxy Manager** (OSS, Web-UI, Let's-Encrypt automatisch) oder **Caddy** (config-as-code, vollautomatisch).
|
||||
|
||||
Beispiel Caddy:
|
||||
|
||||
```caddy
|
||||
app.rapport.studio.ch {
|
||||
reverse_proxy localhost:8080
|
||||
}
|
||||
|
||||
api.rapport.studio.ch {
|
||||
reverse_proxy localhost:8000 # Kong-Gateway
|
||||
}
|
||||
```
|
||||
|
||||
In `.env` dann `SITE_URL=https://app.rapport.studio.ch` und `API_EXTERNAL_URL=https://api.rapport.studio.ch` setzen.
|
||||
|
||||
---
|
||||
|
||||
## Updates
|
||||
|
||||
```bash
|
||||
git pull
|
||||
./scripts/sync-migrations.sh # falls neue Migrations
|
||||
docker compose pull # neueste Container-Versionen
|
||||
docker compose up -d # neu starten
|
||||
```
|
||||
|
||||
Daten bleiben erhalten (Volume `postgres-data` wird nicht angetastet).
|
||||
|
||||
---
|
||||
|
||||
## Backup
|
||||
|
||||
Komplettes Postgres-Dump:
|
||||
|
||||
```bash
|
||||
docker compose exec -T db pg_dumpall -U postgres > backup-$(date +%Y%m%d).sql
|
||||
```
|
||||
|
||||
Empfohlen: per `cron` täglich + auf externe Disk/S3/Backblaze sichern.
|
||||
|
||||
Storage (Quittungen, Logos):
|
||||
|
||||
```bash
|
||||
docker compose exec storage tar -czf - /var/lib/storage > storage-$(date +%Y%m%d).tar.gz
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Lizenz
|
||||
|
||||
GNU AGPL-3.0-or-later — identisch zur Rapport-App.
|
||||
Reference in New Issue
Block a user