-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
35 lines (28 loc) · 911 Bytes
/
start.sh
File metadata and controls
35 lines (28 loc) · 911 Bytes
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
# Wait for the database to be ready
echo "Waiting for DB to be ready..."
until nc -z starboard-db 5432; do
sleep 1
done
echo "DB is ready."
# Check if the previous build was successful or if the build success file doesn't exist
if [ ! -f ./first-start-fragment ] || grep -q "false" ./first-start-fragment; then
echo "Previous build failed or build success file doesn't exist. Rebuilding..."
echo "Generating Prisma Client"
npx prisma generate
# Run Prisma migrations
echo "Running Prisma migrations..."
npx prisma migrate deploy
# If build was successful, write a token to the file system
if [ $? -eq 0 ]; then
echo "Build successful."
echo "true" > ./first-start-fragment
else
echo "Build failed."
echo "false" > ./first-start-fragment
fi
else
echo "Previous build was successful. Skipping build steps."
fi
# Start the server
echo "Starting server..."
node build