Deploy Rocket.Chat

Rocket.Chat team chat on MongoDB, admin set at deploy, sign-up off

Deploy Rocket.Chat

Just deployed

MongoDB

mongo:8.2

Just deployed

Just deployed

Deploy and Host Rocket.Chat on Railway

Rocket.Chat is open-source team chat: channels, threads, direct messages, file sharing and integrations, with web, desktop and mobile apps. This template runs Rocket.Chat 9.0.0 on Railway the way upstream's Docker Compose setup does, with the admin account set at deploy.

About Hosting Rocket.Chat

Rocket.Chat needs MongoDB running as a replica set (it reads MongoDB's oplog for real-time updates), and that's where most self-hosted setups go wrong. Here MongoDB 8.2 runs as a one-node replica set with authentication: the replica set key file comes from a generated variable, and the first start initiates the set with the service's private address, so Rocket.Chat connects over Railway's private network. NATS runs next to it, as in upstream's compose file.

A new Rocket.Chat shows a setup wizard and lets anyone register. This template creates the admin from ADMIN_USERNAME, the generated ADMIN_PASS and your email on the first start, marks the wizard as done and turns the registration form off. Add people under Administration, Users, or send invite links. Uploaded files are stored on a volume.

Before publishing I tested it on Railway. /api/info answered, the API returned 401 without a login, and a registration attempt was refused with "User registration is disabled". The admin signed in through the REST API with the admin role, created a channel, posted a message and uploaded a file, and both read back. Then I restarted all three services at once, which caught a problem in my first version: Rocket.Chat started before MongoDB was ready, exited ("Topology is closed") and the deploy failed. Rocket.Chat now restarts inside its container until MongoDB answers; after the restart the admin signed in and the message and the file were still there.

Idle, Rocket.Chat used about 0.7 GB of RAM, MongoDB 0.4 GB and NATS almost nothing, roughly $11 a month on Railway's usage pricing. That fits a trial account's limits only barely, so a Hobby plan is the comfortable minimum for a team.

Common Use Cases

  • A self-hosted Slack or Teams replacement for a company that wants its messages on its own server
  • Customer chat and support through Rocket.Chat's omnichannel features
  • Chat for a community or classroom, with mobile apps for members

Dependencies for Rocket.Chat Hosting

None beyond Railway for chat itself. Push notifications to the mobile apps go through Rocket.Chat's cloud gateway, which needs the workspace registered with Rocket.Chat (free for small teams); email notifications need an SMTP provider, which Railway allows on the Pro plan.

Deployment Dependencies

Implementation Details

ROCKETCHAT_URL               # open this
ADMIN_USERNAME / ADMIN_PASS  # admin account, created on the first start
MONGO_URL                    # replica set rs0 over the private network, with auth
TRANSPORTER                  # NATS over the private network
/app/uploads                 # uploaded files, on a volume

If you add a custom domain, set ROOT_URL to it so links and the mobile apps use it.

Why Deploy Rocket.Chat on Railway?

Your team's chat runs on infrastructure you control, with the MongoDB replica set already wired and the admin claimed before the URL goes public. Railway bills the RAM the three services use, about $11 a month for a small team at idle.


Template Content

MongoDB

mongo:8.2

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
51
View Template
Foundry Virtual Tabletop
Self-hosted virtual tabletop for role-playing games (license required)

Lucas
71
View Template
NEW
Double Commander in your browser
The Double Commander file manager in the cloud, from any device

Nermin Sabanovic
0