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>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""Diagnose missing data on dylive production."""
|
|
import paramiko
|
|
|
|
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: str, timeout: int = 90) -> str:
|
|
_, out, err = c.exec_command(cmd, timeout=timeout)
|
|
return (out.read() + err.read()).decode("utf-8", "replace").strip()
|
|
|
|
|
|
print("=== services ===")
|
|
print(run("systemctl is-active douyinweb-api douyinweb-web"))
|
|
print(run("systemctl status douyinweb-api --no-pager -l | head -30"))
|
|
|
|
print("\n=== find db files ===")
|
|
print(run(f"find {REPO} -name '*.db' -o -name '*.sqlite*' 2>/dev/null | head -40"))
|
|
print(run(f"ls -lah {REPO}/data 2>/dev/null | head -40"))
|
|
print(run(f"ls -lah {REPO}/backend/data 2>/dev/null | head -40"))
|
|
|
|
print("\n=== env ===")
|
|
print(run(f"ls -la {REPO}/backend/.env {REPO}/.env 2>/dev/null"))
|
|
print(run(f"grep -iE 'db_path|sqlite|data_dir|database' {REPO}/backend/.env {REPO}/.env {REPO}/backend/app/settings.py 2>/dev/null | head -40"))
|
|
|
|
print("\n=== api health / counts ===")
|
|
print(run("curl -sS http://127.0.0.1:8000/api/health 2>/dev/null | head -c 800"))
|
|
print()
|
|
print(run("curl -sS 'http://127.0.0.1:8000/api/shorts/channels' 2>/dev/null | head -c 500"))
|
|
print()
|
|
print(run("curl -sS 'http://127.0.0.1:8000/api/rooms?limit=3' 2>/dev/null | head -c 500"))
|
|
|
|
c.close()
|