Spaces:
Paused
Paused
Soham Waghmare
commited on
Commit
·
3599967
1
Parent(s):
25ed48b
chore
Browse files
start.sh
CHANGED
|
@@ -1,8 +1,39 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
|
|
|
|
|
|
| 3 |
cd /app/backend
|
| 4 |
uv run app.py &
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
cd /app/frontend
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
nginx -g "daemon off;" &
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# Start backend
|
| 4 |
+
echo "Starting backend..."
|
| 5 |
cd /app/backend
|
| 6 |
uv run app.py &
|
| 7 |
+
BACKEND_PID=$!
|
| 8 |
+
echo "Backend started with PID: $BACKEND_PID"
|
| 9 |
+
|
| 10 |
+
# Wait for backend to be ready (port 5000)
|
| 11 |
+
echo "Waiting for backend (port 5000) to be ready..."
|
| 12 |
+
while ! nc -z 127.0.0.1 5000; do
|
| 13 |
+
sleep 0.1
|
| 14 |
+
done
|
| 15 |
+
echo "Backend is ready."
|
| 16 |
+
|
| 17 |
+
# Start frontend
|
| 18 |
+
echo "Starting frontend..."
|
| 19 |
cd /app/frontend
|
| 20 |
+
npx serve@latest -l 3001 out &
|
| 21 |
+
FRONTEND_PID=$!
|
| 22 |
+
echo "Frontend started with PID: $FRONTEND_PID"
|
| 23 |
+
|
| 24 |
+
# Wait for frontend to be ready (port 3001)
|
| 25 |
+
echo "Waiting for frontend (port 3001) to be ready..."
|
| 26 |
+
while ! nc -z 127.0.0.1 3001; do
|
| 27 |
+
sleep 0.1
|
| 28 |
+
done
|
| 29 |
+
echo "Frontend is ready."
|
| 30 |
+
|
| 31 |
+
# Start Nginx
|
| 32 |
+
echo "Starting Nginx..."
|
| 33 |
nginx -g "daemon off;" &
|
| 34 |
+
NGINX_PID=$!
|
| 35 |
+
echo "Nginx started with PID: $NGINX_PID"
|
| 36 |
+
|
| 37 |
+
# Wait for all background processes (backend, frontend, Nginx)
|
| 38 |
+
wait $BACKEND_PID $FRONTEND_PID $NGINX_PID
|
| 39 |
+
echo "All services exited."
|