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>
56 lines
2.1 KiB
Python
56 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Probe dylive VPS deploy layout before upgrade."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
HOST = "107.173.30.245"
|
|
ROOT_PASS = "Xiao4669805"
|
|
|
|
|
|
def main() -> int:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, 22, "root", ROOT_PASS, timeout=45, allow_agent=False, look_for_keys=False)
|
|
|
|
def run(cmd: str, timeout: int = 60) -> str:
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
print(
|
|
run(
|
|
"set -e; "
|
|
"hostname; "
|
|
"ls -la /opt | head -30; "
|
|
"ls -la /home 2>/dev/null | head; "
|
|
"id eric 2>/dev/null || true; "
|
|
"ls -la /opt/douyinWEB 2>/dev/null | head -20 || ls -la /home/eric/douyinWEB 2>/dev/null | head -20; "
|
|
"echo '=== git ==='; "
|
|
"for d in /opt/douyinWEB /home/eric/douyinWEB /root/douyinWEB; do "
|
|
" if [ -d \"$d/.git\" ]; then echo FOUND $d; "
|
|
" sudo -u eric -H git -C \"$d\" remote -v 2>/dev/null || git -C \"$d\" remote -v; "
|
|
" sudo -u eric -H git -C \"$d\" status -sb 2>/dev/null || git -C \"$d\" status -sb; "
|
|
" sudo -u eric -H git -C \"$d\" log -1 --oneline 2>/dev/null || git -C \"$d\" log -1 --oneline; "
|
|
" fi; "
|
|
"done; "
|
|
"echo '=== services ==='; "
|
|
"systemctl list-units --type=service --all 'douyin*' 'dylive*' 2>/dev/null | head -40; "
|
|
"echo '=== health ==='; "
|
|
"curl -sS -m 8 https://dylive.nomadro.com/api/health | head -c 200; echo; "
|
|
"curl -sS -m 8 -o /dev/null -w 'http:%{http_code}\\n' https://dylive.nomadro.com/; "
|
|
"echo '=== env hints ==='; "
|
|
"grep -E 'DY_|INSTALL_|PUBLIC' /etc/systemd/system/douyinweb*.service /etc/default/douyin* 2>/dev/null | head -40; "
|
|
"ls /etc/systemd/system/douyin* 2>/dev/null"
|
|
)
|
|
)
|
|
c.close()
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|