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

28 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
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: str, timeout: int = 360) -> str:
_, out, err = c.exec_command(cmd, timeout=timeout)
return (out.read() + err.read()).decode("utf-8", "replace").strip()
print(run("cd /opt/douyinWEB && git pull --ff-only origin test1 && git log -1 --format=%h"))
print(run("cd /opt/douyinWEB/frontend && npm run build > /tmp/fe_fix_hist.log 2>&1; echo EXIT:$?; tail -n 6 /tmp/fe_fix_hist.log | tr -cd '\\11\\12\\15\\40-\\176'", timeout=360))
c.exec_command("systemctl restart douyinweb-web >/dev/null 2>&1", timeout=5)
time.sleep(5)
print("web", run("systemctl is-active douyinweb-web"))
print("db", run("stat -c '%n %s' /opt/douyinWEB/backend/data/monitor.db"))
c.close()