# -*- coding: utf-8 """Post-deploy verification: all neko instances + exclusive-live backend.""" from __future__ import annotations import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") HOST = "108.174.50.68" PASS = "Xiao4669805" CMD = r""" echo "=== API health ===" curl -fsS http://127.0.0.1:8014/api/health 2>/dev/null | head -c 200 || echo api_fail echo echo "=== relay exclusive settings ===" cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY' from app import db, youtube_relay_pipeline, yt_assign_db cfg = db.get_settings_map() print("exclusive_live", cfg.get("youtube_relay_exclusive_live")) st = youtube_relay_pipeline.youtube_relay_pipeline.status() print("exclusive_winner", st.get("exclusive_winner_group_id")) print("neko_paused", st.get("neko_paused_instances")) for g in st.get("groups") or []: print("group", g.get("name"), "pushing", g.get("is_pushing"), "neko", g.get("neko_instance_id"), "neko_run", (g.get("neko") or {}).get("running")) PY echo "=== neko containers ===" for id in 1 2 3 4 5; do name=douyinweb-neko-$id if docker inspect $name >/dev/null 2>&1; then st=$(docker ps -a --filter name=^${name}$ --format '{{.Status}}') echo "$name $st" if docker ps --format '{{.Names}}' | grep -qx "$name"; then docker exec "$name" sh -c 'grep -c focus_live_studio_tab_once /etc/neko/browser-launch.sh; grep -o "\"version\": \"[^\"]*\"" /etc/neko/live-ops-extension/manifest.json | head -1' docker exec "$name" python3 -c "import json,urllib.request; tabs=json.load(urllib.request.urlopen('http://127.0.0.1:9222/json/list',timeout=5)); live=[t.get('url','') for t in tabs if 'livestreaming' in (t.get('url') or '')]; print('live_tabs', len(live), live[0][:90] if live else 'none')" 2>/dev/null || echo cdp_skip fi fi done echo "=== groups neko map ===" cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY' from app import yt_assign_db for g in yt_assign_db.list_groups(include_urls=False): print(g.get("name"), "neko", g.get("neko_instance_id"), "enabled", g.get("neko_enabled")) PY """ def main() -> None: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(HOST, 22, "root", PASS, timeout=60, allow_agent=False, look_for_keys=False) _i, o, e = c.exec_command(CMD, timeout=180) print(o.read().decode("utf-8", "replace")) err = e.read().decode("utf-8", "replace") if err.strip(): print("ERR", err[:2000]) c.close() if __name__ == "__main__": main()