Deploy to DigitalOcean App Platform
Deploy WhatsApp Team Inbox to DigitalOcean App Platform with managed PostgreSQL and automatic scaling.TL;DR - Quick Deploy
Create App
Configure Services
Add PostgreSQL
Set Variables
Why DigitalOcean App Platform?
Simple Pricing
Managed Database
Auto Scaling
Global CDN
Prerequisites
Deployment Options
Option 1: Docker Compose (Recommended)
Deploy entire stack as a single Docker app:Fork Repository
Create App
- Go to DigitalOcean Apps
- Click Create App
- Select GitHub as source
- Choose your forked repository
- Select branch:
main
Configure as Docker App
docker-compose.ymlDigitalOcean will detect docker-compose.yml automaticallyAdd PostgreSQL Database
- Click Add Resource → Database
- Select PostgreSQL 16
- Choose plan:
- Basic: $15/month (1GB RAM, 10GB storage)
- Professional: $55/month (4GB RAM, 38GB storage)
Configure Environment Variables
Deploy
Option 2: Separate Services
Deploy frontend and backend as separate apps:Create Backend App
- Create App → GitHub
- Select repository
- Type: Dockerfile
- Source Directory:
/backend - Dockerfile Path:
backend/Dockerfile - HTTP Port: 4000
Create Frontend App
- Create App → GitHub
- Select same repository
- Type: Node.js
- Source Directory:
/web - Build Command:
npm run build - Run Command:
npm start
Create Database
- Go to Databases in DigitalOcean
- Create Database Cluster
- Select PostgreSQL 16
- Choose datacenter region
- Select plan size
Connect Database to App
- Open your backend app
- Go to Settings → App-Level Environment Variables
- Add
DATABASE_URLwith connection string from database
Environment Variables
Configure in App Platform → Settings → Environment Variables:Backend Variables
Database (Required)
Database (Required)
WhatsApp API (Required)
WhatsApp API (Required)
Security (Required)
Security (Required)
Admin User (Required)
Admin User (Required)
Application URLs
Application URLs
${APP_URL} automatically resolves to your app’s URLFrontend Variables
${service.VARIABLE} with actual service valuesDatabase Setup
Managed PostgreSQL
Create Database Cluster
- Go to Databases in DigitalOcean control panel
- Click Create Database Cluster
- Select PostgreSQL version 16
Choose Configuration
- 1 GB RAM / 1 vCPU / 10 GB Disk: $15/month
- 2 GB RAM / 1 vCPU / 25 GB Disk: $30/month
- 4 GB RAM / 2 vCPU / 38 GB Disk: $55/month
- Automatic failover
- Standby nodes
- Higher performance
Select Region
- New York (NYC)
- San Francisco (SFO)
- Amsterdam (AMS)
- Singapore (SGP)
- London (LON)
Configure Security
- Enable Trusted Sources
- Add your App Platform app
- Optionally add your IP for database access
Create Database
- Database name:
whatsapp_inbox - Click Create Database Cluster
Connection Pooling
Enable connection pooling for better performance:Access Database Settings
Create Pool
- Name: whatsapp-pool
- Database: whatsapp_inbox
- Mode: Transaction
- Size: 25
Use Pool Connection String
DATABASE_URL to use pool connection string instead of direct connectionCustom Domain
Add Custom Domain
Access Domain Settings
Add Domain
- Frontend:
app.your-domain.com - Backend:
api.your-domain.com
Configure DNS
Verify Domain
Update Environment Variables
Monitoring
Built-in Monitoring
DigitalOcean App Platform provides monitoring out of the box:Metrics
- CPU usage
- Memory usage
- Request count
- Response time
Logs
- Application logs
- Build logs
- Deploy logs
- Real-time streaming
Alerts
- Resource usage alerts
- Deployment alerts
- Custom metrics
Health Checks
- HTTP health checks
- Auto-restart on failure
- Configurable intervals
Configure Health Checks
Access Health Check Settings
Configure Backend Health Check
- Path:
/health - Port: 4000
- Initial Delay: 30 seconds
- Period: 10 seconds
- Timeout: 5 seconds
- Success Threshold: 1
- Failure Threshold: 3
Configure Frontend Health Check
- Path:
/ - Port: 3000
- Initial Delay: 30 seconds
Set Up Alerts
Create Alert Policy
Configure Alerts
- ✅ Deployment failures
- ✅ High CPU usage (>80%)
- ✅ High memory usage (>90%)
- ✅ Health check failures
- ✅ Crash loop detected
Add Notification Channels
- Email notifications
- Slack webhook
- PagerDuty integration
Scaling
Vertical Scaling
Upgrade resources for better performance:Access Scaling Settings
Choose Container Size
- 512 MB / 0.5 vCPU: $5/month
- 1 GB / 1 vCPU: $12/month
- 2 GB / 1 vCPU: $24/month
- 4 GB / 2 vCPU: $48/month
- 8 GB / 4 vCPU: $96/month
Apply Changes
Horizontal Scaling
Scale to multiple containers for high availability:Enable Auto-Scaling
Configure Rules
- Minimum Instances: 2
- Maximum Instances: 10
- CPU Threshold: 70%
- Memory Threshold: 80%
Load Balancing
Backups
Database Backups
Automatic backups are included:- Daily backups: 7 days
- Weekly backups: 4 weeks
- Monthly backups: 3 months
Manual Backup
Create Manual Backup
Download Backup
Restore from Backup
Application Backups
Backup your application configuration:CI/CD
Automatic Deployments
App Platform automatically deploys on git push:Configure Auto-Deploy
Push to GitHub
Monitor Deployment
Deploy Specific Branch
Change Source Branch
Select Branch
main- Productionstaging- Staging environmentdevelop- Development
Trigger Deployment
Cost Optimization
Estimate Monthly Costs
Example small team setup:| Service | Size | Cost |
|---|---|---|
| Backend App | 1GB RAM | $12/month |
| Frontend App | 512MB RAM | $5/month |
| PostgreSQL | 1GB/10GB | $15/month |
| Total | $32/month |
Tips to Reduce Costs
Start Small, Scale Up
Start Small, Scale Up
Use Connection Pooling
Use Connection Pooling
Optimize Docker Images
Optimize Docker Images
- Use multi-stage builds
- Remove unused dependencies
- Use Alpine base images
Enable CDN
Enable CDN
Schedule Backups Wisely
Schedule Backups Wisely
Troubleshooting
Build Failed
Build Failed
- Dockerfile errors
- Missing dependencies
- Build timeout
- Check build logs in deployment history
- Test Docker build locally:
docker build -f backend/Dockerfile . - Verify all dependencies in package.json
- Increase build timeout in settings
Database Connection Failed
Database Connection Failed
- Trusted sources not configured
- DATABASE_URL incorrect
- Connection limit reached
- Add app to database trusted sources
- Verify DATABASE_URL in environment variables
- Enable connection pooling
- Check database logs for errors
App Crashing
App Crashing
- Insufficient memory
- Application error
- Missing environment variables
- Check runtime logs for errors
- Increase container size
- Verify all required env vars are set
- Test locally with same environment
Slow Performance
Slow Performance
- Undersized resources
- Database not optimized
- No CDN for assets
- Monitor metrics and scale up if needed
- Add database indexes
- Enable CDN for static assets
- Use connection pooling
Production Checklist
DigitalOcean CLI
For advanced users, usedoctl:
Installation
Common Commands
Migration from Other Platforms
From Heroku
Export Heroku Data
Import to DigitalOcean
- Create DigitalOcean database
- Restore backup:
- Copy environment variables to App Platform
Update DNS