update
All checks were successful
Deploy to Production / deploy (push) Successful in 21s

This commit is contained in:
silverpro89
2026-01-28 11:21:21 +07:00
parent 57c45d27a3
commit 3791b7cae1
23 changed files with 1033 additions and 317 deletions

67
deploy.sh Normal file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
# Script tự động deploy và fix bcrypt trên server
# Usage: ./deploy.sh
SERVER="root@senaai.tech"
PROJECT_PATH="/var/www/services/sena_db_api"
echo "════════════════════════════════════════════════════════"
echo " 🚀 Auto Deploy & Fix Bcrypt Script"
echo " Server: $SERVER"
echo " Path: $PROJECT_PATH"
echo "════════════════════════════════════════════════════════"
echo ""
# Execute commands on remote server
ssh $SERVER << 'ENDSSH'
set -e # Exit on error
echo "📁 Navigating to project directory..."
cd /var/www/services/sena_db_api
echo ""
echo "🔧 Rebuilding bcrypt module..."
npm rebuild bcrypt --build-from-source
echo ""
echo "🔄 Rebuilding all native modules..."
npm rebuild
echo ""
echo "📂 Creating logs directory..."
mkdir -p logs
echo ""
echo "✅ Build completed successfully!"
echo ""
echo "════════════════════════════════════════════════════════"
echo " PM2 Status:"
echo "════════════════════════════════════════════════════════"
pm2 list
echo ""
echo "Do you want to restart PM2 processes? (y/n)"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo ""
echo "🔄 Restarting PM2 processes..."
pm2 restart all 2>/dev/null || pm2 start start.json
echo ""
echo "✅ PM2 processes restarted!"
echo ""
pm2 list
else
echo ""
echo "⏭️ Skipped PM2 restart"
fi
echo ""
echo "════════════════════════════════════════════════════════"
echo " ✅ Deployment completed!"
echo "════════════════════════════════════════════════════════"
ENDSSH
echo ""
echo "Done! Check the output above for any errors."