Files
live/start.sh
T
admin 409e5d314e Go边缘代理: 单文件可执行+嵌入式MediaMTX+监控+注册
- edge-agent/: Go项目, 支持Windows托盘/Linux无头两种模式
- 使用go:embed将MediaMTX二进制嵌入单一可执行文件
- 首次运行自动释放MediaMTX并生成边缘节点配置
- 自动注册到origin (POST /api/nodes/register)
- 10秒心跳上报CPU/RAM/带宽/连接数 (gopsutil采集)
- Windows: getlantern/systray托盘菜单(状态/CPU/MEM/带宽/退出)
- Linux: headless模式,适合systemd守护
- build.sh/build.ps1: 交叉编译脚本(Linux/Windows)
- 更新start.sh/品牌名StreamCore
2026-08-10 14:54:03 +08:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# StreamCore - Start all services
set -e
BASE="/workspace/livestream-platform"
echo "[StreamCore] Starting services..."
# MediaMTX origin
cd "$BASE/mediamtx"
if pgrep -f "mediamtx mediamtx.yml" > /dev/null 2>/dev/null; then
echo "[StreamCore] MediaMTX already running."
else
nohup ./mediamtx mediamtx.yml > /tmp/mediamtx.log 2>&1 &
sleep 2
echo "[StreamCore] MediaMTX started (RTMP :1935, HLS :8888, API :9997)."
fi
# Backend API
cd "$BASE/backend"
if curl -sf http://127.0.0.1:8080/api/health > /dev/null 2>&1; then
echo "[StreamCore] Backend already running."
else
(exec ./venv/bin/python run.py &) </dev/null &>/tmp/backend.log &
disown
sleep 3
echo "[StreamCore] Backend started on :8080."
fi
# Frontend
cd "$BASE/frontend"
if curl -sf http://127.0.0.1:5173 > /dev/null 2>&1; then
echo "[StreamCore] Frontend already running."
else
(exec npm run dev &) </dev/null &>/tmp/frontend.log &
disown
sleep 3
echo "[StreamCore] Frontend started on :5173."
fi
echo "[StreamCore] All services up."
echo " Public: http://nbd.rainplay.cn:13001/"
echo " Admin: http://nbd.rainplay.cn:13001/admin/login"
echo " RTMP: rtmp://nbd.rainplay.cn:13001/live/{key}"