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

34 lines
1.1 KiB
Python

#!/usr/bin/env python3
import sys
import paramiko
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
script = r"""
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)
print('groups', len(groups))
print(youtube_neko.sync_for_groups(groups))
PY
COMPOSE=/opt/douyinWEB/backend/data/neko/docker-compose.yml
grep -E 'DESKTOP_SCREEN|MAX_FPS|VIDEO_BITRATE' "$COMPOSE" | head -12
# recreate only running neko-3 with new env
docker compose -f "$COMPOSE" up -d --force-recreate douyinweb-neko-3 2>&1 | tail -20
sleep 6
docker stats --no-stream 2>/dev/null | head -5
uptime
"""
_, o, e = c.exec_command(script, timeout=120)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace").strip()
if err:
print("ERR:", err[:600])
c.close()