#!/bin/bash # StreamCore - Start the backend. # # MediaMTX, the transcoders and the HLS tree are managed by the backend itself: # it starts the media origin at boot, supervises ffmpeg, and restarts either if it # dies. This script only has to bring up the process that owns all of that. set -e BASE="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" export LS_HLS_RUNTIME_DIR="${LS_HLS_RUNTIME_DIR:-$BASE/runtime/hls}" export LS_REPLAY_MEDIA_DIR="${LS_REPLAY_MEDIA_DIR:-$BASE/runtime/replay}" mkdir -p "$LS_HLS_RUNTIME_DIR" "$LS_REPLAY_MEDIA_DIR" "$BASE/runtime/logs" HOST="${LS_HOST:-0.0.0.0}" PORT="${LS_PORT:-8080}" cd "$BASE/backend" PY="$BASE/backend/venv/bin/python" [ -x "$PY" ] || PY="$BASE/backend/.venv/bin/python" [ -x "$PY" ] || PY="python" echo "[StreamCore] Starting backend on ${HOST}:${PORT}..." echo "[StreamCore] MediaMTX, transcoders and HLS are supervised by the backend." exec "$PY" -m uvicorn main:app --host "$HOST" --port "$PORT"