This captures the current live stack updates across the API, Linux service scripts, tests, diagnostics, and exported console assets so the Ubuntu deployment can pull a consistent test3 build. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Verify and recover live-console on 10.88.0.3 after relay log deploy."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805"
|
|
|
|
|
|
def run(c: paramiko.SSHClient, cmd: str, timeout: int = 120) -> tuple[int, str]:
|
|
_, o, e = c.exec_command("export LC_ALL=C.UTF-8 LANG=C.UTF-8; " + cmd, timeout=timeout)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace")
|
|
return o.channel.recv_exit_status(), out
|
|
|
|
|
|
def safe_print(text: str) -> None:
|
|
try:
|
|
print(text)
|
|
except UnicodeEncodeError:
|
|
sys.stdout.buffer.write(text.encode("utf-8", errors="replace") + b"\n")
|
|
|
|
|
|
def main() -> int:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=20)
|
|
|
|
steps = [
|
|
"systemctl is-active live-console.service 2>&1; systemctl status live-console.service --no-pager -n 20 2>&1",
|
|
f"echo {PASS!r} | sudo -S -p '' systemctl reset-failed live-console.service 2>/dev/null; "
|
|
f"echo {PASS!r} | sudo -S -p '' systemctl start live-console.service; sleep 8; "
|
|
"systemctl is-active live-console.service 2>&1",
|
|
"for i in 1 2 3 4 5 6 7 8 9 10; do "
|
|
"curl -sf -m 4 http://127.0.0.1:8001/health >/dev/null 2>&1 && echo health_ok && break; "
|
|
"sleep 3; done",
|
|
"curl -sS -m 10 -o /dev/null -w 'relay_log_page=%{http_code}\\n' http://127.0.0.1:8001/youtube-relay-log",
|
|
"curl -sS -m 10 'http://127.0.0.1:8001/hub/youtube/relay/sessions?limit=2' 2>&1 | head -c 800",
|
|
"journalctl -u live-console.service -n 30 --no-pager 2>&1",
|
|
]
|
|
for step in steps:
|
|
code, out = run(c, step, timeout=180)
|
|
safe_print(f"\n=== exit={code} ===\n{out[:2500]}")
|
|
|
|
c.close()
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|