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
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 productionFeatures:
- 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-eastFeatures:
- 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 globalFeatures:
- 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 usageFeatures:
- 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 typecheck2. Build
Compile and optimize for production:
# Build for production
do build --env production
# Optimize bundles
do build --optimize --minify
# Generate types
do build --types3. Deploy
Deploy to production:
# Deploy with preview
do deploy --preview
# Deploy to production
do deploy --env production
# Deploy specific service
do deploy api --env production4. Verify
Verify deployment health:
# Check deployment status
do status
# Run smoke tests
do test --smoke
# View logs
do logs --tailCI/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 }}GitLab CI
deploy:
stage: deploy
script:
- pnpm install
- pnpm build
- pnpm deploy --env production
only:
- mainConfiguration 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_URLLearn 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_PASSWORDDeployment 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 blueCanary 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 rollingMonitoring 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-123Health 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.3Multi-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-westBest Practices
Pre-Deployment
- Test thoroughly - Run all tests locally and in CI
- Review changes - Code review before merging
- Check dependencies - Ensure all dependencies are up to date
- Backup data - Backup critical data before deploying
- Plan rollback - Have rollback plan ready
During Deployment
- Monitor metrics - Watch key metrics during rollout
- Check logs - Monitor logs for errors
- Verify health - Run health checks after deployment
- Test critical paths - Test important user flows
- Gradual rollout - Use canary or blue-green deployments
Post-Deployment
- Verify functionality - Confirm all features work
- Check performance - Ensure performance meets expectations
- Monitor errors - Watch error rates
- Collect feedback - Get user feedback
- 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
- Infrastructure → - Understand deployment infrastructure
- CI/CD → - Set up automated deployments
- Configuration → - Manage environment config
- Strategies → - Learn deployment strategies
- Production → - Deploy specific primitives
Deployment Tip: Great deployments are automated, monitored, and reversible. Always have a rollback plan ready.