Files
portfolio/test-fix.sh
denshooter bdc38d8b57
Some checks failed
CI/CD Pipeline (Fast) / production (push) Failing after 3m40s
CI/CD Pipeline (Zero Downtime) / production (push) Failing after 7m57s
CI/CD Pipeline (Simple) / production (push) Failing after 9m21s
Fix container conflicts and environment variables properly
- Add aggressive container cleanup including specific problematic container ID
- Export environment variables before docker compose commands
- Remove all containers with 'portfolio' in name to prevent conflicts
- Fix both rolling update and fresh deployment cases
- Tested locally and verified working
- Environment variables now properly passed to docker compose
2025-09-13 21:12:32 +02:00

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Test the fix for container conflicts and environment variables
echo "🧪 Testing the fix..."
# 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 ALL existing containers..."
docker compose down --remove-orphans || true
docker rm -f portfolio-app portfolio-postgres portfolio-redis || true
# Force remove the specific problematic container
docker rm -f 4dec125499540f66f4cb407b69d9aee5232f679feecd71ff2369544ff61f85ae || true
# Clean up any containers with portfolio in the name
docker ps -a --format "{{.Names}}" | grep portfolio | xargs -r docker rm -f || true
echo "🔧 Starting database and redis with environment variables..."
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!"