-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
61 lines (48 loc) Β· 1.37 KB
/
deploy.sh
File metadata and controls
61 lines (48 loc) Β· 1.37 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
#!/bin/bash
# Deployment script for evcao.csse.dev
set -e # Exit on error
echo "π Starting deployment..."
# Navigate to project directory (always start from root)
PROJECT_ROOT="/home/evcao/CSC437"
cd "$PROJECT_ROOT" || exit 1
# Clean up any unstaged changes in dist (these are generated files)
echo "π¦ Cleaning up dist files..."
git restore packages/app/dist/ 2>/dev/null || true
git clean -fd packages/app/dist/assets/ 2>/dev/null || true
# Pull latest code
echo "β¬οΈ Pulling latest code..."
git pull --rebase
# Install any new dependencies
echo "π₯ Installing dependencies..."
npm install
cd packages/app
npm install
cd ../..
cd packages/server
npm install
cd ../..
# Rebuild frontend
echo "π¨ Building frontend..."
cd packages/app
npm run build
cd ../..
# Stop existing server
echo "π Stopping existing server..."
pkill -f "node.*dist/index.js" || pkill -f "nodemon" || true
sleep 2
# Start server
echo "βΆοΈ Starting server..."
cd packages/server
nohup npm run start:app > ../../nohup.out 2>&1 &
# Wait a moment for server to start
sleep 3
# Check if server is running
if ps aux | grep -q "[n]ode.*dist/index.js"; then
echo "β
Server is running!"
echo "π Check logs with: tail -f /home/evcao/CSC437/nohup.out"
else
echo "β Server failed to start. Check logs:"
tail -20 /home/evcao/CSC437/nohup.out
exit 1
fi
echo "β
Deployment complete!"