Skip to content

Deploying a Rocket.Chat App

Introduction

Rocket.Chat is an open-source team messaging platform with channels, voice, and rich integrations. Deploying Rocket.Chat with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample checks to verify your deployment.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Rocket.Chat Dockerfile (GitHub is the only supported git source)
  • External MongoDB (required), preferably with replica set enabled
  • Domain and TLS for secure chat access

For onboarding, see the Quick Start.


Architecture and ports

  • Rocket.Chat serves HTTP on internal port 3000. Choose HTTP traffic in Klutch.sh and set the internal port to 3000.
  • Persistent storage is recommended for file uploads if stored locally; MongoDB holds primary state.

Repository layout

rocketchat/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Build and run locally (ensure MongoDB is reachable):

Terminal window
docker build -t rocketchat-local .
docker run -p 3000:3000 \
-e MONGO_URL=mongodb://user:pass@localhost:27017/rocketchat \
-e MONGO_OPLOG_URL=mongodb://user:pass@localhost:27017/local \
-e ROOT_URL=http://localhost:3000 \
-e PORT=3000 \
rocketchat-local

Dockerfile for Rocket.Chat (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM rocketchat/rocket.chat:latest
ENV PORT=3000
ENV ROOT_URL=http://localhost:3000
EXPOSE 3000
CMD ["node", "main.js"]

Notes:

  • Pin to a specific tag (e.g., rocketchat/rocket.chat:6.4.0) for stability.
  • main.js starts the web server on the configured port.

Environment variables (Klutch.sh)

Set these before deploying:

  • PORT=3000
  • ROOT_URL=https://example-app.klutch.sh
  • MONGO_URL=mongodb://<user>:<password>@<host>:27017/rocketchat?replicaSet=rs0
  • MONGO_OPLOG_URL=mongodb://<user>:<password>@<host>:27017/local?replicaSet=rs0
  • Optional SMTP: MAIL_URL=smtp://user:pass@smtp-host:587
  • Optional file storage for S3/MinIO: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, S3_BUCKET, S3_REGION, S3_ENDPOINT, and set FileUpload_StoreType=s3

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_NODE_VERSION=18
  • NIXPACKS_START_CMD=node main.js

Attach persistent volumes

If you store uploads locally, add storage in Klutch.sh (path and size only):

  • /app/uploads — user-uploaded files.

Ensure the path matches your Rocket.Chat file storage configuration.


Deploy Rocket.Chat on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 3000.
  4. Add the environment variables above (Mongo URLs, ROOT_URL, and optional SMTP/storage settings).
  5. Attach a volume at /app/uploads if storing files locally; size it for your media.
  6. Deploy. Your app will be reachable at https://example-app.klutch.sh; complete initial setup in the UI.

Sample checks

Landing page:

Terminal window
curl -I https://example-app.klutch.sh

If you expose a health endpoint (replace if different):

Terminal window
curl -I https://example-app.klutch.sh/api/v1/info

Health checks and production tips

  • Add an HTTP readiness probe to / or /api/v1/info.
  • Use Mongo replica set URIs for oplog support; keep credentials in Klutch.sh secrets and rotate regularly.
  • If using local uploads, monitor /app/uploads volume usage and resize proactively; prefer S3/MinIO for scalability.
  • Pin image versions and test upgrades in staging before production rollout.

Rocket.Chat on Klutch.sh delivers reproducible Docker builds, managed secrets, and optional local uploads—without extra YAML or CI steps. Configure ports, env vars, and storage, then launch your team chat.