This guide deploys Twenty CRM with Docker Compose (app + PostgreSQL + Redis).
It supports Debian 10 to latest stable, Ubuntu LTS, and RHEL 9+ compatible systems.
- name: Install Twenty CRM
hosts: twenty
become: true
vars:
twenty_root: /opt/twenty
twenty_port: 3000
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create Twenty directory
file:
path: "{{ twenty_root }}"
state: directory
mode: "0755"
- name: Write Twenty Docker Compose file
copy:
dest: "{{ twenty_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: twenty
POSTGRES_USER: twenty
POSTGRES_PASSWORD: change_me_now
volumes:
- ./postgres:/var/lib/postgresql/data
redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- ./redis:/data
app:
image: twentycrm/twenty:latest
restart: unless-stopped
depends_on:
- postgres
- redis
ports:
- "{{ twenty_port }}:3000"
environment:
DATABASE_URL: postgres://twenty:change_me_now@postgres:5432/twenty
REDIS_URL: redis://redis:6379
- name: Start Twenty stack
command: docker compose up -d
args:
chdir: "{{ twenty_root }}"
Any questions?
Feel free to contact us. Find all contact information on our contact page.