Overview
Docker Compose provides the easiest way to self-host Twenty with all required services configured and ready to go. Includes:- Twenty server (API + frontend)
- Worker for background jobs
- PostgreSQL database
- Redis for caching
Prerequisites
- Docker Engine 20.10+
- Docker Compose v2.0+
- 2GB+ RAM available
- Domain name (for production use)
Quick Start
1. Download Configuration Files
Create a directory for your Twenty installation:2. Configure Environment Variables
Copy the example environment file:.env with your configuration:
.env
3. Start Services
Start all containers:- Pull the Twenty Docker image
- Start PostgreSQL and Redis
- Initialize the database
- Start the web server and worker
4. Verify Installation
Check that all services are running:server- Running on port 3000worker- Processing background jobsdb- PostgreSQL databaseredis- Redis cache
http://localhost:3000 (or your configured SERVER_URL).
Docker Compose Configuration
Thedocker-compose.yml includes four main services:
Server Service
Worker Service
Handles background jobs:Database Service
Redis Service
Volume Management
Persistent data is stored in Docker volumes:Backup Volumes
Backup your data regularly:Restore from Backup
Environment Variables
Required Variables
Public URL where Twenty will be accessible (e.g.,
https://crm.yourcompany.com)Secret key for encryption and JWT signing. Generate with
openssl rand -base64 32Storage Configuration
Storage backend:
local or s3AWS region (when using S3 storage)
S3 bucket name
Custom S3 endpoint (for S3-compatible services)
Authentication Providers
Google OAuth client ID
Google OAuth client secret
Microsoft OAuth client ID
Microsoft OAuth client secret
Email Configuration
Email driver:
smtp or logger (for testing)SMTP server hostname
SMTP server port (typically 587 or 465)
Sender email address
Common Operations
View Logs
Restart Services
Update to Latest Version
Run Database Migrations
Migrations run automatically on server start. To run manually:Access Database
Scale Workers
Increase worker instances for better performance:Production Recommendations
Use HTTPS
Always use TLS/SSL in production with a reverse proxy like Nginx or Traefik
Strong Secrets
Generate cryptographically secure secrets and credentials
Regular Backups
Automate database and file backups
Monitor Resources
Set up monitoring for CPU, memory, and disk usage
Reverse Proxy Example (Nginx)
Troubleshooting
Server won't start
Server won't start
Check logs for errors:Common issues:
- Missing or invalid
APP_SECRET - Database connection failed
- Port 3000 already in use
Database connection errors
Database connection errors
Ensure the database is healthy:The server waits for
db:5432 to be ready before starting.File uploads not working
File uploads not working
Check volume permissions:For S3 storage, verify credentials and bucket permissions.
Worker not processing jobs
Worker not processing jobs
Verify worker is running:Check Redis connection:
Next Steps
Configuration
Configure your Twenty instance
Kubernetes
Deploy on Kubernetes
Troubleshooting
Common issues and solutions
API Keys
Set up API authentication
