Spaces:
Running
Running
| # 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." | |