Deploying Rocket.Chat as microservices improves scalability and fault isolation within your workspace. By dividing Rocket.Chat into specialized services, each component operates independently, optimizing performance and simplifying maintenance.
Rocket.Chat officially supports deploying microservices using Kubernetes with the official Helm chart. Direct Docker microservice deployment is not supported.
In this document, you'll learn:
The key components of the Rocket.Chat microservice architecture
How to scale an existing Rocket.Chat workspace with microservices
Key components of Rocket.Chat microservices
Rocket.Chat’s microservices architecture consists of several components, each focusing on a specific feature. These components work together to form a fully operational Rocket.Chat workspace. These key components are:
authorization (
rocketchat/authorization-service
): Manages role and permission validation, ensuring users only access what they’re authorized to.accounts (
rocketchat/accounts-service
): Manages user accounts and authentication.presence (
rocketchat/presence-service
): Tracks and manages user presence status across the workspace.ddp-streamer (
rocketchat/ddp-streamer-service
): Handles all WebSocket connections using the Distributed Data Protocol (DDP).nats (
docker.io/nats
): A high-performance messaging system that acts as a central message bus for all microservices. Instead of services communicating directly with each other, requests are routed through NATS, which forwards them to the correct destination. To learn more about NAT, see the official documentation.The central Rocket.Chat monolith (
rocketchat/rocket.chat
): In a microservice deployment, the features of each individual service are disabled within the central monolith. This allows the dedicated microservice to take over its respective function.
Rocket.Chat's microservices deployment is illustrated in the diagram below.
Scaling your Rocket.Chat workspace with microservices
This guide explains how to scale an existing Rocket.Chat microservices deployment that is already running with a single replica. If you have not yet deployed Rocket.Chat on Kubernetes, start with the Deploy with Kubernetes guide.
To scale your deployment, you'll need to modify the values.yaml
file and then upgrade your Rocket.Chat deployment using Helm.
Step 1: Configure replicas
You have two options for configuring the number of replicas: either set a global count for all services or specify a count for each service individually.
Option 1: Set a global replica count
To scale all services to the same number of replicas, modify the replicaCount
in your values.yaml
file. For example, to set two replicas for all services:
microservices:
enabled: true # Enable microservices
replicaCount: 2
Option 2: Set replica for individual services
For more granular control, you can specify a unique number of replicas for each service. This is useful if certain services need to handle more load than others. In this case, remove replicaCount
and specify replicas for each service in the values.yaml
file:
microservices:
enabled: true
presence:
replicas: 2
ddpStreamer:
replicas: 2
account:
replicas: 2
authorization:
replicas: 2
nats:
replicas: 2
For the
ddp-streamer
, plan 1 pod per 500 concurrent users.Remember to remove
replicaCount
if you’re defining replicas individually.
Step 2: Upgrade Rocket.Chat
After saving your changes in
values.yaml
, upgrade your deployment to apply them:helm upgrade rocketchat -f values.yaml rocketchat/rocketchat
If the upgrade is successful, you’ll get a response similar to the following:
Once the upgrade is complete, you can verify that the new pods are running by using
kubectl get pods
. You should see multiple replicas per service depending on your configuration, similar to the image below:Additionally, you can confirm the number of running instances directly from the workspace UI.
Go to Administration > Workspace.
Click the Instances button under Deployment.
A list of all active Rocket.Chat instances will be displayed.
Congratulations! You have successfully scaled your Rocket.Chat workspace using microservices. Your workspace is now better equipped to handle a larger number of users and provides improved resilience. You can now return to your workspace and continue chatting with your teammates.