From 175954ae67fa493012a0e9bc53da97ba482e7dae Mon Sep 17 00:00:00 2001 From: Stiftung Development Date: Tue, 9 Sep 2025 21:07:37 +0200 Subject: [PATCH] Fix deployment script issues - Use HTTPS git pull instead of SSH to avoid authentication issues - Fix docker-compose file path (copy from deploy-production/) - Use docker-compose with hyphen instead of 'docker compose' - Add -T flag to exec commands for non-interactive mode - Add container status check at the end - Improve error handling and logging --- .github/workflows/ci-cd.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ae30b69..87ba21f 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -189,8 +189,28 @@ jobs: key: ${{ secrets.PROD_SSH_KEY }} script: | cd /opt/stiftung - git pull origin main - docker compose -f docker-compose.prod.yml pull - docker compose -f docker-compose.prod.yml up -d - docker compose -f docker-compose.prod.yml exec web python manage.py migrate - docker compose -f docker-compose.prod.yml exec web python manage.py collectstatic --noinput + + # Pull latest changes (using HTTPS) + git pull https://github.com/remmerinio/stiftung-management-system.git main + + # Copy production docker compose file + cp deploy-production/docker-compose.prod.yml docker-compose.yml + + # Stop containers + docker-compose down + + # Start containers with rebuild + docker-compose up -d --build + + # Wait for containers to be ready + echo "Waiting for containers to start..." + sleep 30 + + # Run migrations + docker-compose exec -T web python manage.py migrate + + # Collect static files + docker-compose exec -T web python manage.py collectstatic --noinput + + # Show container status + docker-compose ps