
Docker containers are for production hosting or self-hosting, for the contribution please check the Local Setup.
Overview
This guide provides step-by-step instructions to install and configure the Twenty application using Docker Compose. The aim is to make the process straightforward and prevent common pitfalls that could break your setup. Important: Only modify settings explicitly mentioned in this guide. Altering other configurations may lead to issues. See docs Setup Environment Variables for advanced configuration. All environment variables must be declared in the docker-compose.yml file at the server and / or worker level depending on the variable.System Requirements
- RAM: Ensure your environment has at least 2GB of RAM. Insufficient memory can cause processes to crash.
- Docker & Docker Compose: Make sure both are installed and up-to-date.
Option 1: One-line script
Install the latest stable version of Twenty with a single command:- Replace x.y.z with the desired version number.
- Replace branch-name with the name of the branch you want to install.
Option 2: Manual steps
Follow these steps for a manual setup.Step 1: Set Up the Environment File
-
Create the .env File
Copy the example environment file to a new .env file in your working directory:
-
Generate Secret Tokens
Run the following command to generate a unique random string:
Important: Keep this value secret / do not share it.
-
Update the
.envReplace the placeholder value in your .env file with the generated token: -
Set the Postgres Password
Update the
PG_DATABASE_PASSWORDvalue in the .env file with a strong password without special characters.
Step 2: Obtain the Docker Compose File
Download thedocker-compose.yml file to your working directory:
Step 3: Launch the Application
Start the Docker containers:Step 4: Access the Application
If you host twentyCRM on your own computer, open your browser and navigate to http://localhost:3000. If you host it on a server, check that the server is running and that everything is ok withConfiguration
Expose Twenty to External Access
By default, Twenty runs onlocalhost at port 3000. To access it via an external domain or IP address, you need to configure the SERVER_URL in your .env file.
Understanding SERVER_URL
- Protocol: Use
httporhttpsdepending on your setup.- Use
httpif you haven’t set up SSL. - Use
httpsif you have SSL configured.
- Use
- Domain/IP: This is the domain name or IP address where your application is accessible.
- Port: Include the port number if you’re not using the default ports (
80forhttp,443forhttps).
SSL Requirements
SSL (HTTPS) is required for certain browser features to work properly. While these features might work during local development (as browsers treat localhost differently), a proper SSL setup is needed when hosting Twenty on a regular domain. For example, the clipboard API might require a secure context - some features like copy buttons throughout the application might not work without HTTPS enabled. We strongly recommend setting up Twenty behind a reverse proxy with SSL termination for optimal security and functionality.Configuring SERVER_URL
-
Determine Your Access URL
-
Without Reverse Proxy (Direct Access):
If you’re accessing the application directly without a reverse proxy:
-
With Reverse Proxy (Standard Ports):
If you’re using a reverse proxy like Nginx or Traefik and have SSL configured:
-
With Reverse Proxy (Custom Ports):
If you’re using non-standard ports:
-
Without Reverse Proxy (Direct Access):
If you’re accessing the application directly without a reverse proxy:
-
Update the
.envFile Open your.envfile and update theSERVER_URL:Examples:- Direct access without SSL:
- Access via domain with SSL:
- Direct access without SSL:
-
Restart the Application
For changes to take effect, restart the Docker containers:
Considerations
-
Reverse Proxy Configuration:
Ensure your reverse proxy forwards requests to the correct internal port (
3000by default). Configure SSL termination and any necessary headers. - Firewall Settings: Open necessary ports in your firewall to allow external access.
-
Consistency:
The
SERVER_URLmust match how users access your application in their browsers.
Persistence
- Data Volumes: The Docker Compose configuration uses volumes to persist data for the database and server storage.
- Stateless Environments: If deploying to a stateless environment (e.g., certain cloud services), configure external storage to persist data.