diff --git a/deploy/jarvis-deploy.sh b/deploy/jarvis-deploy.sh index 531bd8a..71ba1fc 100755 --- a/deploy/jarvis-deploy.sh +++ b/deploy/jarvis-deploy.sh @@ -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 diff --git a/deploy/requirements.txt b/deploy/requirements.txt new file mode 100644 index 0000000..bb38b04 --- /dev/null +++ b/deploy/requirements.txt @@ -0,0 +1,6 @@ +fastapi +uvicorn[standard] +aiomysql +aiohttp +anthropic +trafilatura diff --git a/public_html/admin/index.php b/public_html/admin/index.php index 8941d02..c4b4259 100644 --- a/public_html/admin/index.php +++ b/public_html/admin/index.php @@ -552,6 +552,20 @@ if ($action) { } elseif ($wType === 'daemon' && $wId === 'arc_reactor' && $wAction === 'restart') { shell_exec('bash -c "mkdir -p /home/jarvis.orbishosting.com/logs; systemctl restart jarvis-arc 2>/dev/null || (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 &)"'); j(['ok'=>true,'msg'=>'Arc Reactor restarting']); + } elseif ($wType === 'daemon' && $wId === 'arc_reactor' && $wAction === 'setup') { + $setupLog = '/home/jarvis.orbishosting.com/logs/arc_reactor.log'; + $cmd = 'bash -c "'. + 'mkdir -p /opt/jarvis-arc /home/jarvis.orbishosting.com/logs && '. + 'cp /var/www/jarvis/deploy/reactor.py /opt/jarvis-arc/reactor.py && '. + 'cp /var/www/jarvis/deploy/requirements.txt /opt/jarvis-arc/requirements.txt && '. + 'if [ ! -d /opt/jarvis-arc/venv ]; then python3 -m venv /opt/jarvis-arc/venv; fi && '. + '/opt/jarvis-arc/venv/bin/pip install -q -r /opt/jarvis-arc/requirements.txt && '. + 'pkill -f reactor.py 2>/dev/null; sleep 1 && '. + 'cd /opt/jarvis-arc && source venv/bin/activate && '. + 'nohup python3 reactor.py >> '.$setupLog.' 2>&1 &'. + '" >> '.$setupLog.' 2>&1'; + shell_exec($cmd); + j(['ok'=>true,'msg'=>'Arc Reactor setup started — check log in ~30s then restart']); } else { bad('Invalid worker action'); } break; case 'arc_status': @@ -2332,7 +2346,10 @@ async function loadWorkers() { jarvis-do :7474 ${rdot}${ron?'ONLINE':'OFFLINE'} ${rinfo} - + + + + `; } async function loadDashboard() {