Fix container conflicts and environment variables
Some checks failed
CI/CD Pipeline (Fast) / production (push) Failing after 3m40s
CI/CD Pipeline (Zero Downtime) / production (push) Failing after 7m53s
CI/CD Pipeline (Simple) / production (push) Has been cancelled

- Add comprehensive container cleanup before starting services
- Pass environment variables to docker compose commands
- Fix container name conflicts by removing all existing containers first
- Add local test script to verify deployment process
- Ensure clean environment for zero-downtime deployments
This commit is contained in:
2025-09-13 20:59:01 +02:00
parent 58dd60ea64
commit 6338a34612
2 changed files with 52 additions and 0 deletions

View File

@@ -67,12 +67,28 @@ jobs:
CURRENT_CONTAINER_RUNNING=false
fi
# Clean up ALL existing containers first
echo "🧹 Cleaning up ALL existing containers..."
docker compose down --remove-orphans || true
docker rm -f portfolio-app portfolio-postgres portfolio-redis || true
# Ensure database and redis are running
echo "🔧 Ensuring database and redis are running..."
docker compose up -d postgres redis
# Wait for services to be ready
sleep 10
env:
NODE_ENV: ${{ vars.NODE_ENV }}
LOG_LEVEL: ${{ vars.LOG_LEVEL }}
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL }}
NEXT_PUBLIC_UMAMI_URL: ${{ vars.NEXT_PUBLIC_UMAMI_URL }}
NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${{ vars.NEXT_PUBLIC_UMAMI_WEBSITE_ID }}
MY_EMAIL: ${{ vars.MY_EMAIL }}
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
MY_INFO_PASSWORD: ${{ secrets.MY_INFO_PASSWORD }}
ADMIN_BASIC_AUTH: ${{ secrets.ADMIN_BASIC_AUTH }}
- name: Verify secrets and variables before deployment
run: |