douyinWEB/scripts/_deploy_yt_long_ui.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

22 lines
914 B
Python

# -*- coding: utf-8 -*-
import sys, time, paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REPO = "/opt/douyinWEB"
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
def run(cmd, timeout=600):
_, o, e = c.exec_command(cmd, timeout=timeout)
out = (o.read() + e.read()).decode("utf-8", "replace").strip()
print(out[-4000:] if len(out) > 4000 else out, flush=True)
return out
print("[pull]", run(f"cd {REPO} && git stash push -u -m auto-yt-long-ui || true; git pull --ff-only origin test1 && git log --oneline -1"))
print("[build]", run(f"cd {REPO}/frontend && npm run build 2>&1 | tail -n 20", timeout=600))
run("systemctl restart douyinweb-web")
time.sleep(2)
print("[svc]", run("systemctl is-active douyinweb-web"))
c.close()
print("DONE")