-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_api.sh
More file actions
executable file
Β·55 lines (45 loc) Β· 1.43 KB
/
start_api.sh
File metadata and controls
executable file
Β·55 lines (45 loc) Β· 1.43 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
#!/bin/bash
# CAN 2025 Guardian API - Startup Script
echo "π‘οΈ CAN 2025 Guardian API"
echo "=========================="
echo ""
# Check Python version
python_version=$(python3 --version 2>&1 | awk '{print $2}')
echo "β Python version: $python_version"
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "β Virtual environment not found. Creating..."
python3 -m venv venv
echo "β Virtual environment created"
fi
# Activate virtual environment
echo "β Activating virtual environment..."
source venv/bin/activate
# Install/update dependencies
echo "β Installing dependencies..."
pip install -q --upgrade pip
pip install -q -r requirements.txt
echo "β Dependencies installed"
# Create necessary directories
mkdir -p logs data
# Check if .env exists
if [ ! -f ".env" ]; then
echo "β Warning: .env file not found. Using defaults."
echo " Create .env file from .env.example for production."
fi
# Start the API server
echo ""
echo "π Starting FastAPI server..."
echo "π API will be available at: http://localhost:8888"
echo "π API Documentation: http://localhost:8888/api/docs"
echo "π Health Check: http://localhost:8888/health"
echo ""
echo "Default credentials:"
echo " Username: admin"
echo " Password: admin123"
echo ""
echo "Press Ctrl+C to stop the server"
echo "=========================="
echo ""
# Start uvicorn with auto-reload
uvicorn api.main:app --reload --host 0.0.0.0 --port 8888