-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
44 lines (36 loc) Β· 1.2 KB
/
deploy.sh
File metadata and controls
44 lines (36 loc) Β· 1.2 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
#!/bin/bash
# Gastlook API Deployment Script for Plesk Server
echo "π Starting Gastlook API deployment..."
# Create necessary directories
echo "π Creating directories..."
mkdir -p logs
mkdir -p uploads
# Set proper permissions
echo "π Setting permissions..."
chmod 755 uploads
chmod 755 logs
# Install production dependencies
echo "π¦ Installing dependencies..."
npm install --production
# Run database migrations (if using Sequelize CLI)
echo "ποΈ Running database migrations..."
if [ -f "node_modules/.bin/sequelize" ]; then
npx sequelize-cli db:migrate
else
echo "Sequelize CLI not found, skipping migrations"
fi
# Start the application with PM2 (if available)
echo "π Starting application..."
if command -v pm2 &> /dev/null; then
pm2 stop gastlook-api 2>/dev/null || true
pm2 start ecosystem.config.js --env production
pm2 save
echo "β
Application started with PM2"
else
echo "PM2 not found, starting with node..."
nohup node src/index.js > logs/app.log 2>&1 &
echo "β
Application started in background"
fi
echo "π Deployment completed!"
echo "π Check logs in the 'logs' directory"
echo "π Your API should be available at your configured domain"