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>
84 lines
3.4 KiB
Python
84 lines
3.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Continue sh2 Neko parity: status, enabled reconcile, TM/ext checks, frontend hint."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
ROOT = Path(r"c:\Users\admin\Desktop\douyinWEB")
|
|
HOST = "108.174.50.68"
|
|
PASS = "Xiao4669805"
|
|
|
|
REMOTE = r"""#!/bin/bash
|
|
set -e
|
|
echo '===== groups / neko_enabled ====='
|
|
cd /opt/douyinWEB/backend
|
|
.venv/bin/python - <<'PY'
|
|
from app import yt_assign_db, youtube_neko
|
|
groups = yt_assign_db.list_groups(include_urls=False)
|
|
for g in groups:
|
|
print(g.get('name'), 'id', g.get('id'), 'neko', g.get('neko_instance_id'), 'enabled', g.get('neko_enabled'), 'has_key', bool(str(g.get('stream_key') or '').strip() or g.get('has_stream_key')))
|
|
# reconcile running to DB flags
|
|
r = youtube_neko.sync_for_groups(groups)
|
|
print('sync', r)
|
|
st = youtube_neko.status_summary(desired=0)
|
|
print('assets', st.get('assets'))
|
|
print('nat', st.get('nat1to1'))
|
|
for i in st.get('instances') or []:
|
|
print('inst', i.get('id'), i.get('status'), 'run', i.get('running'), 'ready', i.get('ready'), i.get('studio_url'))
|
|
PY
|
|
|
|
echo '===== container mounts / chrome flags ====='
|
|
for id in 1 2; do
|
|
name=douyinweb-neko-$id
|
|
if ! docker ps --format '{{.Names}}' | grep -qx "$name"; then
|
|
echo "$name not running"
|
|
continue
|
|
fi
|
|
echo "--- $name ---"
|
|
docker exec "$name" supervisorctl status 2>/dev/null | head
|
|
docker exec "$name" sh -c 'for f in /proc/[0-9]*/cmdline; do tr "\0" " " < "$f"; echo; done' 2>/dev/null | grep -E 'load-extension|browser-launch' | head -3 || true
|
|
docker exec "$name" sh -c 'test -f /etc/neko/live-ops-extension/auto-dismiss.js && echo auto_dismiss_ok; test -f /etc/opt/chrome/policies/managed/policies.json && echo policies_ok; curl -fsS http://127.0.0.1:18080/tampermonkey-provisioning.json | head -c 80; echo'
|
|
# TM extension present?
|
|
docker exec "$name" sh -c 'ls /home/neko/.config/google-chrome/Default/Extensions 2>/dev/null | head'
|
|
done
|
|
|
|
echo '===== ingest endpoint ====='
|
|
curl -fsS -X POST http://127.0.0.1:8000/api/youtube/studio/ingest -H 'Content-Type: application/json' -d '{"live_status":"probe","source":"smoke"}' || echo ingest_fail
|
|
curl -fsS -X POST http://127.0.0.1:8000/hub/youtube/live/ingest -H 'Content-Type: application/json' -d '{"live_status":"probe2","source":"smoke"}' || echo hub_ingest_fail
|
|
|
|
echo '===== systemd neko env ====='
|
|
systemctl show douyinweb-api -p Environment --no-pager | tr ' ' '\n' | grep -E 'DY_NEKO|DY_PUBLIC' || true
|
|
ls /etc/systemd/system/douyinweb-api.service.d/ 2>/dev/null || true
|
|
"""
|
|
|
|
|
|
def main() -> None:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, 22, "root", PASS, timeout=45, allow_agent=False, look_for_keys=False)
|
|
|
|
# sync frontend panel hint if built assets path exists on server - upload source; optional build
|
|
s = c.open_sftp()
|
|
panel = ROOT / "frontend/src/components/YtRelayProStatusPanel.tsx"
|
|
s.put(str(panel), "/opt/douyinWEB/frontend/src/components/YtRelayProStatusPanel.tsx")
|
|
print("put panel")
|
|
with s.file("/tmp/neko_continue.sh", "w") as f:
|
|
f.write(REMOTE)
|
|
s.close()
|
|
|
|
_i, o, e = c.exec_command("bash /tmp/neko_continue.sh", timeout=180)
|
|
o.channel.settimeout(180)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("STDERR", err[:1500])
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|