-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy-webhook.sh
More file actions
executable file
·69 lines (53 loc) · 1.71 KB
/
Copy pathdeploy-webhook.sh
File metadata and controls
executable file
·69 lines (53 loc) · 1.71 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# GitHub webhook deployment script - Optimized for HP Z620 Workstation
echo "================================"
echo "Starting webhook deployment at $(date)"
echo "================================"
# Navigate to the main repository directory
cd /var/wwww/Flex
# Pull the latest changes for the web project
echo "Pulling latest changes for flex_web..."
git pull
# Navigate to the external compiler directory if it exists
if [ -d "flex_compiler_external" ]; then
cd flex_compiler_external
# Pull the latest changes for the compiler
echo "Pulling latest changes for Flex compiler..."
git pull
# Navigate back to the web project backend
cd ../flex_web/backend
else
# Navigate directly to the web project backend
cd flex_web/backend
fi
# Ensure Bun is in PATH
export PATH="$HOME/.bun/bin:$PATH"
# Install any new dependencies for the web backend using Bun
echo "Installing backend dependencies with Bun..."
bun install --production
# Navigate back to the web project root
cd ..
# Check if the logs directory exists, create if not
if [ ! -d "logs" ]; then
echo "Creating logs directory..."
mkdir -p logs
fi
# Make sure the temp directory exists
if [ ! -d "backend/temp" ]; then
echo "Creating temp directory..."
mkdir -p backend/temp
fi
# Set proper permissions
chmod -R 755 logs
chmod -R 755 backend/temp
# Make sure PM2 is in PATH
export PATH="$HOME/.bun/bin:$PATH"
# Restart the application with PM2
echo "Restarting application with optimized settings..."
pm2 restart ecosystem.config.js --update-env
# Show current status
echo "Current PM2 status:"
pm2 list
echo "================================"
echo "Deployment completed at $(date)"
echo "================================"