- Changed staging app port from 3001 to 3002 in docker-compose.staging.yml - Updated PostgreSQL port from 5433 to 5434 and Redis port from 6380 to 6381 - Modified STAGING_SETUP.md to reflect new port configurations - Adjusted CI/CD workflows to accommodate new staging ports and improve deployment messages - Added N8N environment variables to staging configuration for better integration
115 lines
3.3 KiB
YAML
115 lines
3.3 KiB
YAML
# Staging Docker Compose configuration
|
|
# Deploys automatically on dev/main branch
|
|
# Uses different ports and container names to avoid conflicts with production
|
|
|
|
services:
|
|
portfolio-staging:
|
|
image: portfolio-app:staging
|
|
container_name: portfolio-app-staging
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3002:3000" # Different port from production (3000) - using 3002 to avoid conflicts
|
|
environment:
|
|
- NODE_ENV=staging
|
|
- DATABASE_URL=postgresql://portfolio_user:portfolio_staging_pass@postgres-staging:5432/portfolio_staging_db?schema=public
|
|
- REDIS_URL=redis://redis-staging:6379
|
|
- NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL:-https://staging.dk0.dev}
|
|
- MY_EMAIL=${MY_EMAIL:-contact@dk0.dev}
|
|
- MY_INFO_EMAIL=${MY_INFO_EMAIL:-info@dk0.dev}
|
|
- MY_PASSWORD=${MY_PASSWORD}
|
|
- MY_INFO_PASSWORD=${MY_INFO_PASSWORD}
|
|
- ADMIN_BASIC_AUTH=${ADMIN_BASIC_AUTH:-admin:staging_password}
|
|
- LOG_LEVEL=debug
|
|
- N8N_WEBHOOK_URL=${N8N_WEBHOOK_URL:-}
|
|
- N8N_SECRET_TOKEN=${N8N_SECRET_TOKEN:-}
|
|
volumes:
|
|
- portfolio_staging_data:/app/.next/cache
|
|
networks:
|
|
- portfolio_staging_net
|
|
depends_on:
|
|
postgres-staging:
|
|
condition: service_healthy
|
|
redis-staging:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '0.5'
|
|
reservations:
|
|
memory: 256M
|
|
cpus: '0.25'
|
|
|
|
postgres-staging:
|
|
image: postgres:16-alpine
|
|
container_name: portfolio-postgres-staging
|
|
restart: unless-stopped
|
|
environment:
|
|
- POSTGRES_DB=portfolio_staging_db
|
|
- POSTGRES_USER=portfolio_user
|
|
- POSTGRES_PASSWORD=portfolio_staging_pass
|
|
volumes:
|
|
- postgres_staging_data:/var/lib/postgresql/data
|
|
networks:
|
|
- portfolio_staging_net
|
|
ports:
|
|
- "5434:5432" # Different port from production (5432) - using 5434 to avoid conflicts
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U portfolio_user -d portfolio_staging_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
cpus: '0.25'
|
|
reservations:
|
|
memory: 128M
|
|
cpus: '0.1'
|
|
|
|
redis-staging:
|
|
image: redis:7-alpine
|
|
container_name: portfolio-redis-staging
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes --maxmemory 128mb --maxmemory-policy allkeys-lru
|
|
volumes:
|
|
- redis_staging_data:/data
|
|
networks:
|
|
- portfolio_staging_net
|
|
ports:
|
|
- "6381:6379" # Different port from production (6379) - using 6381 to avoid conflicts
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 128M
|
|
cpus: '0.25'
|
|
reservations:
|
|
memory: 64M
|
|
cpus: '0.1'
|
|
|
|
volumes:
|
|
portfolio_staging_data:
|
|
driver: local
|
|
postgres_staging_data:
|
|
driver: local
|
|
redis_staging_data:
|
|
driver: local
|
|
|
|
networks:
|
|
portfolio_staging_net:
|
|
driver: bridge
|