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
This commit is contained in:
Stiftung Development
2025-09-09 21:07:37 +02:00
parent b3dd80650e
commit 175954ae67

View File

@@ -189,8 +189,28 @@ jobs:
key: ${{ secrets.PROD_SSH_KEY }} key: ${{ secrets.PROD_SSH_KEY }}
script: | script: |
cd /opt/stiftung cd /opt/stiftung
git pull origin main
docker compose -f docker-compose.prod.yml pull # Pull latest changes (using HTTPS)
docker compose -f docker-compose.prod.yml up -d git pull https://github.com/remmerinio/stiftung-management-system.git main
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 # 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