-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·35 lines (27 loc) · 864 Bytes
/
Copy pathrun.sh
File metadata and controls
executable file
·35 lines (27 loc) · 864 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
30
31
32
33
34
35
#!/bin/bash
# Path to the virtual environment
VENV_PATH="${1:-../bikevenv}"
PYTHON_BIN="$VENV_PATH/bin/python"
if [ ! -f "$PYTHON_BIN" ]; then
echo "❌ Error: Python not found at $PYTHON_BIN"
echo "Usage: ./run.sh [path_to_venv]"
exit 1
fi
echo "🚲 Starting BikeShop MMM Director using venv: $VENV_PATH"
# Function to kill background processes on exit
cleanup() {
echo ""
echo "🛑 Shutting down..."
kill $(jobs -p)
exit
}
# Trap SIGINT (Ctrl+C) and SIGTERM
trap cleanup SIGINT SIGTERM
# 1. Start the API in the background
echo "📡 Starting API on port 8000..."
$PYTHON_BIN api/main.py > api.log 2>&1 &
# Wait a moment for the API to initialize
sleep 2
# 2. Start the Streamlit UI in the foreground
echo "🎨 Starting UI on port 8501..."
$PYTHON_BIN -m streamlit run ui/app.py --server.port 8501 --server.address 0.0.0.0