#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Diagnose why https://dylive.nomadro.com/neko/8/ fails.""" from __future__ import annotations import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") SCRIPT = r"""#!/bin/bash set +e echo '=== public http ===' curl -sS -m 8 -o /dev/null -w 'dylive_neko8=%{http_code} redirect=%{redirect_url}\n' https://dylive.nomadro.com/neko/8/ curl -sS -m 8 -o /dev/null -w 'dylive_neko7=%{http_code}\n' https://dylive.nomadro.com/neko/7/ curl -sS -m 8 -D - -o /dev/null https://dylive.nomadro.com/neko/8/ 2>&1 | head -30 echo '=== local containers ===' docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' | grep -E 'neko|NAMES' | head -40 echo '=== listening 920x ===' ss -lntp | grep -E ':920[0-9]\b|:1920[0-9]\b' | head -40 echo '=== caddy neko routes (dylive) ===' # find site config for f in /etc/caddy/Caddyfile /etc/caddy/*.caddy /etc/caddy/conf.d/* /etc/caddy/sites/* /opt/caddy/* 2>/dev/null; do [ -f "$f" ] || continue if grep -q 'dylive\|neko/' "$f" 2>/dev/null; then echo "-- $f --" grep -nE 'neko/|920[0-9]|dylive' "$f" | head -60 fi done ls /etc/caddy 2>/dev/null ls /etc/caddy/sites-enabled /etc/caddy/conf.d 2>/dev/null echo '=== find dylive caddy ===' grep -Rsl 'dylive.nomadro.com' /etc/caddy /opt /root 2>/dev/null | head -20 echo '=== compose / api neko expect ===' ls /opt/douyinWEB/backend/data/neko 2>/dev/null | head # how many assign slots python3 - <<'PY' import os, json from pathlib import Path root=Path('/opt/douyinWEB') # quick env for p in [root/'backend'/'.env', root/'.env', Path('/etc/douyinweb.env')]: if p.exists(): print('envfile', p) for line in p.read_text(errors='replace').splitlines(): if 'NEKO' in line.upper() or 'ASSIGN' in line.upper(): print(' ', line[:160]) PY """ def main() -> None: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect( "107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False, banner_timeout=60, ) sftp = c.open_sftp() with sftp.file("/tmp/_diag_dylive_neko8.sh", "w") as f: f.write(SCRIPT) sftp.close() _i, o, e = c.exec_command("bash /tmp/_diag_dylive_neko8.sh", timeout=90) print((o.read() + e.read()).decode("utf-8", "replace")) c.close() if __name__ == "__main__": main()