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

36
test-deployment.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# Test script for deployment issues
echo "🧪 Testing deployment locally..."
# Set test environment variables
export NODE_ENV=production
export LOG_LEVEL=info
export NEXT_PUBLIC_BASE_URL=https://dk0.dev
export NEXT_PUBLIC_UMAMI_URL=https://analytics.dk0.dev
export NEXT_PUBLIC_UMAMI_WEBSITE_ID=b3665829-927a-4ada-b9bb-fcf24171061e
export MY_EMAIL=contact@dk0.dev
export MY_INFO_EMAIL=info@dk0.dev
export MY_PASSWORD=test_password
export MY_INFO_PASSWORD=test_info_password
export ADMIN_BASIC_AUTH=admin:test_password
echo "🔧 Environment variables set:"
echo "NODE_ENV: $NODE_ENV"
echo "NEXT_PUBLIC_BASE_URL: $NEXT_PUBLIC_BASE_URL"
echo "MY_EMAIL: $MY_EMAIL"
echo "🧹 Cleaning up existing containers..."
docker compose down --remove-orphans || true
docker rm -f portfolio-app portfolio-postgres portfolio-redis || true
echo "🔧 Starting database and redis..."
docker compose up -d postgres redis
echo "⏳ Waiting for services to be ready..."
sleep 10
echo "📋 Checking running containers:"
docker ps --format "table {{.Names}}\t{{.Status}}"
echo "✅ Test completed!"