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:
30
.github/workflows/ci-cd.yml
vendored
30
.github/workflows/ci-cd.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user