Skip to content

Latest commit

 

History

History
281 lines (212 loc) · 7.25 KB

File metadata and controls

281 lines (212 loc) · 7.25 KB

ICC Rule Engine - Multi-Environment Deployment Guide

Overview

Your render.yaml has been updated to support 3 environments with separate DATABASE_URLs and configurations:

  1. Production (icc-rule-engine-prod)
  2. Staging (icc-rule-engine-staging)
  3. Development (icc-rule-engine-dev)

Environment Configuration

🚀 Production Environment

  • Service Name: icc-rule-engine-prod
  • Worker Name: icc-rule-engine-worker-prod
  • Environment: production
  • Demo Mode: false
  • Auto Deploy: true
  • Metrics: enabled
  • Database: Production PostgreSQL (separate DATABASE_URL)
  • Redis: Production Redis (separate REDIS_URL)

🧪 Staging Environment

  • Service Name: icc-rule-engine-staging
  • Worker Name: icc-rule-engine-worker-staging
  • Environment: staging
  • Demo Mode: false
  • Auto Deploy: false (manual deployment)
  • Metrics: enabled
  • Database: Staging PostgreSQL (separate DATABASE_URL)
  • Redis: Staging Redis (separate REDIS_URL)

🛠️ Development Environment

  • Service Name: icc-rule-engine-dev
  • Worker Name: icc-rule-engine-worker-dev
  • Environment: development
  • Demo Mode: true
  • Auto Deploy: false (manual deployment)
  • Metrics: disabled
  • Database: Development PostgreSQL (separate DATABASE_URL)
  • Redis: Development Redis (separate REDIS_URL)

Database Configuration

Each environment will have its own separate database:

Production Database

DATABASE_URL: postgresql://user:pass@prod-host:5432/icc_rules_prod?sslmode=require

Staging Database

DATABASE_URL: postgresql://user:pass@staging-host:5432/icc_rules_staging?sslmode=require

Development Database

DATABASE_URL: postgresql://user:pass@dev-host:5432/icc_rules_dev?sslmode=require

Redis Configuration

Each environment will have its own separate Redis instance:

Production Redis

REDIS_URL: redis://user:pass@prod-redis-host:6379/0

Staging Redis

REDIS_URL: redis://user:pass@staging-redis-host:6379/0

Development Redis

REDIS_URL: redis://user:pass@dev-redis-host:6379/0

Deployment Steps

1. Deploy to Render

# Deploy all environments
render deploy

# Or deploy specific environment
render deploy --service icc-rule-engine-prod
render deploy --service icc-rule-engine-staging
render deploy --service icc-rule-engine-dev

2. Configure Environment Variables

For each service, set the following environment variables in the Render dashboard:

Production Environment Variables:

  • DATABASE_URL - Production PostgreSQL URL
  • REDIS_URL - Production Redis URL
  • JWT_SECRET - Production JWT secret
  • API_KEY_SECRET - Production API key secret
  • STRIPE_API_KEY - Production Stripe API key
  • STRIPE_WEBHOOK_SECRET - Production Stripe webhook secret

Staging Environment Variables:

  • DATABASE_URL - Staging PostgreSQL URL
  • REDIS_URL - Staging Redis URL
  • JWT_SECRET - Staging JWT secret
  • API_KEY_SECRET - Staging API key secret
  • STRIPE_API_KEY - Staging Stripe API key
  • STRIPE_WEBHOOK_SECRET - Staging Stripe webhook secret

Development Environment Variables:

  • DATABASE_URL - Development PostgreSQL URL
  • REDIS_URL - Development Redis URL
  • JWT_SECRET - Development JWT secret
  • API_KEY_SECRET - Development API key secret

3. Database Setup

For each environment, you'll need to:

  1. Create PostgreSQL databases:

    • icc_rules_prod (Production)
    • icc_rules_staging (Staging)
    • icc_rules_dev (Development)
  2. Run migrations:

    # For each environment
    alembic upgrade head
  3. Seed data (if needed):

    # For each environment
    python scripts/seed_data.py

4. Redis Setup

For each environment, you'll need to:

  1. Create Redis instances:

    • Production Redis
    • Staging Redis
    • Development Redis
  2. Configure Redis settings:

    • Memory limits
    • Persistence settings
    • Security settings

Environment URLs

After deployment, your services will be available at:

  • Production: https://icc-rule-engine-prod.onrender.com
  • Staging: https://icc-rule-engine-staging.onrender.com
  • Development: https://icc-rule-engine-dev.onrender.com

Health Checks

Each environment has health check endpoints:

  • Production: https://icc-rule-engine-prod.onrender.com/health
  • Staging: https://icc-rule-engine-staging.onrender.com/health
  • Development: https://icc-rule-engine-dev.onrender.com/health

Monitoring & Logs

Production Monitoring:

  • Metrics: Enabled
  • Telemetry: Full telemetry pipeline
  • Logging: Structured logging
  • Monitoring: Full monitoring stack

Staging Monitoring:

  • Metrics: Enabled
  • Telemetry: Limited telemetry
  • Logging: Structured logging
  • Monitoring: Basic monitoring

Development Monitoring:

  • Metrics: Disabled
  • Telemetry: Disabled
  • Logging: Basic logging
  • Monitoring: Minimal monitoring

Security Considerations

Production Security:

  • HTTPS Only: All traffic encrypted
  • Secure Secrets: Strong JWT and API secrets
  • Database Security: SSL required
  • Redis Security: Authentication enabled

Staging Security:

  • HTTPS Only: All traffic encrypted
  • Secure Secrets: Strong JWT and API secrets
  • Database Security: SSL required
  • Redis Security: Authentication enabled

Development Security:

  • HTTPS Only: All traffic encrypted
  • Basic Secrets: Development JWT and API secrets
  • Database Security: SSL required
  • Redis Security: Basic authentication

Cost Optimization

Production:

  • Plan: Starter (can upgrade to Standard/Pro as needed)
  • Auto Deploy: Enabled
  • Always On: Yes

Staging:

  • Plan: Starter
  • Auto Deploy: Disabled (manual deployment)
  • Always On: Yes (for testing)

Development:

  • Plan: Starter
  • Auto Deploy: Disabled (manual deployment)
  • Always On: No (can be paused when not in use)

Troubleshooting

Common Issues:

  1. Database Connection Issues:

    • Verify DATABASE_URL is correct
    • Check database credentials
    • Ensure SSL is properly configured
  2. Redis Connection Issues:

    • Verify REDIS_URL is correct
    • Check Redis credentials
    • Ensure Redis is accessible
  3. Environment Variable Issues:

    • Check all required variables are set
    • Verify variable values are correct
    • Check for typos in variable names
  4. Deployment Issues:

    • Check build logs
    • Verify dependencies are installed
    • Check for build errors

Debug Commands:

# Check service status
render services list

# Check service logs
render logs --service icc-rule-engine-prod

# Check service environment
render env list --service icc-rule-engine-prod

Next Steps

  1. Deploy the services using the render.yaml configuration
  2. Set up databases for each environment
  3. Configure Redis for each environment
  4. Set environment variables for each service
  5. Test each environment using the health check endpoints
  6. Monitor the services using Render's dashboard

Created: October 13, 2025
Updated: render.yaml with multi-environment support
Status: Ready for deployment