deploy
All checks were successful
Build & Deploy / deploy (push) Successful in 30s

This commit is contained in:
2026-01-21 12:54:00 +01:00
parent 8ca85c9530
commit d1c26efea8
2 changed files with 34 additions and 26 deletions

View File

@@ -64,7 +64,6 @@ jobs:
run: |
echo "Starting file sync to server..."
echo "Syncing docker-compose.yaml to alpha.mintel.me..."
# Use tar to bundle files and send them via SSH in a single connection
tar czf - docker-compose.yaml | \
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o IPQoS=0x00 deploy@alpha.mintel.me \
"mkdir -p /home/deploy/sites/mb-grid-solutions.com/ && tar xzf - -C /home/deploy/sites/mb-grid-solutions.com/ && echo 'Files synced successfully' && ls -la /home/deploy/sites/mb-grid-solutions.com/"
@@ -81,53 +80,60 @@ jobs:
set -e
echo '=== Logging in to registry on server ==='
echo '$REGISTRY_PASS' | docker login registry.infra.mintel.me -u '$REGISTRY_USER' --password-stdin
echo \"\$REGISTRY_PASS\" | docker login registry.infra.mintel.me -u \"\$REGISTRY_USER\" --password-stdin
echo 'Registry login successful'
cd /home/deploy/sites/mb-grid-solutions.com
cd /home/deploy/sites/mb-grid-solutions.com || { echo 'Directory not found!'; exit 1; }
echo ''
echo '=== Checking current container status ==='
docker compose ps app || echo 'No running containers found'
echo '=== Current status before deploy ==='
docker compose ps -a || true
echo ''
echo '=== Checking current image ==='
docker images registry.infra.mintel.me/mintel/mb-grid-solutions:latest --format 'table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedSince}}' || echo 'No local image found'
echo '=== Current local image ==='
docker images registry.infra.mintel.me/mintel/mb-grid-solutions:latest --format 'table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedSince}}' || echo 'No image found'
echo ''
echo '=== Pulling latest image ==='
docker compose pull app
echo 'Image pull completed'
echo '=== Pulling latest image (force) ==='
docker compose pull app || { echo 'Pull failed!'; exit 1; }
echo ''
echo '=== Checking pulled image ==='
docker images registry.infra.mintel.me/mintel/mb-grid-solutions:latest --format 'table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedSince}}'
echo '=== Stopping and removing old containers ==='
docker compose down app --remove-orphans || true
docker compose rm -f app || true
echo ''
echo '=== Starting app container with new image (zero-downtime) ==='
docker compose up -d --pull always --force-recreate --no-build app
echo '=== Starting services with force-recreate and no-build ==='
docker compose up -d --pull always --force-recreate --no-build --no-deps app
echo ''
echo '=== Waiting for container to be healthy (10 seconds) ==='
sleep 10
echo '=== Waiting for containers to become healthy (max 30s) ==='
for i in {1..6}; do
echo \"Attempt \$i/6...\"
if docker compose ps --format '{{.Status}}' | grep -q 'healthy'; then
echo 'All containers healthy!'
break
fi
sleep 5
done
echo ''
echo '=== Checking container status after deployment ==='
docker compose ps app
echo '=== Final status ==='
docker compose ps -a
echo ''
echo '=== Checking container logs (last 30 lines) ==='
docker compose logs --tail=30 app
echo '=== Image now in use ==='
docker compose ps --format '{{.Name}}\t{{.Image}}\t{{.Status}}'
echo ''
echo '=== Pruning old images (keep last 24h) ==='
docker image prune -f --filter 'until=24h'
echo '=== Last 40 lines of logs ==='
docker compose logs --tail=40 app || true
echo ''
echo '=== Final status check ==='
docker compose ps app
echo '=== Pruning dangling & old images (keep last 24h) ==='
docker image prune -f --filter 'until=24h' || true
echo ''
echo '=== Deployment completed successfully ==='
echo '=== Deployment completed ==='
"
echo "Deployment process finished"

View File

@@ -15,9 +15,11 @@ services:
interval: 5s
timeout: 2s
retries: 10
deploy:
replicas: 2
networks:
- infra
networks:
infra:
external: true
external: true