Deploy Twenty
Twenty CRM with worker, Postgres and file storage, admin set at deploy
Just deployed
Just deployed
Twenty Worker
Just deployed
Redis
Just deployed
Files
Bucket
Just deployed
Deploy and Host Twenty on Railway
Twenty is an open-source CRM: companies, people, opportunities, notes and tasks, custom objects and fields, email and calendar sync, workflows, and a GraphQL and REST API.
This template runs the official image (v2.42.6) the way upstream's Docker Compose file does, as a server and a background worker, with Postgres, Redis and a private Railway Bucket for files.
About Hosting Twenty
On a fresh Twenty, the first person who signs up creates the workspace and becomes the server admin. On a public URL that can be anyone. This template does it for you: the deploy form asks for your email, a password is generated into TWENTY_ADMIN_PASSWORD, and a start step creates your account and the workspace as soon as the server answers. After that, signing up needs an invitation. Open TWENTY_URL and sign in with that email and password.
Upstream's compose file has the server and the worker share a disk for uploaded files. Railway can't share a volume between two services, so files go to a Railway Bucket instead. Twenty streams files through its own server, so the bucket stays private.
Twenty is heavy for a 1 GB service. With Node's default heap limit, the server ran out of memory while starting, so NODE_OPTIONS raises the limit to 640 MB. My first start step was a small Node script; it cost about 100 MB, so it's now a shell script using the image's own curl and jq. The worker runs node directly instead of through yarn, which saved another 0.3 GB.
Before publishing I tested the final version on a fresh deploy. The start step reported the account and workspace as created, and a sign-up from another address was refused with "New workspace setup is disabled". The admin signed in as server admin with the workspace active, created a company and a person in it, and uploaded a file that read back byte for byte from the bucket. After a restart the start step left everything alone, and the company, the person and the file were still there.
Common Use Cases
- Track companies, contacts and deals in a CRM you host and can extend with custom objects
- Sync a Gmail or Microsoft mailbox and calendar into the CRM (needs your own OAuth app, see Twenty's docs)
- Automate follow-ups with Twenty's workflows, or connect other tools through its API and webhooks
Dependencies for Twenty Hosting
Nothing beyond the template: Postgres, Redis and the bucket are included. Email sending, Google or Microsoft sign-in and mailbox sync need their own credentials, set as variables on both Twenty services.
Deployment Dependencies
- Twenty: https://github.com/twentyhq/twenty
- Self-hosting docs: https://docs.twenty.com/developers/self-host/self-host
- Image:
twentycrm/twenty:v2.42.6 - The wrapper this template builds: https://github.com/dektionstudio/railway-template-images/tree/main/twenty
Implementation Details
TWENTY_ADMIN_EMAIL / TWENTY_ADMIN_PASSWORD # admin account, created with the workspace on first start
APP_SECRET, ENCRYPTION_KEY # generated; keep them (ENCRYPTION_KEY protects stored OAuth tokens)
SERVER_URL=https:// # change it when you add a custom domain
STORAGE_TYPE=s3, STORAGE_S3_* # the private Railway Bucket
NODE_OPTIONS=--max-old-space-size=640 # raise it on plans with more memory per service
The worker takes the shared settings from the server's variables (${{Twenty.APP_SECRET}} and so on). When you add a setting such as email credentials, add it to the worker too, as a reference to the server's variable. To upgrade, change TWENTY_VERSION on the server and the image tag of the worker to the same release; Twenty runs its upgrade migrations on start and supports jumping versions. Back up Postgres first.
Idle, the server used 0.73 GB of RAM, the worker 0.65 GB, Postgres 0.16 GB and Redis 0.01 GB.
Why Deploy Twenty on Railway?
You get your own CRM on a public HTTPS address in one deploy, with the admin account already yours and the files kept in private storage. The tradeoff is memory: the four services use about 1.6 GB at idle, which is around $15 a month in RAM on Railway's usage pricing.
Template Content
TWENTY_ADMIN_EMAIL
Email of the admin account, created with the workspace on first start. Sign in with it and TWENTY_ADMIN_PASSWORD
Twenty Worker
twentycrm/twenty:v2.42.6Redis
redis:7.4Files
Bucket
