-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart_app.sh
More file actions
executable file
·68 lines (55 loc) · 1.51 KB
/
start_app.sh
File metadata and controls
executable file
·68 lines (55 loc) · 1.51 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
63
64
65
66
67
68
#!/bin/bash
# RefNet Application Startup Script
echo "🚀 Starting RefNet Application..."
# Check if .env file exists
if [ ! -f .env ]; then
echo "⚠️ .env file not found. Please create one with your OpenAI API key:"
echo " OPENAI_API_KEY=your_openai_api_key_here"
exit 1
fi
# Start backend
echo "📡 Starting backend server..."
python app.py &
BACKEND_PID=$!
# Wait for backend to start
sleep 3
# Check if backend is running
if ! curl -s http://localhost:8000/health > /dev/null; then
echo "❌ Backend failed to start"
kill $BACKEND_PID 2>/dev/null
exit 1
fi
echo "✅ Backend started successfully"
# Start frontend
echo "🎨 Starting frontend server..."
cd refnet/frontend
export NODE_OPTIONS="--openssl-legacy-provider"
npm start &
FRONTEND_PID=$!
# Wait for frontend to start
sleep 10
# Check if frontend is running
if ! curl -s http://localhost:3000 > /dev/null; then
echo "❌ Frontend failed to start"
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit 1
fi
echo "✅ Frontend started successfully"
echo ""
echo "🌐 Application is running at:"
echo " Frontend: http://localhost:3000"
echo " Backend API: http://localhost:8000"
echo " Health Check: http://localhost:8000/health"
echo ""
echo "Press Ctrl+C to stop both servers"
# Function to cleanup on exit
cleanup() {
echo ""
echo "🛑 Stopping servers..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Wait for user to stop
wait