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>
64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Install missing Next /covers page on PVE (was skipped as data dir). Rebuild web only."""
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
PAGE = Path(__file__).resolve().parents[1] / "frontend" / "src" / "app" / "covers" / "page.tsx"
|
|
|
|
v = paramiko.SSHClient()
|
|
v.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
v.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=25, allow_agent=False, look_for_keys=False)
|
|
|
|
p = paramiko.SSHClient()
|
|
p.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
p.connect("107.173.30.245", 4014, "eric", "4669805", timeout=25, allow_agent=False, look_for_keys=False)
|
|
|
|
|
|
def run(c, cmd, timeout=120):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
|
|
sftp = p.open_sftp()
|
|
sftp.put(str(PAGE), "/tmp/covers_page.tsx")
|
|
sftp.close()
|
|
|
|
print(
|
|
run(
|
|
p,
|
|
"echo '4669805' | sudo -S -p '' bash -c '"
|
|
"mkdir -p /opt/douyinWEB/frontend/src/app/covers; "
|
|
"install -m 644 /tmp/covers_page.tsx /opt/douyinWEB/frontend/src/app/covers/page.tsx; "
|
|
"ls -l /opt/douyinWEB/frontend/src/app/covers; "
|
|
"cd /opt/douyinWEB/frontend; "
|
|
"export DY_INTERNAL_API_URL=http://127.0.0.1:8014 DY_PUBLIC_BASE_URL=https://dy.nomadro.com; "
|
|
"npm run build; "
|
|
"systemctl restart douyinweb-web; sleep 3; systemctl is-active douyinweb-web"
|
|
"'",
|
|
300,
|
|
)
|
|
)
|
|
|
|
time.sleep(2)
|
|
print("=== headers ===")
|
|
print(
|
|
run(
|
|
v,
|
|
"curl -sSI -m 15 https://dy.nomadro.com/covers | tr -d '\\r' | grep -iE 'HTTP/|location|content-type'; "
|
|
"echo '---'; "
|
|
"curl -sS -m 8 -o /dev/null -w 'dylive:%{http_code} dy_login:%{http_code}\\n' "
|
|
"https://dylive.nomadro.com/api/health https://dy.nomadro.com/login",
|
|
25,
|
|
)
|
|
)
|
|
# separate curls
|
|
print(run(v, "curl -sS -m 8 -o /dev/null -w 'dylive:%{http_code}\\n' https://dylive.nomadro.com/api/health; curl -sS -m 8 -o /dev/null -w 'dy_login:%{http_code}\\n' https://dy.nomadro.com/login", 20))
|
|
|
|
v.close()
|
|
p.close()
|