---
title: "Deploy Rocket.Chat"
description: "Rocket.Chat 9 team chat with a self-initialising MongoDB 8 replica set"
category: "Other"
url: https://railway.com/deploy/rocketchat-1
---

# Deploy Rocket.Chat

Rocket.Chat 9 team chat with a self-initialising MongoDB 8 replica set

**[Deploy Rocket.Chat on Railway](https://railway.com/template/rocketchat-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/rocketchat-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Other

## Template content

### Rocket.Chat https://upload.wikimedia.org/wikipedia/commons/5/55/RocketChat_Logo_1024x1024.png

- **Image:** rocketchat/rocket.chat:9.0.0@sha256:ce4f33c7efc0f0cc672ed9c3de46d32d811a4b109df2247817d9a80ba283f415
- **Health check:** /health
- **Public domain:** Yes

### MongoDB

- **Image:** mongo:8.0.34@sha256:b9924c330a8bbc5800fe9c69f04a84e221eca7b28fd049a0354147d9908fa142
- **Start command:** `/bin/sh -c 'export GLIBC_TUNABLES=glibc.pthread.rseq=1; printf "%s" "$MONGO_REPLICA_KEY" > /tmp/rs.key; chmod 400 /tmp/rs.key; chown 999:999 /tmp/rs.key; (until mongosh --quiet -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin --eval "try { rs.status().ok } catch (e) { rs.initiate({ _id: \"rs0\", members: [{ _id: 0, host: \"localhost:27017\" }] }).ok }" 2>/dev/null | grep -qx 1; do sleep 3; done; echo "replica set rs0 ready") & exec docker-entrypoint.sh mongod --replSet rs0 --keyFile /tmp/rs.key --ipv6 --bind_ip_all'`

## Documentation

# Deploy and Host Rocket.Chat on Railway

Rocket.Chat is an open-source team chat platform: channels, direct messages, threads, file sharing and audio/video calls, with desktop and mobile apps. You host it yourself, so your conversations and files stay in your own database. It is often used as a self-hosted alternative to Slack or Microsoft Teams.

## About Hosting Rocket.Chat

This template runs two services. Rocket.Chat 9.0.0 (official image, pinned by digest) is served on a public Railway domain with a `/health` check. MongoDB 8.0 runs as a single-node replica set `rs0`, which Rocket.Chat 9 needs. The replica set is created automatically on first start, with authentication and a generated keyfile. Data and uploaded files (GridFS) live in MongoDB on a Railway volume, so they survive redeploys. An admin account is created on first boot with a generated password. When that admin first signs in, Rocket.Chat 9 keeps them in the setup wizard until the workspace is registered with a free Rocket.Chat Cloud account.

## Common Use Cases

* Private team chat for a company, club or open-source project
* Customer or community support channels with file sharing
* Self-hosted alternative to Slack or Microsoft Teams with your own data retention

## Dependencies for Rocket.Chat Hosting

* MongoDB 8.0 as a replica set (included, on a Railway volume)
* A Rocket.Chat Cloud account (free) to register the workspace on first admin login

### Deployment Dependencies

* [Rocket.Chat 9.0.0 release notes](https://github.com/RocketChat/Rocket.Chat/releases/tag/9.0.0)
* [Rocket.Chat Docker deployment docs](https://docs.rocket.chat/docs/deploy-with-docker-docker-compose)
* [Official compose files](https://github.com/RocketChat/rocketchat-compose)
* [MongoDB 8.0 image](https://hub.docker.com/_/mongo)

### Implementation Details

* **First login:** sign in as `admin` with the `ADMIN_PASS` value shown in the Rocket.Chat service's Variables tab. The setup wizard then asks for your organisation details and a workspace registration (by email, or offline with a token). Registration is free, and mobile push notifications need it.
* **Database URL:** Rocket.Chat connects with `${{MongoDB.MONGO_URL}}` over the private network. The replica set member is `localhost:27017`, so external tools must connect with `directConnection=true`.
* **Kernel workaround:** the MongoDB start command sets `GLIBC_TUNABLES=glibc.pthread.rseq=1`. MongoDB 8.0 otherwise refuses to start on Linux kernels 6.19 to 7.0.13 ([SERVER-121912](https://jira.mongodb.org/browse/SERVER-121912)).
* **Email:** set up SMTP under Administration &gt; Settings &gt; Email before you invite users. Users with a verified email are asked for an email 2FA code when they sign in.

## Why Deploy Rocket.Chat on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Rocket.Chat on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.




## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/rocketchat-1
