File size: 797 Bytes
4cb7ab8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# Safe Deployment Script for VisaBerry / QuickTools

echo "πŸš€ Starting Safe Deployment Process..."

# 1. Run Backend Unit Tests
echo "πŸ§ͺ Running Backend Tests..."
cd backend
if venv/bin/pytest test_main.py; then
    echo "βœ… Tests Passed!"
else
    echo "❌ Tests Failed! Deployment Aborted."
    exit 1
fi
cd ..

# 2. Build Frontend
echo "πŸ—οΈ Building Frontend..."
cd frontend
rm -rf .next
if npm run build; then
    echo "βœ… Build Successful!"
else
    echo "❌ Build Failed! Deployment Aborted."
    exit 1
fi

# 3. Zero-Downtime Reload via PM2
echo "πŸ”„ Reloading Services..."
pm2 reload visa-frontend
# Backend is usually fast, restart is fine, or also reload if using gunicorn
pm2 restart visa-backend

echo "✨ Deployment Complete! VisaBerry is live and stable."