File size: 1,137 Bytes
e7f5703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2fe3317
e7f5703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# Function to handle shutdown signals
cleanup() {
    echo "Shutting down services..."
    kill $FRONTEND_PID $BACKEND_PID 2>/dev/null
    wait
    exit 0
}

# Set up signal handlers
trap cleanup SIGTERM SIGINT

# Start Next.js frontend in the background on port 7860
echo "Starting LumaKit Frontend on port 7860..."
cd /app/frontend && PORT=7860 bunx next start &
FRONTEND_PID=$!
echo "Frontend started with PID: $FRONTEND_PID"

# Wait a moment for frontend to initialize
sleep 2

# Start the Express backend on port 5000
echo "Starting LumaKit Backend on port 5000..."
cd /app && PORT=5000 bun run src/index.js &
BACKEND_PID=$!
echo "Backend started with PID: $BACKEND_PID"

# Display service information
echo "================================"
echo "LumaKit Services Running:"
echo "Frontend (Next.js): http://localhost:7860"
echo "Backend (Express): http://localhost:5000"
echo "Backend Stats: http://localhost:5000/stats"
echo "================================"

# Wait for any process to exit
wait -n

# If we reach here, one of the processes has exited
echo "One of the services has stopped. Shutting down..."
cleanup