Skip to main content

Environment Deployment Workflows

Learn proven workflows for safely deploying changes from development to production using KnoxCall environments.

Standard Three-Tier Workflow

This is the most common deployment pattern used by successful teams.

Workflow Overview

How KnoxCall Makes This Easy

With KnoxCall, you don’t need to change code or redeploy your client applications to switch environments. Traditional approach:
With KnoxCall:
Same code, different backend via header!

Deployment Process

Step 1: Develop in Development

What: Make code changes and test locally KnoxCall setup:
  • Environment: development
  • Target URL: http://localhost:3000
  • Secrets: Dev API keys
  • Clients: Your laptop IP
  • Rate limits: Unlimited
Test your changes:
Routes to: http://localhost:3000/api/users Iterate quickly:
  • Make changes to local backend
  • Test immediately
  • No deployment needed

Step 2: Promote to Staging

What: Deploy backend to staging server, run full QA KnoxCall setup:
  • Environment: staging
  • Target URL: https://staging-api.yourcompany.com
  • Secrets: Staging API keys
  • Clients: Staging server IPs, QA team IPs
  • Rate limits: Moderate (1000/min)
Deploy backend:
Test with staging environment:
Routes to: https://staging-api.yourcompany.com/api/users Staging checklist:
  • All unit tests pass
  • Integration tests pass
  • Manual QA completed
  • Performance acceptable
  • Security scan passed
  • No critical bugs
  • Stakeholder approval

Step 3: Deploy to Production

What: Deploy to live environment after thorough testing KnoxCall setup:
  • Environment: production (base environment)
  • Target URL: https://api.yourcompany.com
  • Secrets: Production API keys
  • Clients: Production server IPs only
  • Rate limits: Strict (100/min)
Deploy backend:
Production requests (no environment header needed):
Routes to: https://api.yourcompany.com/api/users (default/base environment) Post-deployment monitoring:
  • Monitor error rates in KnoxCall dashboard
  • Check response times
  • Watch for spike in 5xx errors
  • Verify no increase in failed requests
  • Monitor user reports/support tickets

Environment-Specific Configuration

Different Rate Limits Per Environment

Development: Relaxed for testing
Staging: Moderate limits
Production: Strict protection
Configure in KnoxCall:
  1. Edit route
  2. Go to Environment tab
  3. Set different rate_limit_requests and rate_limit_window_sec per environment

Different Secrets Per Environment

Use environment-specific secrets for security: Development route override:
Staging route override:
Production (base route):
Now each environment uses its own Stripe key automatically!

Different Monitoring Thresholds

Development: No alerts (expect errors during development) Staging: Warning-level alerts
  • Alert if error rate > 20%
  • Alert if P95 latency > 5 seconds
  • Send to Slack #staging-alerts channel
Production: Critical alerts
  • Alert if error rate > 5%
  • Alert if P95 latency > 1 second
  • Send to PagerDuty for on-call rotation
  • Send to Slack #production-alerts channel
Configure in KnoxCall:
  1. Navigate to Alerts
  2. Create alert rules with environment filters
  3. Set different thresholds per environment
  4. Configure notification channels

Rollback Strategy

If production deployment fails, you can roll back instantly without code changes.

Quick Rollback via Environment Override

Scenario: New backend version (v2) has critical bug Option 1: Point production to old backend
  1. Edit route → Environment tab
  2. Add override for “production” environment
  3. Set target URL to old backend:
  4. Save
Traffic instantly goes to old backend. No code changes needed! Option 2: Switch production to use staging Temporarily point production traffic to staging backend:
  1. Edit route → Environment tab
  2. Override production target URL:
  3. Save
This buys time to fix the bug while serving from last known good version.

Full Rollback Workflow

Advanced Deployment Patterns

Feature Branch Environments

