-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-uat.sh
More file actions
55 lines (45 loc) · 1.3 KB
/
deploy-uat.sh
File metadata and controls
55 lines (45 loc) · 1.3 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
#!/bin/bash
set -e
echo "================================================"
echo "🚀 ArgusPAM UAT Deployment"
echo "================================================"
cd /var/www/arguspam
# Save current commit for potential rollback
PREV_COMMIT=$(git rev-parse HEAD)
echo "Previous commit: $PREV_COMMIT" > /tmp/arguspam_prev_deploy
# Fetch and reset to match remote exactly
echo "📥 Fetching latest code..."
git fetch origin uat/demo
echo "🔄 Resetting to origin/uat/demo..."
git reset --hard origin/uat/demo
git clean -fd
NEW_COMMIT=$(git rev-parse HEAD)
echo "Now at commit: $NEW_COMMIT"
# Deploy API
echo "🔧 Deploying API..."
cd api
composer install --no-dev --optimize-autoloader --no-interaction
php artisan migrate --force
php artisan optimize
# Deploy Web
echo "🌐 Deploying Web..."
cd ../web
npm ci --production
npm run build
# Restart services
echo "🔄 Restarting services..."
sudo systemctl restart arguspam-horizon
sudo systemctl restart arguspam-web
sudo systemctl reload php8.3-fpm
# Health check
sleep 5
echo "🏥 Health check..."
if curl -f -s https://demoapi.arguspam.com/up > /dev/null; then
echo "✅ Deployment successful!"
echo "✅ Previous: $PREV_COMMIT"
echo "✅ Current: $NEW_COMMIT"
else
echo "❌ Health check failed! Rolling back..."
git reset --hard $PREV_COMMIT
exit 1
fi