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>
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
REMOTE = r"""
|
|
echo "=== douyinweb.env s3 ==="
|
|
grep -i s3 /etc/douyinweb.env 2>/dev/null || true
|
|
grep -i s3 /etc/systemd/system/douyinweb-api.service 2>/dev/null || true
|
|
grep -ri s3 /etc/systemd/system/douyinweb-api.service.d/ 2>/dev/null || true
|
|
|
|
echo "=== nginx douyin-covers ==="
|
|
grep -r "douyin-covers\|8333\|s3" /etc/nginx/ 2>/dev/null | head -20
|
|
|
|
echo "=== api process env s3 ==="
|
|
pid=$(pgrep -f 'uvicorn app.main' | head -1)
|
|
if [ -n "$pid" ]; then tr '\0' '\n' < /proc/$pid/environ | grep -i s3 || echo no_s3_in_proc; fi
|
|
|
|
echo "=== test cover url ==="
|
|
cd /opt/douyinWEB/backend
|
|
COVER=$(.venv/bin/python - <<'PY'
|
|
from app import db
|
|
for s in db.list_active_sessions():
|
|
cp = str(s.get('cover_path') or '')
|
|
if cp.startswith('http'):
|
|
print(cp)
|
|
break
|
|
PY
|
|
)
|
|
echo "cover=$COVER"
|
|
if [ -n "$COVER" ]; then
|
|
curl -sS -o /dev/null -w "cover_direct=%{http_code} size=%{size_download}\n" "$COVER" -k || true
|
|
path=$(echo "$COVER" | sed 's|https://dy.nomadro.live||')
|
|
curl -sS -o /dev/null -w "cover_local=%{http_code} size=%{size_download}\n" -k "https://127.0.0.1$path" -H "Host: dy.nomadro.live" || true
|
|
curl -sS -o /dev/null -w "s3_internal=%{http_code}\n" "http://127.0.0.1:8333/douyin-covers/$(echo $COVER | sed 's|.*/douyin-covers/||')" || true
|
|
fi
|
|
|
|
echo "=== session api cover proxy ==="
|
|
SID=$(cd /opt/douyinWEB/backend && .venv/bin/python -c "from app import db; s=db.list_active_sessions(); print(s[0]['id'] if s else '')")
|
|
if [ -n "$SID" ]; then
|
|
curl -sS -o /dev/null -w "proxy_cover=%{http_code} size=%{size_download}\n" "http://127.0.0.1:8014/api/sessions/$SID/cover" || true
|
|
fi
|
|
"""
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
|
|
_i, o, e = c.exec_command(REMOTE, timeout=120)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace").strip()
|
|
if err:
|
|
print("ERR", err[:1500])
|
|
c.close()
|