For large features, create temporary environments: Example: New payment system
  1. Create environment: feature-payment-v2
  2. Configure route override:
    • Target URL: https://payment-v2-api.yourcompany.com
    • Secrets: payment_v2_api_key
  3. Test feature branch in isolation
  4. After merge: Delete feature-payment-v2 environment
Benefits:
  • Test big changes safely
  • Don’t interfere with staging
  • Easy cleanup after merge

Canary Deployments

Gradually roll out to production: Phase 1: Internal testing (5% of traffic)
Phase 2: Beta users (20% of traffic)
Phase 3: Full rollout (100% of traffic)

Blue-Green Deployments

Run two identical production environments: Blue (current production):
Green (new version):
Switch traffic: Update base route to point to green Instant rollback: Switch back to blue if issues

Regional Environments

For global applications, route by region:
Client application determines region and sets environment header accordingly. Benefits:
  • Data sovereignty compliance
  • Reduced latency (users hit closest region)
  • Region-specific deployments
  • Isolated failures (one region down doesn’t affect others)

Monitoring Across Environments

Compare Metrics Dashboard

Create a dashboard showing all environments side-by-side: In KnoxCall:
  1. Navigate to Analytics
  2. Group by “Environment”
  3. Compare metrics across environments
  4. Spot differences between staging and production

Environment Health Dashboard

Monitor the overall health of each environment:

Troubleshooting Deployment Issues

Changes Not Showing in Staging

Symptoms: Made changes, but staging still shows old behavior Possible causes:
  1. Backend not deployed yet
  2. Wrong environment header in request
  3. Caching (client-side or CDN)
  4. Environment override not configured
Debug steps:

Different Behavior Between Environments

Symptoms: Works in staging, fails in production Possible causes:
  1. Different secrets (dev keys vs prod keys)
  2. Different backend code versions
  3. Different environment variables
  4. Different database state
  5. Different rate limits causing throttling
Debug checklist:
  • Compare route configurations (base vs overrides)
  • Verify secrets are environment-specific
  • Check backend versions match
  • Compare environment variables
  • Review rate limit settings
  • Check database schema versions

Pre-Deployment Checklist

Before each production deployment, complete this checklist:

Pre-Deployment

  • All tests passing in staging
  • Stakeholder approval received
  • Rollback plan documented
  • Team notified in Slack
  • Monitoring dashboard ready
  • On-call engineer identified
  • Database migrations tested (if any)
  • Feature flags configured (if applicable)

During Deployment

  • Deploy backend to production
  • Verify health endpoint responds
  • Test critical user flows manually
  • Monitor error rates in real-time
  • Check latency metrics
  • Review first 100 production requests

Post-Deployment

  • Monitor for 30 minutes
  • Review error logs (should be stable)
  • Check analytics (traffic patterns normal)
  • Verify zero increase in support tickets
  • Update team status: “Deployment successful”
  • Update documentation (if needed)
  • Mark deployment as stable in tracking system

Best Practices Summary

Do:
  • Always test in development first
  • Require QA approval for staging → production
  • Set production as default environment
  • Use different API keys per environment
  • Monitor each environment separately
  • Document rollback procedures
  • Keep staging close to production config
  • Run load tests in staging
Don’t:
  • Deploy directly to production without staging
  • Use production API keys in development
  • Skip the staging environment (“it’s just a small change”)
  • Forget to monitor after deployment
  • Make manual changes directly in production
  • Test in production (use staging!)

Next Steps

Now that you understand deployment workflows:

Alert Configuration

Set up environment-specific alerts

Secret Management

Manage secrets per environment

Rate Limiting

Configure limits per environment

Audit Logs

Track configuration changes
  • Base Route: Default production configuration
  • Environment Override: Environment-specific settings (NULL = inherit)
  • Default Environment: Used when no header specified
  • Per-environment clients: IP whitelist per environment
  • Rollback: Point route to previous backend version

📊 Statistics

  • Level: intermediate
  • Time: 15 minutes

🏷️ Tags

environments, deployment, workflows, devops, staging