Files
MoneyFlix/deploy-moneyflix.sh
T
1sonhador 16cfc1f7f0 feat: Add complete MoneyFlix documentation and CRM integration
- Added comprehensive documentation in docs/ folder
- Created MONEYFLIX_CLIENT_CONFIGURATION.md with complete client config
- Added DEPLOY_SCRIPTS_DOCUMENTATION.md with all deploy scripts
- Created docs/README.md as master documentation index
- Copied deploy scripts from CRM (deploy-moneyflix.sh, deploy-moneyflix-php.sh)
- Updated main README with complete documentation structure
- Added MoneyFlix-specific branding and module configurations
- Included troubleshooting guides and quick reference commands

This provides complete isolation with:
- All CRM-specific MoneyFlix configurations
- Complete deploy script documentation
- Client-specific branding and theme settings
- Module configuration and features
- Comprehensive troubleshooting guides
- Master documentation index for easy navigation
2025-10-03 12:27:20 +01:00

115 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# MoneyFlix Redirector Deploy Script
# Deploy apenas do código Node.js, sem mexer nas configurações
set -e # Exit on any error
REMOTE_HOST="94.23.75.89"
REMOTE_USER="root"
REMOTE_PATH="/data/wwwroot/redirect.moneyflix.com"
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "🚀 MoneyFlix Redirector Deploy Script"
echo "====================================="
echo "Remote Host: $REMOTE_HOST"
echo "Remote Path: $REMOTE_PATH"
echo "Project Root: $PROJECT_ROOT"
echo ""
cd "$PROJECT_ROOT"
# 1. Pre-deployment checks
echo "📋 Pre-deployment checks..."
if [ ! -f "projects/nodejs-redirector/package.json" ]; then
echo "❌ Node.js redirector not found!"
exit 1
fi
echo "✅ Pre-deployment checks passed"
echo ""
# 2. Build local assets (if needed)
echo "🏗️ Building local assets..."
npm run build
echo "✅ Local assets built"
echo ""
# 3. Deploy only Node.js redirector files
echo "📦 Deploying Node.js redirector..."
rsync -avz --delete \
--exclude='node_modules' \
--exclude='.git' \
--exclude='.env' \
--exclude='*.log' \
--exclude='storage/' \
--exclude='cache/' \
--exclude='vendor/' \
--exclude='projects/cdn/' \
--exclude='projects/standalone-reports/' \
--exclude='projects/betzoo-api/' \
--exclude='projects/wdmi-store/' \
--exclude='projects/script-builder/' \
--exclude='docs/' \
--exclude='tools/' \
--exclude='tests/' \
--exclude='template/' \
--exclude='*.sql' \
--exclude='*.md' \
--exclude='.DS_Store' \
projects/nodejs-redirector/ \
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH/"
echo "✅ Node.js redirector deployed"
echo ""
# 4. Install dependencies on server
echo "📦 Installing dependencies on server..."
ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH && npm install --production"
echo "✅ Dependencies installed"
echo ""
# 5. Restart PM2 process
echo "🔄 Restarting MoneyFlix redirector..."
ssh "$REMOTE_USER@$REMOTE_HOST" "pm2 restart moneyflix-redirector"
echo "✅ MoneyFlix redirector restarted"
echo ""
# 6. Verify deployment
echo "🔍 Verifying deployment..."
sleep 3
# Test health endpoint
HEALTH_RESPONSE=$(curl -s "http://redirect.moneyflix.com/health" || echo "FAILED")
if [[ "$HEALTH_RESPONSE" == *"healthy"* ]]; then
echo "✅ Health check passed"
else
echo "❌ Health check failed: $HEALTH_RESPONSE"
exit 1
fi
# Test status endpoint
STATUS_RESPONSE=$(curl -s "http://redirect.moneyflix.com/status" || echo "FAILED")
if [[ "$STATUS_RESPONSE" == *"status"* ]]; then
echo "✅ Status check passed"
else
echo "❌ Status check failed: $STATUS_RESPONSE"
exit 1
fi
echo ""
echo "🎉 MoneyFlix redirector deployed successfully!"
echo ""
echo "📊 Service Status:"
echo " Health: http://redirect.moneyflix.com/health"
echo " Status: http://redirect.moneyflix.com/status"
echo " Redirects: http://redirect.moneyflix.com/r/[slug]"
echo ""
echo "🔧 PM2 Commands:"
echo " pm2 logs moneyflix-redirector # View logs"
echo " pm2 restart moneyflix-redirector # Restart service"
echo " pm2 status # Check status"
echo ""