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.
It is essential to note that we do not support direct Docker microservices deployment. .
In this document, you'll learn:
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. Here are the key components:
authorization (
rocketchat/authorization-service
): Manages role and permission validation, ensuring that users have the right access levels.nats (
docker.io/nats
): A messaging system that provides a scalable and highly available message bus for microservices communication. It acts as a message distributor, i.e., you point to the distributor instead of pointing to each component in the deployment resource. This determines the service to forward the requests.To learn more about NAT, see the official documentation.
stream-hub (
rocketchat/stream-hub-service)
: Functions as a message broker that provides a scalable and fault-tolerant message stream for Rocket.Chat. It receives real-time changes or data from MongoDB and sends it to all the services. The services can act on that change at their discretion.accounts (
rocketchat/accounts-service
): Manages user accounts and authentication.ddp-streamer (
rocketchat/ddp-streamer-service
): Handles all WebSocket connections using the Distributed Data Protocol (DDP).presence (
rocketchat/presence-service
): Manages user presence status.The central Rocket.Chat monolith (
rocketchat/rocket.chat
): Each component is disabled from this monolith, so each "service" can take over its respective functionalities.
Rocket.Chat's microservices deployment is illustrated in the diagram below.
Scaling your Rocket.Chat workspace with microservices
This guide assumes you have a monolithic Rocket.Chat workspace deployed with Kubernetes. It focuses on scaling the existing deployment using microservices. If you haven’t deployed a workspace with Kubernetes yet, refer to the Deploy with Kubernetes guide for instructions.
To configure Rocket.Chat microservices in your Kubernetes deployment, modify the values.yaml
file and follow these steps:
Step 1: Enable microservices
Set the enabled
value for microservices to true
:
microservices:
enabled: true
Step 2: Configure replicas
By default, the Rocket.Chat Helm chart deploys a single monolithic instance. To scale the deployment with multiple replicas, add the number of desired replicaCount
as follows:
replicaCount: 2
microservices:
enabled: true
Alternatively, specify the number of replicas for each service as shown below:
microservices:
enabled: true
presence:
replicas: 1
ddpStreamer:
replicas: 2
account:
replicas: 1
authorization:
replicas: 1
streamHub:
replicas: 1
nats:
replicas: 1
For
ddp-streamer
, aim one pod for every 500 concurrent users.
stream-hub
is the only service/component that can not be scaled and is limited to one pod for each deployment.
Step 3: Upgrade Rocket.Chat
After updating the microservices configuration in values.yaml
, apply the changes by upgrading Rocket.Chat:
helm upgrade rocketchat -f values.yaml rocketchat/rocketchat
If your deployment is successful, you’ll get a response similar to the following:
Verify that the corresponding certificates, secrets, and pods have been successfully created with the kubectl get pods
command. The result is similar to the image below, depending on your configurations:
Congratulations! You’ve successfully scaled your Rocket.Chat workspace using microservices. You can return to your workspace and continue chatting with your team mates.
Deploying a new Rocket.Chat workspace with microservices
If you’re deploying a new Rocket.Chat workspace with microservices:
Follow the Deploy Rocket.Chat with Kubernetes guide.
While defining the configurations, enable microservices and configure your desired replicas for microservices in the
values.yaml
file as outlined above.microservices: enabled: true presence: replicas: 1 ddpStreamer: replicas: 2 account: replicas: 1 authorization: replicas: 1 streamHub: replicas: 1 nats: replicas: 1
Finalize the deployment by installing Rocket.Chat:
helm install rocketchat -f values.yaml rocketchat/rocketchat
If your deployment is successful, you’ll get a response similar to the following:
Lastly, verify that the corresponding certificates, secrets, and pods have been successfully created with the
kubectl get pods
command. The result is similar to the image below, depending on your configurations:
After a few minutes, you can now access your workspace at the domain where Rocket.Chat was deployed and complete the setup wizard.
Additionally, you can refer to this recording that explains how to deploy Rocket.Chat with microservices in a test environment. For multi-workspace deployment, please contact support.
Congratulations! You have successfully deployed your Rocket.Chat workspace with microservices. Your workspace is now live and ready to use. Enjoy your new Rocket.Chat workspace!