README: Abschnitt zum Dauerbetrieb mit supervisord (24/7)
Beispiel-Config + reread/update/restart/status/Logs, mit Hinweis auf directory= (.env/counting_line) und Restart-Bedarf nach Code-Updates. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
43
README.md
43
README.md
@@ -60,6 +60,49 @@ python3 app.py
|
|||||||
|
|
||||||
Die Anwendung ist dann unter `http://localhost:8080` erreichbar.
|
Die Anwendung ist dann unter `http://localhost:8080` erreichbar.
|
||||||
|
|
||||||
|
### Dauerbetrieb mit supervisord (24/7)
|
||||||
|
|
||||||
|
Für den Dauerbetrieb (automatischer Start, Neustart bei Absturz) eignet sich
|
||||||
|
[supervisord](http://supervisord.org/). Beispiel-Konfiguration unter
|
||||||
|
`/etc/supervisor/conf.d/vehicle-counter.conf`:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[program:vehicle-counter]
|
||||||
|
directory=/pfad/zum/vehicle-counter
|
||||||
|
command=/pfad/zur/python app.py
|
||||||
|
user=DEIN_USER
|
||||||
|
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
startsecs=5
|
||||||
|
stopwaitsecs=10
|
||||||
|
|
||||||
|
stdout_logfile=/var/log/vehicle-counter.log
|
||||||
|
stderr_logfile=/var/log/vehicle-counter-error.log
|
||||||
|
stdout_logfile_maxbytes=20MB
|
||||||
|
stderr_logfile_backups=5
|
||||||
|
|
||||||
|
environment=PYTHONUNBUFFERED="1"
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **`directory=` muss auf das Projektverzeichnis zeigen!** Sonst findet die App
|
||||||
|
> die `.env` (Kamera/MQTT) und `counting_line.json` nicht und fällt auf Defaults
|
||||||
|
> zurück.
|
||||||
|
|
||||||
|
Aktivieren und steuern:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo supervisorctl reread # neue Config einlesen
|
||||||
|
sudo supervisorctl update # Programm hinzufügen/starten
|
||||||
|
sudo supervisorctl restart vehicle-counter # nach Code-Updates neu starten
|
||||||
|
sudo supervisorctl status vehicle-counter # Status prüfen
|
||||||
|
tail -f /var/log/vehicle-counter.log # Logs ansehen
|
||||||
|
```
|
||||||
|
|
||||||
|
Nach einem `git pull` mit Code-Änderungen ist ein `restart` nötig; reine
|
||||||
|
Template-/Frontend-Änderungen werden dank `TEMPLATES_AUTO_RELOAD` auch ohne
|
||||||
|
Neustart übernommen.
|
||||||
|
|
||||||
### Konfiguration (.env)
|
### Konfiguration (.env)
|
||||||
|
|
||||||
Kamera-, MQTT- und Inferenz-Einstellungen werden über Umgebungsvariablen
|
Kamera-, MQTT- und Inferenz-Einstellungen werden über Umgebungsvariablen
|
||||||
|
|||||||
Reference in New Issue
Block a user