streamd: serve start/stop/update, streamd.yaml, egress, module panel fixes
- Add streamd serve start|stop|restart|status|update with auto-written streamd.yaml - Panel modules: STREAMD_MODULES_DIR for describe, YAML channel fallback, textarea value fix - Per-stream WireGuard/SOCKS egress profiles + Settings UI - Drop drm-* from release builds; track streamd-bg.sh / streamd-update.sh wrappers - Docs: streamd-server-setup lifecycle and update flow
This commit is contained in:
parent
da8e1123ec
commit
8fc7e4c0b8
57 changed files with 4031 additions and 257 deletions
69
scripts/streamd-bg.sh
Normal file
69
scripts/streamd-bg.sh
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env bash
|
||||
# Thin wrapper around `streamd serve` lifecycle commands.
|
||||
# Prefer calling the binary directly:
|
||||
# ./streamd serve start|stop|restart|status
|
||||
#
|
||||
# Kept so older docs/curl installs that fetch streamd-bg.sh still work.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
BIN="${STREAMD_BIN:-$ROOT/streamd}"
|
||||
[[ -x "$BIN" ]] || { echo "streamd-bg: missing executable $BIN" >&2; exit 1; }
|
||||
|
||||
cmd="${1:-}"
|
||||
shift || true
|
||||
|
||||
case "$cmd" in
|
||||
start|stop|restart|status)
|
||||
exec "$BIN" serve "$cmd" "$@"
|
||||
;;
|
||||
log)
|
||||
# Resolve log file from streamd.yaml when possible; else streamd.log
|
||||
log="$ROOT/streamd.log"
|
||||
if [[ -f "$ROOT/streamd.yaml" ]]; then
|
||||
# shellcheck disable=SC2016
|
||||
ylog="$(grep -E '^log_file:' "$ROOT/streamd.yaml" | head -1 | sed 's/^log_file:[[:space:]]*//;s/[[:space:]]*$//;s/^["'\'']//;s/["'\'']$//')" || true
|
||||
if [[ -n "${ylog:-}" ]]; then
|
||||
if [[ "$ylog" = /* ]]; then log="$ylog"; else log="$ROOT/$ylog"; fi
|
||||
fi
|
||||
fi
|
||||
exec tail -n 100 -f "$log"
|
||||
;;
|
||||
start-agent)
|
||||
cfg="${AGENT_CONFIG:-$ROOT/agent.yaml}"
|
||||
[[ -f "$cfg" ]] || { echo "streamd-bg: missing $cfg" >&2; exit 1; }
|
||||
nohup "$BIN" agent run --config "$cfg" >"$ROOT/agent.log" 2>&1 &
|
||||
echo $! >"$ROOT/agent.pid"
|
||||
echo "agent started pid=$(cat "$ROOT/agent.pid")"
|
||||
;;
|
||||
stop-agent)
|
||||
if [[ -f "$ROOT/agent.pid" ]]; then
|
||||
kill "$(cat "$ROOT/agent.pid")" 2>/dev/null || true
|
||||
rm -f "$ROOT/agent.pid"
|
||||
echo "agent stopped"
|
||||
else
|
||||
echo "agent is not running"
|
||||
fi
|
||||
;;
|
||||
log-agent)
|
||||
exec tail -n 100 -f "$ROOT/agent.log"
|
||||
;;
|
||||
-h|--help|help|"")
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") <command>
|
||||
|
||||
Preferred (same machine): ./streamd serve start|stop|restart|status|update
|
||||
|
||||
This wrapper still accepts:
|
||||
start | stop | restart | status | log
|
||||
start-agent | stop-agent | log-agent
|
||||
EOF
|
||||
[[ -n "$cmd" ]] || exit 2
|
||||
;;
|
||||
*)
|
||||
echo "streamd-bg: unknown command: $cmd (try --help)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue