Docker containers are for production hosting or self-hosting, for the contribution please check the Local Setup.
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.
Install the latest stable version of Twenty with a single command:
bash <(curl -sL https://git.new/20)
To install a specific version or branch:
VERSION=x.y.z BRANCH=branch-name bash <(curl -sL https://git.new/20)
Follow these steps for a manual setup.
Create the .env File
Copy the example environment file to a new .env file in your working directory:
curl -o .env https://raw.githubusercontent.com/twentyhq/twenty/main/packages/twenty-docker/.env.example
Generate Secret Tokens
Run the following command to generate a unique random string:
openssl rand -base64 32
Important: Keep this value secret / do not share it.
Update the .env
Replace the placeholder value in your .env file with the generated token:
APP_SECRET=first_random_string
Set the Postgres Password
Update the PGPASSWORD_SUPERUSER
value in the .env file with a strong password.
PGPASSWORD_SUPERUSER=my_strong_password
Download the docker-compose.yml
file to your working directory:
curl -O https://raw.githubusercontent.com/twentyhq/twenty/main/packages/twenty-docker/docker-compose.yml
Start the Docker containers:
docker-compose up -d
Open your browser and navigate to http://localhost:3000.
By default, Twenty runs on localhost
at port 3000
. To access it via an external domain or IP address, you need to configure the SERVER_URL
in your .env
file.
SERVER_URL
http
or https
depending on your setup.
http
if you haven't set up SSL.https
if you have SSL configured.80
for http
, 443
for https
).SERVER_URL
Determine Your Access URL
Without Reverse Proxy (Direct Access):
If you're accessing the application directly without a reverse proxy:
SERVER_URL=http://your-domain-or-ip:3000
With Reverse Proxy (Standard Ports):
If you're using a reverse proxy like Nginx or Traefik and have SSL configured:
SERVER_URL=https://your-domain-or-ip
With Reverse Proxy (Custom Ports):
If you're using non-standard ports:
SERVER_URL=https://your-domain-or-ip:custom-port
Update the .env
File
Open your .env
file and update the SERVER_URL
:
SERVER_URL=http(s)://your-domain-or-ip:your-port
Examples:
SERVER_URL=http://123.45.67.89:3000
SERVER_URL=https://mytwentyapp.com
Restart the Application
For changes to take effect, restart the Docker containers:
docker-compose down
docker-compose up -d
Reverse Proxy Configuration:
Ensure your reverse proxy forwards requests to the correct internal port (3000
by default). Configure SSL termination and any necessary headers.
Firewall Settings:
Open necessary ports in your firewall to allow external access.
Consistency:
The SERVER_URL
must match how users access your application in their browsers.
If you can't log in after setup:
docker exec -it twenty-server-1 yarn
docker exec -it twenty-server-1 npx nx database:reset
docker-compose down
docker-compose up -d
If you're running Twenty behind a reverse proxy and experiencing connection issues:
Verify SERVER_URL:
Ensure SERVER_URL
in your .env
file matches your external access URL, including https
if SSL is enabled.
Check Reverse Proxy Settings:
X-Forwarded-For
and X-Forwarded-Proto
are properly set.Restart Services:
After making changes, restart both the reverse proxy and Twenty containers.
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.
If you encounter issues not covered in this guide:
Check Logs:
View container logs for error messages:
docker-compose logs
Community Support:
Reach out to the Twenty community or support channels for assistance.
As an open-source company, we welcome contributions through Github. Help us keep it up-to-date, accurate, and easy to understand by getting involved and sharing your ideas!