Spaces:
Running
Running
Hermes Agent commited on
Commit ·
e50bcce
1
Parent(s): 001e508
perf(boot): disable Jellyfin/OpenWebUI/TG-streamer by default via env gates
Browse filesOn cpu-basic these services starve the OmniRoute Node process: media
scans and OpenWebUI boot cause chat requests to hang for minutes and
the Space shows repeated 'Service initializing' 502s. Chat traffic only
needs OmniRoute + Redis + gateway proxy.
ENABLE_JELLYFIN=1 / ENABLE_OPENWEBUI=1 / ENABLE_TG_STREAMER=1 re-enable
them via Space secrets without code changes.
- entrypoint.sh +20 -10
entrypoint.sh
CHANGED
|
@@ -415,10 +415,13 @@ echo "[BOOT] Background services starting asynchronously..."
|
|
| 415 |
fi
|
| 416 |
|
| 417 |
# Step 9: Start Telegram Range Stream Proxy in Background (Port 8080)
|
| 418 |
-
|
|
|
|
| 419 |
echo "[HEALTH] Telegram streamer starting in background..."
|
| 420 |
python3 /tg_streamer.py > /data/cache/tg_streamer.log 2>&1 &
|
| 421 |
TG_PID=$!
|
|
|
|
|
|
|
| 422 |
fi
|
| 423 |
|
| 424 |
if [ -f "/health_doctor.py" ]; then
|
|
@@ -427,23 +430,30 @@ if [ -f "/health_doctor.py" ]; then
|
|
| 427 |
fi
|
| 428 |
|
| 429 |
# Step 10: Start Jellyfin Media Server in Background (Port 8096)
|
|
|
|
|
|
|
| 430 |
WEBDIR_OPT=""
|
| 431 |
if [ -d "/usr/share/jellyfin/web" ]; then
|
| 432 |
WEBDIR_OPT="--webdir /usr/share/jellyfin/web"
|
| 433 |
fi
|
| 434 |
|
| 435 |
-
if
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
fi
|
| 444 |
|
| 445 |
# Step 11: Start Open WebUI in Background (Port 8098)
|
| 446 |
-
|
|
|
|
| 447 |
echo "[HEALTH] Open WebUI starting in background on port 8098..."
|
| 448 |
mkdir -p /root/.open-webui /data/open-webui /data/cache 2>/dev/null || true
|
| 449 |
if [ -f "/data/open-webui/webui.db" ] && ! [ -s "/data/open-webui/webui.db" ]; then
|
|
|
|
| 415 |
fi
|
| 416 |
|
| 417 |
# Step 9: Start Telegram Range Stream Proxy in Background (Port 8080)
|
| 418 |
+
# Optional: disabled by default to keep cpu-basic RAM/CPU for the chat path.
|
| 419 |
+
if [ "${ENABLE_TG_STREAMER:-0}" = "1" ] && [ -f "/tg_streamer.py" ]; then
|
| 420 |
echo "[HEALTH] Telegram streamer starting in background..."
|
| 421 |
python3 /tg_streamer.py > /data/cache/tg_streamer.log 2>&1 &
|
| 422 |
TG_PID=$!
|
| 423 |
+
else
|
| 424 |
+
echo "[INIT] Telegram streamer disabled (ENABLE_TG_STREAMER!=1)"
|
| 425 |
fi
|
| 426 |
|
| 427 |
if [ -f "/health_doctor.py" ]; then
|
|
|
|
| 430 |
fi
|
| 431 |
|
| 432 |
# Step 10: Start Jellyfin Media Server in Background (Port 8096)
|
| 433 |
+
# Optional: disabled by default — Jellyfin media scans starve OmniRoute on
|
| 434 |
+
# cpu-basic and cause multi-minute "Service initializing" windows.
|
| 435 |
WEBDIR_OPT=""
|
| 436 |
if [ -d "/usr/share/jellyfin/web" ]; then
|
| 437 |
WEBDIR_OPT="--webdir /usr/share/jellyfin/web"
|
| 438 |
fi
|
| 439 |
|
| 440 |
+
if [ "${ENABLE_JELLYFIN:-0}" = "1" ]; then
|
| 441 |
+
if command -v jellyfin >/dev/null 2>&1; then
|
| 442 |
+
echo "[HEALTH] Jellyfin starting in background..."
|
| 443 |
+
jellyfin --datadir /data/jellyfin/data --configdir /data/jellyfin/config --cachedir /data/jellyfin/cache --logdir /data/jellyfin/log $WEBDIR_OPT > /data/jellyfin/log/jellyfin.log 2>&1 &
|
| 444 |
+
JELLYFIN_PID=$!
|
| 445 |
+
elif [ -f "/usr/bin/jellyfin" ]; then
|
| 446 |
+
echo "[HEALTH] Jellyfin binary starting in background..."
|
| 447 |
+
/usr/bin/jellyfin --datadir /data/jellyfin/data --configdir /data/jellyfin/config --cachedir /data/jellyfin/cache --logdir /data/jellyfin/log $WEBDIR_OPT > /data/jellyfin/log/jellyfin.log 2>&1 &
|
| 448 |
+
JELLYFIN_PID=$!
|
| 449 |
+
fi
|
| 450 |
+
else
|
| 451 |
+
echo "[INIT] Jellyfin disabled (ENABLE_JELLYFIN!=1)"
|
| 452 |
fi
|
| 453 |
|
| 454 |
# Step 11: Start Open WebUI in Background (Port 8098)
|
| 455 |
+
# Optional: disabled by default — OpenWebUI is the heaviest boot component.
|
| 456 |
+
if [ "${ENABLE_OPENWEBUI:-0}" = "1" ] && command -v open-webui >/dev/null 2>&1; then
|
| 457 |
echo "[HEALTH] Open WebUI starting in background on port 8098..."
|
| 458 |
mkdir -p /root/.open-webui /data/open-webui /data/cache 2>/dev/null || true
|
| 459 |
if [ -f "/data/open-webui/webui.db" ] && ! [ -s "/data/open-webui/webui.db" ]; then
|