mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-10 07:02: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>
15 lines
604 B
Plaintext
15 lines
604 B
Plaintext
#!/usr/bin/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
set -euo pipefail
|
|
|
|
# Wait for the upstream API service (gunicorn / wsgi:application) to bind 127.0.0.1:5002
|
|
# before starting nginx, so nginx never serves a 502 for the API/auth/socket
|
|
# paths during boot. A boot-time 502 can be cached by an upstream cache layer
|
|
# (HA's own PWA service worker, a Cloudflare edge worker, etc.), leaving the
|
|
# UI in a stuck blank state until the cache is purged.
|
|
bashio::log.info "Waiting for upstream API on 127.0.0.1:5002..."
|
|
bashio::net.wait_for 5002 127.0.0.1 900
|
|
|
|
bashio::log.info "Starting NGinx..."
|
|
exec nginx
|