# -*- coding: utf-8 -*- """Retry Seaweed bucket on PVE guest only. Verify empty rooms + live sites.""" import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") v = paramiko.SSHClient() v.set_missing_host_key_policy(paramiko.AutoAddPolicy()) v.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=25, allow_agent=False, look_for_keys=False) p = paramiko.SSHClient() p.set_missing_host_key_policy(paramiko.AutoAddPolicy()) p.connect("107.173.30.245", 4014, "eric", "4669805", timeout=25, allow_agent=False, look_for_keys=False) def run(c, cmd, timeout=60): _, o, e = c.exec_command(cmd, timeout=timeout) return (o.read() + e.read()).decode("utf-8", "replace") print("=== PVE seaweed/s3 ===") print(run(p, "echo '4669805' | sudo -S -p '' systemctl is-active douyinweb-s3 douyinweb-sw-filer douyinweb-sw-volume douyinweb-sw-master; ss -lntp | grep -E ':(8333|8014|4015|8092)\\b'")) print(run( p, r"""echo '4669805' | sudo -S -p '' bash -c ' set -a; source /etc/douyinweb.env; set +a cd /opt/douyinWEB/backend .venv/bin/python - </dev/null || python3 - <<"PY" import sqlite3 p="/opt/douyinWEB/backend/data/monitor.db" c=sqlite3.connect(p) print("tables", [r[0] for r in c.execute("select name from sqlite_master where type=\\047table\\047")]) try: print("rooms", c.execute("select count(*) from rooms").fetchone()[0]) except Exception as e: print("rooms_err", e) PY '""", 20, )) print("=== public checks ===") print(run( v, "curl -sS -m 12 -o /dev/null -w 'dylive_api:%{http_code} dylive_login:%{http_code}\\n' " "https://dylive.nomadro.com/api/health https://dylive.nomadro.com/login; " "curl -sS -m 15 -o /dev/null -w 'dy_api:%{http_code} dy_login:%{http_code}\\n' " "https://dy.nomadro.com/api/health https://dy.nomadro.com/login; " "systemctl is-active caddy sing-box; " "docker ps --format '{{.Names}} {{.Status}}' | grep -v wg-easy", 40, )) # the dual url curl -w trick is wrong; do separately print(run( v, "curl -sS -m 10 -o /dev/null -w 'dylive_api:%{http_code}\\n' https://dylive.nomadro.com/api/health; " "curl -sS -m 10 -o /dev/null -w 'dylive_login:%{http_code}\\n' https://dylive.nomadro.com/login; " "curl -sS -m 15 -o /dev/null -w 'dy_api:%{http_code}\\n' https://dy.nomadro.com/api/health; " "curl -sS -m 15 -o /dev/null -w 'dy_login:%{http_code}\\n' https://dy.nomadro.com/login", 40, )) v.close() p.close()