#!/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()