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

46 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
import sys
import time
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
PASS = "4669805"
def main() -> int:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(
"107.173.30.245",
4014,
"eric",
PASS,
timeout=60,
banner_timeout=120,
allow_agent=False,
look_for_keys=False,
)
cmd = (
f"echo '{PASS}' | sudo -S -p '' bash -lc "
"'systemctl is-active douyinweb-api douyinweb-web; "
"docker ps --filter name=douyinweb-neko- --format \"{{.Names}} {{.Status}}\" | wc -l; "
"python3 - <<\"PY\"\n"
"import subprocess\n"
"from pathlib import Path\n"
"script = Path(\"/opt/douyinWEB/backend/neko/cdp_studio_scrape.py\").read_text(encoding=\"utf-8\")\n"
"p = subprocess.run([\"docker\",\"exec\",\"-i\",\"douyinweb-neko-1\",\"python3\",\"-\"], input=script, capture_output=True, text=True, timeout=30)\n"
"print((p.stdout or p.stderr or \"\")[-250:])\n"
"PY'"
)
# simpler without nested heredoc
cmd = f"""echo '{PASS}' | sudo -S -p '' bash -c 'systemctl is-active douyinweb-api; systemctl is-active douyinweb-web; docker ps -q --filter name=douyinweb-neko- | wc -l; grep -n signed_out /opt/douyinWEB/backend/neko/cdp_studio_scrape.py | head -3; grep -n signed_out /opt/douyinWEB/frontend/src/components/YtRelayProStatusPanel.tsx | head -3'"""
_, o, e = c.exec_command(cmd, timeout=60)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())