gb/restart.sh

41 lines
996 B
Bash
Executable file

#!/bin/bash
set -e
echo "Stopping..."
pkill -f botserver || true
pkill -f botui || true
pkill -f botmodels || true
pkill -f rustc || true
echo "Cleaning..."
rm -f botserver.log botui.log botmodels.log
echo "Building..."
cargo build -p botserver
cargo build -p botui
echo "Starting botmodels..."
cd botmodels
source venv/bin/activate
uvicorn src.main:app --host 0.0.0.0 --port 8085 > ../botmodels.log 2>&1 &
echo " PID: $!"
cd ..
echo "Waiting for botmodels..."
for i in $(seq 1 30); do
if curl -s http://localhost:8085/api/health > /dev/null 2>&1; then
echo " botmodels ready"
break
fi
sleep 1
done
echo "Starting botserver..."
BOTMODELS_HOST="http://localhost:8085" BOTMODELS_API_KEY="starter" RUST_LOG=debug ./target/debug/botserver --noconsole > botserver.log 2>&1 &
echo " PID: $!"
echo "Starting botui..."
BOTSERVER_URL="http://localhost:8080" ./target/debug/botui > botui.log 2>&1 &
echo " PID: $!"
echo "Done. Logs: tail -f botserver.log botui.log botmodels.log"