取消本地上传拦截,按 A/B/C/D Client 独立展示配额;新增 SOCKS5 上传代理与删频道级联清理;同步文档与部署脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""Standard deploy: server git pull dev + restart API + rebuild frontend + restart web."""
|
|
import paramiko, time
|
|
|
|
HOST = "107.173.30.245"
|
|
USER = "root"
|
|
PASSWORD = "Xiao4669805"
|
|
REPO = "/opt/douyinWEB"
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, 22, USER, PASSWORD, timeout=30, allow_agent=False, look_for_keys=False)
|
|
|
|
def run(cmd, timeout=300):
|
|
_s, out, err = c.exec_command(cmd, timeout=timeout)
|
|
o = out.read().decode("utf-8", "replace").strip()
|
|
e = err.read().decode("utf-8", "replace").strip()
|
|
return o, e
|
|
|
|
print("[git pull]")
|
|
o, e = run(f"cd {REPO} && git pull origin dev 2>&1", timeout=60)
|
|
print(o or e)
|
|
|
|
print("[git log]")
|
|
o, _ = run(f"cd {REPO} && git log --oneline -2")
|
|
print(o)
|
|
|
|
print("[restart api]")
|
|
c.exec_command("systemctl restart douyinweb-api >/dev/null 2>&1", timeout=5)
|
|
time.sleep(8)
|
|
o, _ = run("systemctl is-active douyinweb-api")
|
|
print("api:", o)
|
|
|
|
print("[npm build]")
|
|
o, _ = run(f"cd {REPO}/frontend && npm run build 2>&1 | tail -6", timeout=360)
|
|
print(o.encode("ascii", "replace").decode())
|
|
|
|
print("[restart web]")
|
|
c.exec_command("systemctl restart douyinweb-web >/dev/null 2>&1", timeout=5)
|
|
time.sleep(5)
|
|
o, _ = run("systemctl is-active douyinweb-web")
|
|
print("web:", o)
|
|
|
|
c.close()
|
|
print("DONE")
|