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>
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
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)
|
|
|
|
checks = [
|
|
"systemctl show douyinweb-api -p Environment --no-pager | tr ' ' '\\n' | grep -E '^DY_S3|^Environment' || true",
|
|
"PID=$(systemctl show douyinweb-api -p MainPID --value); tr '\\0' '\\n' < /proc/$PID/environ | grep '^DY_S3' || true",
|
|
"""curl -s http://127.0.0.1:8014/api/health | python3 -c "import sys,json; d=json.load(sys.stdin); s=d.get('s3') or {}; print('enabled', s.get('enabled')); print('ok', s.get('ok')); print('public_base', s.get('public_base')); print('bucket', s.get('bucket'))" """,
|
|
"""cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
|
|
from app.config import settings
|
|
from app import s3_storage
|
|
print('cfg', settings.s3_enabled, settings.s3_endpoint, settings.s3_bucket, settings.s3_public_base)
|
|
print('runtime_enabled', s3_storage.s3_enabled())
|
|
PY""",
|
|
]
|
|
|
|
for cmd in checks:
|
|
print("\n===", cmd.splitlines()[0][:70], "===")
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
out = o.read().decode("utf-8", "replace")
|
|
err = e.read().decode("utf-8", "replace")
|
|
if "health | python3" in cmd:
|
|
print(out or err)
|
|
else:
|
|
print(out or err)
|
|
|
|
c.close()
|