douyinWEB/scripts/_diag_neko56_404.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

74 lines
2.0 KiB
Python

# -*- coding: utf-8 -*-
"""Diagnose neko 5/6 404 on dy.nomadro.com."""
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=45, allow_agent=False, look_for_keys=False)
return c
def run(c, cmd, t=90):
_, o, e = c.exec_command(cmd, timeout=t)
return (o.read() + e.read()).decode("utf-8", "replace")
g = ssh("107.173.30.245", 4014, "eric", "4669805")
print("=== PHYSICAL ===")
print(
run(
g,
r"""
echo '4669805' | sudo -S -p '' bash -lc '
echo --- groups neko ---
sqlite3 /opt/douyinWEB/backend/data/monitor.db "SELECT name, neko_instance_id, neko_enabled, enabled FROM yt_assign_groups ORDER BY neko_instance_id;"
echo --- docker neko ---
docker ps -a --format "{{.Names}} {{.Status}} {{.Ports}}" | grep -i neko | sort
echo --- listen 920 ---
ss -lntp | grep -E "920[0-9]" | head -20
echo --- local curl ---
for i in 1 2 3 4 5 6; do
code=$(curl -sS -m 3 -o /dev/null -w "%{http_code}" http://127.0.0.1:$((9199+i))/ 2>/dev/null || echo fail)
echo "neko$i :$((9199+i)) -> $code"
done
echo --- nginx neko snippets ---
ls /etc/nginx/conf.d/*neko* 2>/dev/null || true
grep -R "neko/" /etc/nginx/ 2>/dev/null | head -30 || true
'
""",
120,
)
)
g.close()
v = ssh("107.173.30.245", 22, "root", "Xiao4669805")
print("=== OVERSEAS Caddy dy.nomadro.com ===")
print(
run(
v,
r"""
grep -nE 'neko|10\.8\.0\.2:92' /etc/caddy/sites/dy.nomadro.com.caddy 2>/dev/null | head -60
echo --- public curl ---
for i in 1 2 3 4 5 6; do
code=$(curl -sS -m 8 -o /dev/null -w "%{http_code}" "https://dy.nomadro.com/neko/$i/" || true)
echo "public /neko/$i/ -> $code"
done
echo --- via wg ---
for i in 5 6; do
code=$(curl -sS -m 5 -o /dev/null -w "%{http_code}" "http://10.8.0.2:$((9199+i))/" || true)
echo "wg 10.8.0.2:$((9199+i)) -> $code"
done
""",
90,
)
)
v.close()