douyinWEB/scripts/_deploy_relay_status_fix.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

42 lines
1.4 KiB
Python

#!/usr/bin/env python3
import sys
import time
from pathlib import Path
import paramiko
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
HOST = "108.174.50.68"
ROOT = Path(__file__).resolve().parents[1]
FILES = [
"backend/app/youtube_relay_status.py",
"frontend/src/lib/ffmpegMetrics.ts",
"frontend/src/lib/ytRelayStatus.ts",
"frontend/src/components/YtRelayProStatusPanel.tsx",
"frontend/src/components/YtRelayLiveLogCard.tsx",
"frontend/src/components/YtAssignPanel.tsx",
]
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
sftp = c.open_sftp()
for rel in FILES:
print("upload", rel)
sftp.put(str(ROOT / rel), f"/opt/douyinWEB/{rel}")
sftp.close()
_, o, e = c.exec_command("systemctl restart douyinweb-api; sleep 4; systemctl is-active douyinweb-api", timeout=30)
print(o.read().decode("utf-8", "replace"))
print(e.read().decode("utf-8", "replace")[:200])
_, o, e = c.exec_command("cd /opt/douyinWEB/frontend && npm run build 2>&1 | tail -12", timeout=600)
print(o.read().decode("utf-8", "replace"))
c.exec_command("systemctl restart douyinweb-web", timeout=5)
time.sleep(3)
_, o, _ = c.exec_command("systemctl is-active douyinweb-web", timeout=15)
print("web:", o.read().decode())
c.close()