This commit is contained in:
@@ -140,59 +140,50 @@ jobs:
|
||||
# Execute deployment commands with detailed logging
|
||||
echo "📡 Connecting to server and executing deployment commands..."
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
echo "🔍 DEBUG: Testing SSH connection first..."
|
||||
ssh -o StrictHostKeyChecking=accept-new deploy@alpha.mintel.me 'echo "SSH connection test successful"; whoami; pwd'
|
||||
echo ""
|
||||
|
||||
# Create deployment script
|
||||
cat > /tmp/deploy.sh << 'DEPLOYEOF'
|
||||
set -ex
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '📡 Remote Deployment Started'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo ''
|
||||
|
||||
echo '🔐 Logging into registry on remote server...'
|
||||
echo 'REGISTRY_PASS_PLACEHOLDER' | docker login registry.infra.mintel.me -u 'REGISTRY_USER_PLACEHOLDER' --password-stdin
|
||||
echo '✅ Remote registry login completed'
|
||||
echo ''
|
||||
|
||||
echo '📂 Changing to deployment directory...'
|
||||
cd /home/deploy/sites/klz-cables.com
|
||||
echo "✅ Current directory: $(pwd)"
|
||||
echo ''
|
||||
|
||||
echo '📥 Pulling latest images...'
|
||||
docker compose pull
|
||||
echo '✅ Image pull completed'
|
||||
echo ''
|
||||
|
||||
echo '🔄 Starting containers with force-recreate...'
|
||||
docker compose up -d --force-recreate --remove-orphans
|
||||
echo '✅ Containers started'
|
||||
echo ''
|
||||
|
||||
echo '🧹 Cleaning up old images...'
|
||||
docker image prune -f
|
||||
echo '✅ Cleanup completed'
|
||||
echo ''
|
||||
|
||||
echo '📊 Container Status:'
|
||||
docker compose ps
|
||||
echo ''
|
||||
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '✅ Remote Deployment Completed Successfully'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
DEPLOYEOF
|
||||
|
||||
# Replace placeholders with actual secrets
|
||||
sed -i "s/REGISTRY_USER_PLACEHOLDER/${{ secrets.REGISTRY_USER }}/g" /tmp/deploy.sh
|
||||
sed -i "s/REGISTRY_PASS_PLACEHOLDER/${{ secrets.REGISTRY_PASS }}/g" /tmp/deploy.sh
|
||||
|
||||
# Execute remote commands
|
||||
echo "🔍 DEBUG: Executing deployment commands..."
|
||||
ssh -o StrictHostKeyChecking=accept-new \
|
||||
-o ServerAliveInterval=30 \
|
||||
-o ServerAliveCountMax=3 \
|
||||
-o ConnectTimeout=10 \
|
||||
deploy@alpha.mintel.me 'bash -s' < /tmp/deploy.sh
|
||||
-T \
|
||||
deploy@alpha.mintel.me << EOF
|
||||
set -ex
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '📡 Remote Deployment Started'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
|
||||
echo '🔐 Logging into registry on remote server...'
|
||||
echo '${{ secrets.REGISTRY_PASS }}' | docker login registry.infra.mintel.me -u '${{ secrets.REGISTRY_USER }}' --password-stdin
|
||||
echo '✅ Remote registry login completed'
|
||||
|
||||
echo '📂 Changing to deployment directory...'
|
||||
cd /home/deploy/sites/klz-cables.com
|
||||
echo "✅ Current directory: \$(pwd)"
|
||||
|
||||
echo '📥 Pulling latest images...'
|
||||
docker compose pull
|
||||
echo '✅ Image pull completed'
|
||||
|
||||
echo '🔄 Starting containers with force-recreate...'
|
||||
docker compose up -d --force-recreate --remove-orphans
|
||||
echo '✅ Containers started'
|
||||
|
||||
echo '🧹 Cleaning up old images...'
|
||||
docker image prune -f
|
||||
echo '✅ Cleanup completed'
|
||||
|
||||
echo '📊 Container Status:'
|
||||
docker compose ps
|
||||
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '✅ Remote Deployment Completed Successfully'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
EOF
|
||||
|
||||
DEPLOY_EXIT_CODE=$?
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user