.do

Deploy

Deploy your business code and services to production with confidence

Deploy your business code and services to production with confidence.

Overview

The Deploy phase transforms your designed Business-as-Code into running production systems. Using the .do platform's deployment infrastructure, you'll deploy to global edge networks, manage configurations, automate deployments, and ensure reliable releases.

Key deployment capabilities:

  • Edge Deployment: Deploy to 300+ cities worldwide via Cloudflare Workers
  • Zero Downtime: Blue-green deployments and gradual rollouts
  • Infrastructure as Code: Define infrastructure alongside business logic
  • Automatic Scaling: Handle any traffic volume without configuration
  • Built-in Monitoring: Observability included by default
graph TB A[MDX Source Code] --> B[Build Process] B --> C{Deployment Target} C -->|APIs| D[Cloudflare Workers] C -->|Apps| E[Edge Hosting] C -->|Agents| F[Durable Objects] C -->|Services| G[Marketplace] C -->|Sites| H[Static CDN] C -->|Workflows| I[Workflow Engine] D --> J[Production Environment] E --> J F --> J G --> J H --> J I --> J

Deployment Targets

Cloudflare Workers (Edge Functions)

Deploy serverless functions at the edge for maximum performance:

# Deploy API to edge
do deploy api --target edge --regions global

# Deploy with custom settings
do deploy api --target edge --regions global --env production

Features:

  • Sub-50ms response times globally
  • Auto-scaling to millions of requests
  • Zero cold starts
  • Pay-per-request pricing

Learn more about edge deployment →

Durable Objects (Stateful Workers)

Deploy stateful services with strong consistency:

# Deploy stateful agent
do deploy agent --target durable --regions us-east

Features:

  • Strong consistency
  • WebSocket support
  • Persistent state
  • Auto-hibernation

Learn more about Durable Objects →

Static Sites (CDN)

Deploy static websites to global CDN:

# Deploy site
do deploy site --target cdn --regions global

Features:

  • Instant global distribution
  • Automatic HTTPS
  • Custom domains
  • Cache optimization

Learn more about site deployment →

Services (Marketplace)

Package and deploy Services-as-Software:

# Deploy service to marketplace
do deploy service --marketplace public --pricing usage

Features:

  • Built-in billing
  • Usage tracking
  • API rate limiting
  • SLA monitoring

Learn more about service deployment →

Deployment Workflow

1. Local Development

Develop and test locally:

# Start local development server
do dev

# Run tests
do test

# Type check
do typecheck

2. Build

Compile and optimize for production:

# Build for production
do build --env production

# Optimize bundles
do build --optimize --minify

# Generate types
do build --types

3. Deploy

Deploy to production:

# Deploy with preview
do deploy --preview

# Deploy to production
do deploy --env production

# Deploy specific service
do deploy api --env production

4. Verify

Verify deployment health:

# Check deployment status
do status

# Run smoke tests
do test --smoke

# View logs
do logs --tail

CI/CD Integration

GitHub Actions

Automated deployment on push:

name: Deploy to Production

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3

      - name: Install dependencies
        run: pnpm install

      - name: Build
        run: pnpm build

      - name: Test
        run: pnpm test

      - name: Deploy
        run: pnpm deploy --env production
        env:
          DO_TOKEN: ${{ secrets.DO_TOKEN }}

Learn more about CI/CD →

GitLab CI

deploy:
  stage: deploy
  script:
    - pnpm install
    - pnpm build
    - pnpm deploy --env production
  only:
    - main

Configuration Management

Environment Variables

Manage environment-specific configuration:

// .env.production
DATABASE_URL=postgresql://...
API_KEY=secret_key_here
STRIPE_KEY=sk_live_...
// Access in code
const apiKey = env.API_KEY
const dbUrl = env.DATABASE_URL

Learn more about configuration →

Secrets Management

Secure sensitive data:

# Add secret
do secret add DATABASE_PASSWORD

# List secrets
do secret list

# Remove secret
do secret remove DATABASE_PASSWORD

Deployment Strategies

Blue-Green Deployment

Zero-downtime deployments:

# Deploy to green environment
do deploy --strategy blue-green --target green

# Switch traffic to green
do switch --from blue --to green

# Rollback if needed
do switch --from green --to blue

Canary Deployment

Gradual rollout to subset of users:

# Deploy canary with 10% traffic
do deploy --strategy canary --traffic 10%

# Increase to 50%
do traffic --canary 50%

# Promote to 100%
do traffic --canary 100%

Rolling Deployment

Progressive region-by-region rollout:

# Deploy to one region first
do deploy --regions us-east --strategy rolling

# Deploy to more regions
do deploy --regions us-west,eu-west --strategy rolling

# Deploy globally
do deploy --regions global --strategy rolling

Learn more about strategies →

Monitoring Deployments

Real-time Status

Monitor deployment progress:

# Watch deployment status
do deploy --watch

# View deployment history
do deployments list

# Get deployment details
do deployment get dep-123

Health Checks

Automated health verification:

// Define health check
export const health = {
  check: async () => {
    const dbOk = await checkDatabase()
    const apiOk = await checkExternalAPIs()

    return {
      status: dbOk && apiOk ? 'healthy' : 'unhealthy',
      checks: { database: dbOk, external: apiOk },
    }
  },
}

Rollback Capability

Quick rollback on issues:

# Rollback to previous version
do rollback

# Rollback to specific version
do rollback --version v1.2.3

# Rollback specific service
do rollback api --version v1.2.3

Multi-Region Deployment

Deploy to multiple regions:

# Deploy to specific regions
do deploy --regions us-east,us-west,eu-west

# Deploy globally
do deploy --regions global

# Deploy with region failover
do deploy --regions us-east --fallback us-west

Best Practices

Pre-Deployment

  1. Test thoroughly - Run all tests locally and in CI
  2. Review changes - Code review before merging
  3. Check dependencies - Ensure all dependencies are up to date
  4. Backup data - Backup critical data before deploying
  5. Plan rollback - Have rollback plan ready

During Deployment

  1. Monitor metrics - Watch key metrics during rollout
  2. Check logs - Monitor logs for errors
  3. Verify health - Run health checks after deployment
  4. Test critical paths - Test important user flows
  5. Gradual rollout - Use canary or blue-green deployments

Post-Deployment

  1. Verify functionality - Confirm all features work
  2. Check performance - Ensure performance meets expectations
  3. Monitor errors - Watch error rates
  4. Collect feedback - Get user feedback
  5. Document changes - Update documentation

Deployment Checklist

  • All tests passing
  • Code reviewed and approved
  • Dependencies updated
  • Configuration verified
  • Secrets configured
  • Health checks defined
  • Monitoring enabled
  • Rollback plan ready
  • Team notified
  • Documentation updated

Next Steps


Deployment Tip: Great deployments are automated, monitored, and reversible. Always have a rollback plan ready.