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
This commit is contained in:
admin committed 2026-08-10 14:54:03 +08:00
1 parent 980b91f41f
commit 409e5d314e
14 files changed
+800 -11

No files matched your search

+20 -11
View File
@@ -1,35 +1,44 @@
#!/bin/bash
# StreamCore - Start all services
set -e
BASE="/workspace/livestream-platform"
echo "[livestream] Starting services..."
echo "[StreamCore] Starting services..."
# MediaMTX origin
cd "$BASE/mediamtx"
if pgrep -f "mediamtx mediamtx.yml" > /dev/null; then
echo "[livestream] MediaMTX already running."
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 "[livestream] MediaMTX started."
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 "[livestream] Backend already running."
echo "[StreamCore] Backend already running."
else
nohup ./venv/bin/python run.py > /tmp/backend.log 2>&1 &
(exec ./venv/bin/python run.py &) </dev/null &>/tmp/backend.log &
disown
sleep 3
echo "[livestream] Backend started on :8080."
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 "[livestream] Frontend already running."
echo "[StreamCore] Frontend already running."
else
nohup npm run dev > /tmp/frontend.log 2>&1 &
(exec npm run dev &) </dev/null &>/tmp/frontend.log &
disown
sleep 3
echo "[livestream] Frontend started on :5173."
echo "[StreamCore] Frontend started on :5173."
fi
echo "[livestream] All services up."
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}"