-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_backend.sh
More file actions
executable file
·62 lines (52 loc) · 1.87 KB
/
start_backend.sh
File metadata and controls
executable file
·62 lines (52 loc) · 1.87 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# SIGMAX Backend Startup Script
echo "🚀 Starting SIGMAX Backend..."
echo ""
# Check if .env exists
if [ ! -f ".env" ]; then
echo "⚠️ .env file not found. Creating from .env.example..."
cp .env.example .env
echo "✅ .env created. Please configure it before running in production."
echo ""
fi
# Check Python version
PYTHON_VERSION=$(python3 --version 2>&1 | grep -oP '(?<=Python )\d+\.\d+')
REQUIRED_VERSION="3.11"
if (( $(echo "$PYTHON_VERSION $REQUIRED_VERSION" | awk '{print ($1 < $2)}') )); then
echo "❌ Python $REQUIRED_VERSION or higher required. Found: $PYTHON_VERSION"
exit 1
fi
echo "✅ Python version: $PYTHON_VERSION"
echo ""
# Check if dependencies are installed
echo "📦 Checking dependencies..."
python3 -c "import fastapi" 2>/dev/null
if [ $? -ne 0 ]; then
echo "⚠️ Dependencies not installed. Installing..."
pip install -r core/requirements.txt
pip install -r ui/api/requirements.txt
fi
echo "✅ Dependencies OK"
echo ""
# Check if Ollama is running (if LLM_PROVIDER=ollama)
if grep -q "LLM_PROVIDER=ollama" .env 2>/dev/null; then
echo "🤖 Checking Ollama..."
curl -s http://localhost:11434/api/tags > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "⚠️ Ollama not detected. Options:"
echo " 1. Install Ollama: https://ollama.ai"
echo " 2. Or use OpenAI/Anthropic (edit .env: LLM_PROVIDER=openai)"
echo ""
else
echo "✅ Ollama is running"
echo ""
fi
fi
# Start the backend
echo "🌐 Starting FastAPI backend on http://localhost:8000"
echo "📚 API docs will be at http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
uvicorn ui.api.main:app --reload --host 0.0.0.0 --port 8000