Skip to content

Self-hosting on Railway

Chelsea runs well on Railway. You set it up by hand once: there is no one-click template. You need a Railway account and a copy of the Chelsea repository on GitHub that Railway can read.

One Railway project with:

Piece What it is
Postgres A Postgres database with the pgvector extension available. Migrations also enable pg_trgm and unaccent.
Bucket Railway’s S3-compatible storage, or any other S3 server, for uploaded files.
Redis (optional) A cache. Chelsea runs without it.
web The app people open. Built from the repository’s Dockerfile.
worker Runs background jobs: emails, automations, renewals, imports. Built from the same Dockerfile.

Both services use the one image the Dockerfile builds. The command decides what each runs: docker-entrypoint.sh web, docker-entrypoint.sh worker or docker-entrypoint.sh migrate.

  1. Add a service from your GitHub repository and name it web.
  2. Make sure it builds with the Dockerfile at the repository root.
  3. Set the start command to /usr/local/bin/docker-entrypoint.sh web.
  4. Set the pre-deploy command to /usr/local/bin/docker-entrypoint.sh migrate. It applies database migrations, syncs permissions and creates the storage bucket before each release.
  5. Set the health check path to /healthz.
  6. Give it a public domain, and set APP_URL to that address.
  1. Add a second service from the same repository and name it worker.
  2. Same Dockerfile, with the start command /usr/local/bin/docker-entrypoint.sh worker.
  3. Set the health check path to /healthz, with a timeout of more than 15 minutes. After a release, the worker waits up to 15 minutes for the web service to finish its migrations, and reports itself unhealthy until then so Railway keeps the previous worker running.
  4. Give it no pre-deploy command. Only web migrates.

Every server setting goes on both services: the worker reads the same ones, and a worker missing one fails to start. Railway’s shared variables make this easier.

Setting Value
APP_URL The web service’s public address.
DATABASE_URL Your Postgres connection address.
MIGRATE_DATABASE_URL The direct Postgres address, on port 5432. If DATABASE_URL goes through a connection pooler such as PgBouncer, this one must not.
SESSION_SECRET At least 32 random characters.
ENCRYPTION_KEY 64 hex characters (openssl rand -hex 32). Keep a copy safe.
ENDPOINT, BUCKET, ACCESS_KEY_ID, SECRET_ACCESS_KEY, REGION Your bucket’s S3 details. Add FORCE_PATH_STYLE=true if your storage needs it, and PUBLIC_ENDPOINT if browsers reach it at another address.
EMAIL_FROM and RESEND_API_KEY (or SMTP settings) Email. Required for invitations and password resets.
REDIS_URL Only if you added Redis.

See Configuration for the rest.

Once both services are up, open the web service’s address. The first visit shows the setup page where you name your organization and create the owner account. Do it right away: the page disappears once that account exists.