douyinWEB/scripts/_probe_physical_neko.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

58 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
def ssh(host, port, user, pw):
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(
host,
port,
user,
pw,
timeout=60,
banner_timeout=90,
auth_timeout=60,
allow_agent=False,
look_for_keys=False,
)
return c
def run(c, cmd, timeout=60):
_, o, e = c.exec_command(cmd, timeout=timeout)
return (o.read() + e.read()).decode("utf-8", "replace")
v = ssh("107.173.30.245", 22, "root", "Xiao4669805")
print("=== VPS ===")
print(run(v, "uptime; ps aux --sort=-%cpu | head -12; systemctl is-active caddy"))
print("dylive", run(v, "curl -sS -m 8 -o /dev/null -w '%{http_code}' https://dylive.nomadro.com/api/health"))
v.close()
g = ssh("107.173.30.245", 4014, "eric", "4669805")
print("=== GUEST ===")
print(
run(
g,
"echo '4669805' | sudo -S -p '' bash -lc "
"'docker images | head -8; "
"ls /opt/douyinWEB/backend/neko/tampermonkey-seed 2>/dev/null | head -3 || echo NO_SEED; "
"test -f /opt/douyinWEB/backend/app/network_hub.py && echo HUB_OK || echo NO_HUB; "
"test -f /opt/douyinWEB/frontend/src/app/network/page.tsx && echo PAGE_OK || echo NO_PAGE; "
"ip -br a show wg-dy 2>/dev/null || echo NO_WG; "
"systemctl is-active douyinweb-api douyinweb-web docker; "
"grep DY_NEKO /etc/systemd/system/douyinweb-api.service || echo NO_NEKO_ENV; "
"pgrep -af \"docker pull\" || true; "
"tail -n 5 /tmp/neko-pull.log 2>/dev/null || true'",
90,
)
)
g.close()