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>
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
import paramiko
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
if hasattr(sys.stdout, "reconfigure"):
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
|
|
sftp = c.open_sftp()
|
|
pairs = [
|
|
(ROOT / "backend/app/cover.py", "/opt/douyinWEB/backend/app/cover.py"),
|
|
(ROOT / "scripts/_backfill_avatars.py", "/tmp/_backfill_avatars.py"),
|
|
(ROOT / "scripts/_diag_s3_settings.py", "/tmp/_diag_s3_settings.py"),
|
|
(ROOT / "scripts/_run_avatar_backfill.sh", "/tmp/_run_avatar_backfill.sh"),
|
|
]
|
|
for local, remote in pairs:
|
|
data = local.read_bytes().replace(b"\r\n", b"\n").replace(b"\r", b"\n")
|
|
with sftp.file(remote, "wb") as f:
|
|
f.write(data)
|
|
print("uploaded", remote, len(data))
|
|
sftp.close()
|
|
_, o, e = c.exec_command("bash /tmp/_run_avatar_backfill.sh", timeout=90)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("ERR", err[:1500])
|
|
c.close()
|