How to Deploy Twenty CRM with Docker
intermediate · 30 minutes · Twenty CRM
Prerequisites
- A VPS with 2GB+ RAM (4GB recommended for production)
- Docker and Docker Compose installed
- A domain name with DNS access
- Basic command-line knowledge
Step 1: Create Project Directory
mkdir -p ~/twenty-crm && cd ~/twenty-crm
Step 2: Docker Compose Configuration
Create a docker-compose.yml:
version: "3.8"
services:
app:
image: twentycrm:latest
restart: unless-stopped
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgres://user:password@db:5432/twentycrm
depends_on:
- db
db:
image: postgres:16
restart: unless-stopped
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
- POSTGRES_DB=twentycrm
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
Note: Replace passwords with strong, unique values. This is a simplified example — check the official Twenty CRM documentation for the complete Docker Compose configuration.
Step 3: Start the Services
docker compose up -d
Wait 30-60 seconds for the database to initialize, then visit http://your-server:3000.
Step 4: Configure SSL with Caddy
Add to your Caddyfile:
twentycrm.yourdomain.com {
reverse_proxy localhost:3000
}
Caddy automatically provisions Let’s Encrypt SSL certificates.
Step 5: Production Checklist
- Strong database passwords
- SSL certificate (automatic with Caddy)
- Automated daily backups
- Monitoring (uptime check)
- Firewall: only expose ports 80 and 443
Common Issues
Container won’t start
Check logs: docker compose logs app. Most common cause: database not ready yet. Add a health check or wait 30 seconds after starting.
Can’t connect to the database
Verify the DATABASE_URL matches your PostgreSQL credentials. Check that the database container is running: docker compose ps.
Performance is slow
Ensure your VPS has at least 2GB RAM. Consider adding a swap file: sudo fallocate -l 2G /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile.
Need Help?
This guide covers the basics. For production deployment with proper backups, monitoring, custom domain, and ongoing support, upready.dev offers turnkey Twenty CRM deployment starting at $200.