``` Deployment - dev.local

Deployment

Strategies and practices to deploy your application to multiple environments with confidence.

← Back to Docs
🔧

Deployment Pipeline

Deployment Overview

Staging Environment

Use environment variables to manage configurations for staging environments and testing.

# .env.staging
API_URL=https://api.stage.local
PORT=3001
ENVIRONMENT=staging
Staging Guide

Production

Configure production systems with performance optimizations and security hardening.

# .env.prod
API_URL=https://api.prod.local
PORT=80
ENVIRONMENT=production
Production Setup

Deployment Types

Blue/Green Deployment

Deploy new versions side-by-side with the existing version. Swap routes after validation.

# Deployment command example
docker run -p 80:80 app-staging
Learn More

Canary Release

Roll out changes gradually to a subset of users before full release.

# Load balancer configuration
traffic-split:
  canary: 20%
Implementation Details

Rolling Updates

Gradually update instances one at a time with minimal downtime.

# Kubernetes example
kubectl set image deploy/app-image=image:latest
K8s Deployment

Hot Deployment

Zero-downtime updates with hot code swapping at runtime.

# Node.js example
pm2 reload app
Hot Reload Guide

CI/CD Integration

GitHub Actions

name: ci
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Deploy
        run: ./deploy.sh

GitLab CI

deploy:
  script:
    - npm run build
  environment:
    name: staging
    url: https://app.staging
    on_stop: stop_staging
  only:
    - master

Pre-Deployment Checklist

  • Configure environment variables for target environment
  • Run automated tests in target environment
  • Review security vulnerabilities
  • Validate backup and rollback strategy

Related Resources