- 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
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/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!" |