mirror of
git://f0xx.org/ac/ac-scripts
synced 2026-07-29 01:38:08 +03:00
refactor(deploy): delegate SFU phase to cluster deploy-janus-sfu.sh
Replace inline Janus/rsync steps with the shared cluster script on cast01–03. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -137,43 +137,15 @@ phase_app() {
|
||||
}
|
||||
|
||||
phase_sfu() {
|
||||
log "cast02: deploying Janus SFU..."
|
||||
# Install Janus if not present
|
||||
rsh cast02 "command -v janus >/dev/null 2>&1 || sudo apk add --no-cache janus-gateway janus-gateway-openrc"
|
||||
# Ensure config files exist (idempotent cp)
|
||||
rsh cast02 "
|
||||
[ -f /etc/janus/janus.jcfg ] || sudo cp /etc/janus/janus.jcfg.sample /etc/janus/janus.jcfg
|
||||
[ -f /etc/janus/janus.transport.http.jcfg ] || sudo cp /etc/janus/janus.transport.http.jcfg.sample /etc/janus/janus.transport.http.jcfg
|
||||
[ -f /etc/janus/janus.transport.websockets.jcfg ] || sudo cp /etc/janus/janus.transport.websockets.jcfg.sample /etc/janus/janus.transport.websockets.jcfg
|
||||
[ -f /etc/janus/janus.plugin.videoroom.jcfg ] || sudo cp /etc/janus/janus.plugin.videoroom.jcfg.sample /etc/janus/janus.plugin.videoroom.jcfg
|
||||
"
|
||||
# Enable and (re)start service
|
||||
rsh cast02 "sudo rc-update add janus-gateway default 2>/dev/null; sudo rc-service janus-gateway restart 2>&1 | tail -3"
|
||||
# Verify Janus is responding
|
||||
rsh cast02 "curl -sf http://localhost:8088/janus/info | python3 -c 'import sys,json; d=json.load(sys.stdin); print(\"Janus\",d[\"version_string\"],\"OK\")'" \
|
||||
&& ok "cast02: Janus SFU is running" \
|
||||
|| warn "cast02: Janus health check failed (may still be starting)"
|
||||
|
||||
# Deploy SFU signaling service to cast01 workspace
|
||||
log "cast01: deploying SFU signaling service..."
|
||||
rsh cast01 "
|
||||
sudo mkdir -p /var/www/ac/workspace/ac-ms-sfu-signaling
|
||||
if [ -d /mnt/repos/ac/ac-ms-sfu-signaling ]; then
|
||||
sudo rsync -a --delete /mnt/repos/ac/ac-ms-sfu-signaling/ /var/www/ac/workspace/ac-ms-sfu-signaling/
|
||||
sudo chown -R nginx:nginx /var/www/ac/workspace/ac-ms-sfu-signaling/ 2>/dev/null || true
|
||||
fi
|
||||
"
|
||||
# Apply SFU schema migrations via load-schemas
|
||||
log "cast01: applying SFU schema migrations..."
|
||||
rsh cast01 "
|
||||
cd /mnt/repos/ac/ac-deploy/sim/cluster0
|
||||
sudo sh scripts/load-schemas.sh 2>&1 | tail -5
|
||||
" || warn "Schema migration failed (may already be applied)"
|
||||
|
||||
# Reload nginx with Janus proxy config
|
||||
log "cast01: reloading nginx..."
|
||||
rsh cast01 "sudo /usr/sbin/nginx -t && sudo rc-service nginx reload 2>&1 | tail -2"
|
||||
ok "cast01: nginx reloaded with Janus proxy"
|
||||
log "Deploying Janus SFU (cluster script)..."
|
||||
rsh cast02 "sudo sh /shared/cluster/scripts/deploy-janus-sfu.sh" \
|
||||
&& ok "cast02: Janus SFU deployed" \
|
||||
|| warn "cast02: deploy-janus-sfu failed"
|
||||
for h in cast01 cast03; do
|
||||
rsh "$h" "sudo sh /shared/cluster/scripts/deploy-janus-sfu.sh" \
|
||||
&& ok "$h: SFU signaling/nginx OK" \
|
||||
|| warn "$h: deploy-janus-sfu failed"
|
||||
done
|
||||
}
|
||||
|
||||
phase_nginx_reload() {
|
||||
|
||||
Reference in New Issue
Block a user