Fix reactor startup: auto-create venv, requirements.txt, SETUP button, self-install

- deploy/requirements.txt: explicit pip deps (fastapi, uvicorn, aiomysql, aiohttp, anthropic, trafilatura)
- jarvis-deploy.sh: self-installs to /usr/local/bin/ on every run so updates propagate;
  auto-creates venv and installs packages if missing before restart attempt
- admin/index.php: add SETUP button next to RESTART — runs full setup+start in one click
  (creates venv, installs deps, copies reactor.py, starts it)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8tDRrQqgLjqXebMCBNcP3
This commit is contained in:
2026-07-01 04:11:12 -05:00
parent dfc92a6791
commit af03a2f2d8
3 changed files with 38 additions and 5 deletions
+14 -4
View File
@@ -92,20 +92,30 @@ while IFS= read -r path; do
log "Patched config.php: Ollama IP→.210, model→llama3.1:8b, Groq search→compound-beta-mini"
fi
# Self-install the deploy script on every run
cp "$path/deploy/jarvis-deploy.sh" /usr/local/bin/jarvis-deploy.sh 2>/dev/null && chmod +x /usr/local/bin/jarvis-deploy.sh
# Sync reactor.py + service file to runtime location if they changed
if echo "$CHANGED" | grep -q 'deploy/reactor.py\|deploy/jarvis-arc.service'; then
mkdir -p /opt/jarvis-arc
if echo "$CHANGED" | grep -q 'deploy/reactor.py\|deploy/jarvis-arc.service\|deploy/requirements.txt'; then
mkdir -p /opt/jarvis-arc /home/jarvis.orbishosting.com/logs
cp "$path/deploy/reactor.py" /opt/jarvis-arc/reactor.py
cp "$path/deploy/requirements.txt" /opt/jarvis-arc/requirements.txt 2>/dev/null
# Bootstrap venv if it doesn't exist
if [ ! -f /opt/jarvis-arc/venv/bin/activate ]; then
log "Arc Reactor venv missing — creating and installing packages"
python3 -m venv /opt/jarvis-arc/venv
/opt/jarvis-arc/venv/bin/pip install -q -r /opt/jarvis-arc/requirements.txt
log "Arc Reactor venv ready"
fi
if echo "$CHANGED" | grep -q 'deploy/jarvis-arc.service'; then
cp "$path/deploy/jarvis-arc.service" /etc/systemd/system/jarvis-arc.service
systemctl daemon-reload
systemctl enable jarvis-arc
log "Arc Reactor service file installed and enabled"
fi
mkdir -p /home/jarvis.orbishosting.com/logs
systemctl restart jarvis-arc 2>/dev/null || \
bash -c "pkill -f reactor.py 2>/dev/null; sleep 1; cd /opt/jarvis-arc && source venv/bin/activate && nohup python3 reactor.py >> /home/jarvis.orbishosting.com/logs/arc_reactor.log 2>&1 &"
log "Arc Reactor updated and restarted (reactor.py changed)"
log "Arc Reactor updated and restarted"
fi
fi