-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_server.sh
More file actions
executable file
·29 lines (24 loc) · 1015 Bytes
/
start_server.sh
File metadata and controls
executable file
·29 lines (24 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
PROJECT_ROOT="/root/claude_tests/NEODEMO4"
PYTHON_BIN="$PROJECT_ROOT/venv/bin/python3"
export MODEL_PATH="$PROJECT_ROOT/model_assets/mistral-7b-v0.1.Q4_K_M.gguf"
export LD_LIBRARY_PATH="$PROJECT_ROOT/venv/lib/python3.12/site-packages/llama_cpp/lib:$LD_LIBRARY_PATH"
echo "Stopping any existing server instance..."
pkill -f api.py && sleep 2
echo "Starting Mistral-7B Inference Server..."
nohup $PYTHON_BIN $PROJECT_ROOT/api.py > $PROJECT_ROOT/server.log 2>&1 &
PID=$!
echo $PID > $PROJECT_ROOT/server.pid
echo "Waiting for server to bind to port 8000..."
max_retries=30
count=0
while ! grep -q "Starting Uvicorn server on 0.0.0.0:8000" "$PROJECT_ROOT/server.log" && [ $count -lt $max_retries ]; do
sleep 2
((count++))
done
if [ $count -eq $max_retries ]; then
echo "Timeout waiting for server to start. Check $PROJECT_ROOT/server.log"
exit 1
fi
echo "Server is up! Testing connectivity..."
curl -s http://localhost:8000/health || echo "Health check failed, but process is running."