This commit is contained in:
Yvan
2026-09-23 09:03:17 +08:00
parent 80c8c6308a
commit 672c7f8f6c
5 changed files with 109 additions and 9 deletions
+15
View File
@@ -25,6 +25,9 @@ UPLOADS_DIR="$BASE_DIR/uploads" # 上传文件目录 -> 容器内 /app/uploads
FRONTEND_PORT=9501 # admin 管理后台 nginx 容器
BACKEND_PORT=9502 # 后端 API/WebSocket 容器
LIVEWEB_PORT=9503 # live 用户端(PC 直播页) nginx 容器
LIVE_UDP_PORT="${KRA_LIVE_UDP_PORT:-9504}" # WebRTC 音视频固定 UDP 端口(与 9501-9503 顺延配套)
LIVE_PUBLIC_IP="${KRA_LIVE_PUBLIC_IP:-}" # 留空时从站点域名解析
LIVE_HOST="${KRA_LIVE_HOST:-live.fuhua91.com}"
NETWORK="live-net"
BACKEND_NAME="live-backend"
FRONTEND_NAME="live-frontend"
@@ -49,6 +52,15 @@ if [ ! -f "$CONFIG_DIR/config.yaml" ]; then
exit 1
fi
if [ -z "$LIVE_PUBLIC_IP" ]; then
LIVE_PUBLIC_IP="$(getent ahostsv4 "$LIVE_HOST" | awk 'NR == 1 { print $1 }')"
fi
if ! printf '%s' "$LIVE_PUBLIC_IP" | grep -Eq '^[0-9]+(\.[0-9]+){3}$'; then
echo "错误: 无法确定直播服务公网 IPv4,请通过 KRA_LIVE_PUBLIC_IP 显式设置"
exit 1
fi
echo "==> WebRTC 媒体地址: $LIVE_PUBLIC_IP:$LIVE_UDP_PORT/udp"
# 3. 登录 Harbor;未传密码时复用服务器现有的 Docker 登录态
HARBOR_USER="${HARBOR_USER:-$HARBOR_USER_DEFAULT}"
HARBOR_LOGGED_IN=false
@@ -80,6 +92,9 @@ docker run -d --name "$BACKEND_NAME" \
--restart always \
--network "$NETWORK" \
-p "$BACKEND_PORT:8000" \
-p "$LIVE_UDP_PORT:$LIVE_UDP_PORT/udp" \
-e KRA_LIVE_PUBLIC_IP="$LIVE_PUBLIC_IP" \
-e KRA_LIVE_UDP_PORT="$LIVE_UDP_PORT" \
-v "$CONFIG_DIR:/data/conf" \
-v "$LOG_DIR:/app/logs" \
-v "$UPLOADS_DIR:/app/uploads" \