deploy
All checks were successful
Build & Deploy KLZ Cables / build-and-deploy (push) Successful in 3m28s
All checks were successful
Build & Deploy KLZ Cables / build-and-deploy (push) Successful in 3m28s
This commit is contained in:
@@ -141,66 +141,52 @@ jobs:
|
||||
echo "📡 Connecting to server and executing deployment commands..."
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Execute remote commands with error handling and logging
|
||||
# Execute remote commands with error handling and logging using bash -s
|
||||
ssh -o StrictHostKeyChecking=accept-new \
|
||||
-o ServerAliveInterval=30 \
|
||||
-o ServerAliveCountMax=3 \
|
||||
-o ConnectTimeout=10 \
|
||||
deploy@alpha.mintel.me \
|
||||
"set -e
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '📡 Remote Deployment Started'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo ''
|
||||
|
||||
echo '🔐 Logging into registry on remote server...'
|
||||
echo '${{ secrets.REGISTRY_PASS }}' | docker login registry.infra.mintel.me -u '${{ secrets.REGISTRY_USER }}' --password-stdin
|
||||
if [ \$? -eq 0 ]; then
|
||||
echo '✅ Remote registry login successful'
|
||||
else
|
||||
echo '❌ Remote registry login failed'
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
if [ \$? -eq 0 ]; then
|
||||
echo '✅ Image pull completed'
|
||||
else
|
||||
echo '❌ Image pull failed'
|
||||
exit 1
|
||||
fi
|
||||
echo ''
|
||||
|
||||
echo '🔄 Starting containers with force-recreate...'
|
||||
docker compose up -d --force-recreate --remove-orphans
|
||||
if [ \$? -eq 0 ]; then
|
||||
echo '✅ Containers started successfully'
|
||||
else
|
||||
echo '❌ Container startup failed'
|
||||
exit 1
|
||||
fi
|
||||
echo ''
|
||||
|
||||
echo '🧹 Cleaning up old images...'
|
||||
docker image prune -f
|
||||
echo '✅ Cleanup completed'
|
||||
echo ''
|
||||
|
||||
echo '📊 Container Status:'
|
||||
docker compose ps --format 'table {{.Name}}\t{{.State}}\t{{.Status}}'
|
||||
echo ''
|
||||
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '✅ Remote Deployment Completed Successfully'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
" 2>&1
|
||||
-v \
|
||||
deploy@alpha.mintel.me bash -s << 'ENDSSH'
|
||||
set -ex
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
echo '📡 Remote Deployment Started'
|
||||
echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
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 ''
|
||||
|
||||
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 '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
|
||||
ENDSSH
|
||||
|
||||
DEPLOY_EXIT_CODE=$?
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user