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>
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
import sys
|
|
from pathlib import Path
|
|
import paramiko
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
APP = "/opt/douyinWEB"
|
|
FILES = [
|
|
"backend/app/douyin_live.py",
|
|
"backend/app/db.py",
|
|
"backend/app/youtube_relay_pipeline.py",
|
|
]
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=60, allow_agent=False, look_for_keys=False)
|
|
sftp = c.open_sftp()
|
|
for rel in FILES:
|
|
print("upload", rel)
|
|
sftp.put(str(ROOT / rel), f"{APP}/{rel}")
|
|
sftp.close()
|
|
_, o, _ = c.exec_command(
|
|
"systemctl restart douyinweb-api && sleep 2 && systemctl is-active douyinweb-api && "
|
|
"curl -sS 'http://127.0.0.1:8014/api/douyin/live-map?force=1' | python3 -c \"import sys,json;d=json.load(sys.stdin);print('live_count',d.get('live_count'));[(print(k,v.get('is_live'),v.get('enabled'))) for k,v in (d.get('entries') or {}).items() if v.get('is_live')]\"",
|
|
timeout=120,
|
|
)
|
|
print(o.read().decode())
|
|
c.close()
|