-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
Β·61 lines (50 loc) Β· 1.47 KB
/
start.sh
File metadata and controls
executable file
Β·61 lines (50 loc) Β· 1.47 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
#!/bin/bash
# Simple RAG Chat - Startup Script
echo "π Starting Simple RAG Chat..."
# Check if .env exists
if [ ! -f .env ]; then
echo "β .env file not found. Please create one with your GEMINI_API_KEY"
echo "Example: echo 'GEMINI_API_KEY=your_key_here' > .env"
exit 1
fi
# Check if virtual environment exists
if [ ! -d .venv ]; then
echo "β Virtual environment not found. Please run setup first:"
echo "python3 -m venv .venv"
echo "source .venv/bin/activate"
echo "pip install -r requirements.txt"
exit 1
fi
echo "β
Environment looks good!"
# Start FastAPI server in background
echo "π§ Starting FastAPI server on http://127.0.0.1:8000"
source .venv/bin/activate
uvicorn api:app --host 127.0.0.1 --port 8000 &
API_PID=$!
# Wait a moment for API to start
sleep 3
# Start React dev server in background
echo "π¨ Starting React dev server on http://127.0.0.1:5173"
cd ui
npm run dev -- --host 127.0.0.1 --port 5173 &
REACT_PID=$!
echo ""
echo "π Both servers are starting up!"
echo "π± React UI: http://127.0.0.1:5173"
echo "π API: http://127.0.0.1:8000"
echo "π API Docs: http://127.0.0.1:8000/docs"
echo ""
echo "Press Ctrl+C to stop both servers"
# Function to cleanup on exit
cleanup() {
echo ""
echo "π Stopping servers..."
kill $API_PID 2>/dev/null
kill $REACT_PID 2>/dev/null
echo "β
Servers stopped"
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Wait for both processes
wait