mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-07 21:52:29 +02:00
Replace the legacy Werkzeug dev server (python -m core.api) with a single gunicorn GeventWebSocketWorker, matching upstream BirdNET-PiPy 0.7.0's production-server migration (the add-on already builds 0.7.0 source). Single worker is mandatory: live detections fan out via an in-process Socket.IO emit (no Redis message_queue), so >1 worker would silently drop Live Feed broadcasts. Heavy maintenance jobs cooperatively yield to keep the worker responsive. Bound to 127.0.0.1:5002 for single-container use. Also fixes the now-stale 'Python core.api' comment in nginx/run. Add-on packaging change only -> 0.7.0 -> 0.7.0-1 (suffix convention; base tracks upstream via the updater bot). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 lines
759 B
Plaintext
20 lines
759 B
Plaintext
#!/usr/bin/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
set -euo pipefail
|
|
export PYTHONPATH=/app
|
|
bashio::net.wait_for 5001 127.0.0.1 300
|
|
cd /app
|
|
# Single gevent-websocket worker is mandatory: live detections fan out via an
|
|
# in-process socketio.emit (no Redis message_queue), so >1 worker would
|
|
# silently drop Live Feed broadcasts. Bind 127.0.0.1 (single container; nginx
|
|
# and core.main reach the API locally, satisfying the wait_for in nginx/run +
|
|
# main/run). Heavy admin jobs cooperatively yield to keep this worker live.
|
|
exec gunicorn wsgi:application \
|
|
--worker-class geventwebsocket.gunicorn.workers.GeventWebSocketWorker \
|
|
--workers 1 \
|
|
--bind 127.0.0.1:5002 \
|
|
--timeout 120 \
|
|
--graceful-timeout 30 \
|
|
--keep-alive 65 \
|
|
--error-logfile -
|