-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-server.sh
More file actions
executable file
·46 lines (36 loc) · 1.12 KB
/
start-server.sh
File metadata and controls
executable file
·46 lines (36 loc) · 1.12 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
#!/bin/bash
echo "🚀 Starting Lily Movements Website with Anti-Sleep System..."
# Set production environment
export NODE_ENV=production
# Ensure Prisma client is ready
echo "📦 Ensuring Prisma client is ready..."
npx prisma generate --silent
# Pre-warm the application
echo "🔥 Pre-warming application..."
node -e "
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
prisma.\$connect().then(() => {
console.log('✅ Database connection established');
prisma.\$disconnect();
}).catch((e) => {
console.log('⚠️ Database connection warning:', e.message);
});
"
# Make sure keep-alive script is executable
chmod +x keep-alive.sh
# Start the Next.js application
echo "📱 Starting Next.js application..."
npm run start:next &
APP_PID=$!
# Wait a moment for the app to start
sleep 10
# Start the anti-sleep system in the background
echo "🛡️ Starting Anti-Sleep System..."
./keep-alive.sh &
KEEPALIVE_PID=$!
echo "✅ Both systems started successfully!"
echo "📱 Next.js App PID: $APP_PID"
echo "🛡️ Keep-Alive PID: $KEEPALIVE_PID"
# Wait for the main application
wait $APP_PID