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

44 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
import sys
import time
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
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=300):
_, o, e = c.exec_command(cmd, timeout=timeout)
out = (o.read() + e.read()).decode("utf-8", "replace")
print(out[-4000:] if len(out) > 4000 else out)
return out
print("=== api before ===")
run("systemctl is-active douyinweb-api; journalctl -u douyinweb-api -n 30 --no-pager")
print("=== restart api ===")
run("systemctl restart douyinweb-api")
time.sleep(10)
run("systemctl is-active douyinweb-api")
print("=== HEAD ===")
run("cd /opt/douyinWEB && git log -1 --oneline")
print("=== npm build ===")
run("cd /opt/douyinWEB/frontend && npm run build 2>&1 | tail -25", timeout=360)
print("=== restart web ===")
run("systemctl restart douyinweb-web")
time.sleep(5)
run("systemctl is-active douyinweb-api; systemctl is-active douyinweb-web")
print("=== smoke ===")
run(
"curl -s -o /dev/null -w 'profiles:%{http_code}\\n' "
"http://127.0.0.1:8014/api/youtube/manage/profiles; "
"curl -s -o /dev/null -w 'shorts:%{http_code}\\n' http://127.0.0.1:4015/shorts; "
"curl -s -o /dev/null -w 'ytlong:%{http_code}\\n' http://127.0.0.1:4015/yt-long"
)
c.close()
print("DONE")