Files
pbt/README.md
T
2026-09-09 17:34:10 +02:00

52 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PBT Öffi-Erfahrungen (pbt.zisco.at)
## Lokal auf der LXC einrichten
```bash
cd /opt/pbt # oder wohin du die Dateien kopierst
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
export PBT_DATABASE_URL="postgresql://pbt_app:DEIN_PASSWORT@<postgres-ip-oder-hostname>/pbt"
export PBT_SECRET_KEY="ein-langer-zufaelliger-string"
python app.py # Testlauf auf Port 5000
```
Beim ersten Start legt die App die Tabellen (`users`, `fahrten`) automatisch per
`db.create_all()` an dafür braucht der User `pbt_app` `CREATE`-Rechte in der DB
(sollte durch `GRANT ALL PRIVILEGES ON DATABASE pbt TO pbt_app;` bereits gegeben sein).
## Produktivbetrieb mit systemd + Gunicorn
1. Projekt nach `/opt/pbt` kopieren, virtuelle Umgebung dort anlegen (s. oben).
2. `pbt.service` nach `/etc/systemd/system/pbt.service` kopieren, DB-URL und
Secret-Key darin anpassen.
3. Aktivieren:
```bash
systemctl daemon-reload
systemctl enable --now pbt
systemctl status pbt
```
Die App lauscht dann intern auf `127.0.0.1:8000`.
## Caddy-Eintrag
In der Caddy-LXC in der Caddyfile ergänzen:
```
pbt.zisco.at {
reverse_proxy 10.10.10.24:8000
}
```
(IP durch die tatsächliche Adresse der `pbt`-LXC ersetzen.) Danach:
```bash
systemctl reload caddy
```
Caddy holt sich das TLS-Zertifikat für `pbt.zisco.at` automatisch über Let's Encrypt,
sofern die Domain öffentlich auf die Caddy-LXC zeigt.