This commit is contained in:
@@ -55,7 +55,7 @@ jobs:
|
|||||||
- name: Setup SSH
|
- name: Setup SSH
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
printf "%s\n" "${{ secrets.ALPHA_SSH_KEY }}" > ~/.ssh/id_ed25519
|
echo "${{ secrets.ALPHA_SSH_KEY }}" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
ssh-keyscan -H alpha.mintel.me >> ~/.ssh/known_hosts
|
ssh-keyscan -H alpha.mintel.me >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
@@ -77,57 +77,45 @@ jobs:
|
|||||||
REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }}
|
REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }}
|
||||||
run: |
|
run: |
|
||||||
echo "Starting deployment on server..."
|
echo "Starting deployment on server..."
|
||||||
|
|
||||||
|
# Execute deployment commands directly with proper error handling
|
||||||
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o IPQoS=0x00 deploy@alpha.mintel.me "
|
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o IPQoS=0x00 deploy@alpha.mintel.me "
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo '=== Logging in to registry on server ==='
|
echo '=== Starting deployment ==='
|
||||||
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 ''
|
echo '=== Logging into Docker registry ==='
|
||||||
echo '=== Checking current container status ==='
|
echo '${{ secrets.REGISTRY_PASS }}' | docker login registry.infra.mintel.me -u '${{ secrets.REGISTRY_USER }}' --password-stdin
|
||||||
docker compose ps app || echo 'No running containers found'
|
echo '✓ Registry login successful'
|
||||||
|
|
||||||
echo ''
|
echo '=== Checking current containers ==='
|
||||||
echo '=== Checking current image ==='
|
docker compose ps
|
||||||
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 ''
|
|
||||||
echo '=== Pulling latest image ==='
|
echo '=== Pulling latest image ==='
|
||||||
docker compose pull app
|
docker compose pull app
|
||||||
echo 'Image pull completed'
|
echo '✓ Image pulled successfully'
|
||||||
|
|
||||||
echo ''
|
echo '=== Verifying new image ==='
|
||||||
echo '=== Checking pulled image ==='
|
docker images registry.infra.mintel.me/mintel/mb-grid-solutions:latest
|
||||||
docker images registry.infra.mintel.me/mintel/mb-grid-solutions:latest --format 'table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedSince}}'
|
|
||||||
|
echo '=== Stopping and recreating containers ==='
|
||||||
echo ''
|
|
||||||
echo '=== Force recreating and restarting app container ==='
|
|
||||||
docker compose up -d --force-recreate app
|
docker compose up -d --force-recreate app
|
||||||
|
echo '✓ Containers recreated'
|
||||||
echo ''
|
|
||||||
echo '=== Waiting for container to be healthy (10 seconds) ==='
|
echo '=== Waiting for health check (15 seconds) ==='
|
||||||
sleep 10
|
sleep 15
|
||||||
|
|
||||||
echo ''
|
echo '=== Verifying deployment ==='
|
||||||
echo '=== Checking container status after deployment ==='
|
|
||||||
docker compose ps app
|
docker compose ps app
|
||||||
|
|
||||||
echo ''
|
echo '=== Checking container logs ==='
|
||||||
echo '=== Checking container logs (last 30 lines) ==='
|
docker compose logs --tail=20 app
|
||||||
docker compose logs --tail=30 app
|
|
||||||
|
echo '=== Cleaning up old images ==='
|
||||||
echo ''
|
|
||||||
echo '=== Pruning old images (keep last 24h) ==='
|
|
||||||
docker image prune -f --filter 'until=24h'
|
docker image prune -f --filter 'until=24h'
|
||||||
|
|
||||||
echo ''
|
|
||||||
echo '=== Final status check ==='
|
|
||||||
docker compose ps app
|
|
||||||
|
|
||||||
echo ''
|
|
||||||
echo '=== Deployment completed successfully ==='
|
echo '=== Deployment completed successfully ==='
|
||||||
"
|
"
|
||||||
echo "Deployment process finished"
|
|
||||||
|
echo "Deployment completed"
|
||||||
Reference in New Issue
Block a user