-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-prod.sh
More file actions
executable file
Β·48 lines (39 loc) Β· 1.11 KB
/
Copy pathstart-prod.sh
File metadata and controls
executable file
Β·48 lines (39 loc) Β· 1.11 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
#!/bin/bash
# AI Money Mentor - Production Start Script
echo "π Starting AI Money Mentor Production Environment..."
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
if [ ! -f ".env" ]; then
echo "β .env file not found."
exit 1
fi
export $(cat .env | grep -v '^#' | xargs)
cleanup() {
echo "π Stopping servers..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit 0
}
trap cleanup SIGINT SIGTERM
# Start Backend
echo "π¦ Starting Backend (port 8000)..."
cd "$SCRIPT_DIR/backend"
[ ! -d "venv" ] && python3 -m venv venv
source venv/bin/activate
pip install -q -r requirements.txt
uvicorn api_server:app --host 0.0.0.0 --port 8000 &
BACKEND_PID=$!
cd "$SCRIPT_DIR"
sleep 3
# Start Frontend
echo "π¨ Starting Frontend (port 3000)..."
cd "$SCRIPT_DIR/frontend"
[ ! -d "node_modules" ] && npm install
npx prisma generate
[ ! -d ".next" ] && npm run build
npm run start &
FRONTEND_PID=$!
cd "$SCRIPT_DIR"
echo "β
Production environment started!"
echo "π± Frontend: http://localhost:3000"
echo "π§ Backend: http://localhost:8000"
wait $BACKEND_PID $FRONTEND_PID