feat(deploy+bench+ops): DGX vm scripts, Windows RDP launcher, bench cases, agent_chat enable script
Some checks failed
tests / Lint (ruff + black) (push) Failing after 1m50s
tests / Tests unitaires (sans GPU) (push) Failing after 1m53s
tests / Tests sécurité (critique) (push) Has been skipped

This commit is contained in:
Dom
2026-07-02 13:32:36 +02:00
parent 6907ecc82f
commit bd1c9d2c8a
11 changed files with 479 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="/home/aivanov/ai/rpa_vision_v3"
VENV="$ROOT/venv_v3"
WIN_IP="${WIN_IP:-192.168.1.11}"
ENV_FILE="$ROOT/.env.local"
SERVICE_FILE="/etc/systemd/system/rpa-agent-chat.service"
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
echo "ERROR: run as root with sudo" >&2
exit 1
fi
if [[ ! -d "$ROOT" || ! -x "$VENV/bin/python3" || ! -f "$ROOT/agent_chat/app.py" ]]; then
echo "ERROR: DGX RPA tree or venv missing under $ROOT" >&2
exit 1
fi
if [[ ! -f "$ENV_FILE" ]]; then
echo "ERROR: missing $ENV_FILE" >&2
exit 1
fi
ts="$(date +%Y%m%d_%H%M%S)"
cp -a "$ENV_FILE" "$ENV_FILE.bak_m2_r1_$ts"
python3 - "$ENV_FILE" <<'PY'
from pathlib import Path
import sys
path = Path(sys.argv[1])
lines = path.read_text().splitlines()
seen = False
out = []
for line in lines:
if line.startswith("RPA_BIND_HOST="):
out.append("RPA_BIND_HOST=0.0.0.0")
seen = True
else:
out.append(line)
if not seen:
out.append("RPA_BIND_HOST=0.0.0.0")
path.write_text("\n".join(out) + "\n")
PY
install -m 0644 /dev/stdin "$SERVICE_FILE" <<UNIT
[Unit]
Description=RPA Vision V3 - Agent Chat (Flask/SocketIO, port 5004)
After=network-online.target rpa-streaming.service
Wants=network-online.target
Requires=rpa-streaming.service
[Service]
Type=simple
User=aivanov
Group=aivanov
WorkingDirectory=$ROOT
EnvironmentFile=$ENV_FILE
Environment="PYTHONUNBUFFERED=1"
Environment="ENVIRONMENT=production"
Environment="RPA_SERVICE_NAME=rpa-agent-chat"
Environment="PYTHONPATH=$ROOT"
Environment="AGENT_CHAT_ENABLE_OWL=0"
Environment="AGENT_CHAT_ENABLE_UI_DETECTION=0"
ExecStart=$VENV/bin/python3 -m agent_chat.app
Restart=on-failure
RestartSec=5
TimeoutStopSec=30
KillMode=mixed
NoNewPrivileges=true
PrivateTmp=true
StandardOutput=journal
StandardError=journal
SyslogIdentifier=rpa-agent-chat
[Install]
WantedBy=multi-user.target
UNIT
systemctl daemon-reload
systemctl enable --now rpa-agent-chat.service
systemctl restart rpa-streaming.service
ensure_iptables_rule() {
if ! iptables -C INPUT "$@" 2>/dev/null; then
iptables -A INPUT "$@"
fi
}
ensure_iptables_rule -i lo -p tcp -m multiport --dports 5004,5005 -j ACCEPT
ensure_iptables_rule -p tcp -s "$WIN_IP" -m multiport --dports 5004,5005 -j ACCEPT
ensure_iptables_rule -p tcp -m multiport --dports 5004,5005 -j DROP
echo "--- services ---"
systemctl is-active rpa-agent-chat.service rpa-streaming.service
echo "--- ports ---"
ss -ltnp | grep -E ':(5004|5005)\b' || true
echo "--- local health ---"
curl -sS -m 5 http://127.0.0.1:5005/health
echo
curl -sS -m 5 -o /dev/null -w 'agent_chat_status=%{http_code}\n' http://127.0.0.1:5004/api/status
echo "--- firewall rules ---"
iptables -S INPUT | grep -E 'dports 5004,5005|dport (5004|5005)' || true