1
0
mirror of git://f0xx.org/ac/ac-scripts synced 2026-07-29 02:59:20 +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:
Anton Afanasyeu
2026-07-10 22:12:02 +02:00
parent 0026d96585
commit 8927c65f63

View File

@@ -137,43 +137,15 @@ phase_app() {
} }
phase_sfu() { phase_sfu() {
log "cast02: deploying Janus SFU..." log "Deploying Janus SFU (cluster script)..."
# Install Janus if not present rsh cast02 "sudo sh /shared/cluster/scripts/deploy-janus-sfu.sh" \
rsh cast02 "command -v janus >/dev/null 2>&1 || sudo apk add --no-cache janus-gateway janus-gateway-openrc" && ok "cast02: Janus SFU deployed" \
# Ensure config files exist (idempotent cp) || warn "cast02: deploy-janus-sfu failed"
rsh cast02 " for h in cast01 cast03; do
[ -f /etc/janus/janus.jcfg ] || sudo cp /etc/janus/janus.jcfg.sample /etc/janus/janus.jcfg rsh "$h" "sudo sh /shared/cluster/scripts/deploy-janus-sfu.sh" \
[ -f /etc/janus/janus.transport.http.jcfg ] || sudo cp /etc/janus/janus.transport.http.jcfg.sample /etc/janus/janus.transport.http.jcfg && ok "$h: SFU signaling/nginx OK" \
[ -f /etc/janus/janus.transport.websockets.jcfg ] || sudo cp /etc/janus/janus.transport.websockets.jcfg.sample /etc/janus/janus.transport.websockets.jcfg || warn "$h: deploy-janus-sfu failed"
[ -f /etc/janus/janus.plugin.videoroom.jcfg ] || sudo cp /etc/janus/janus.plugin.videoroom.jcfg.sample /etc/janus/janus.plugin.videoroom.jcfg done
"
# 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"
} }
phase_nginx_reload() { phase_nginx_reload() {