Running Rocket Chat on Kubernetes for Scalable Team Communication

Navdeep Garg, CEO of Revinfotech
Rocket Chat Img

Introduction

Deployment-Works-with-Kubernetes-and-Docker

Want to know how you can build slacks such as online chat with rocket chat for deployment over containers via Kubernetes and Docker? Simply read through and know everything about it.

Before getting started, you should know a bit about the premise. The blog is assuming a situation where rocket chat app is used on the OpenStack for on-premise deployment. Therefore, the existing on-premise cloud framework is migrated to the containers based on Kubernetes and docker.

Docker can be summed as an open platform for sysadmins and developers for building, shipping, and running distributed apps on data center VMs, cloud, or laptops.

Similarly, Kubernetes is deemed to be the container infrastructure layer on the top of the container engine/runtime for deploying and managing containers efficiently.

What Do You Need for Deploying Rocket Chat on Kubernetes?

The deployment process requires:

  • Kubectl
  • Kubernetes
  • Shared Storage like Ceph FS, GlusterFS, AzureDisk AWS EBS, etc.
  • Dockerfile
  • Rocket Chat App
  • Container-Registry

You can use Kubernetes to deploy, scale, and manage the arrangement of the containerized apps. Kubernetes cluster can be used for testing while minikube can also be used.

In case of shared storage, the blog uses GlusterFS, an efficient network data system.

You can call Rocket.Chat a web-focused chat serve, written in the JavaScript with the stack framework of Meteor.

Also, Dockerfile can be summed up as a text file containing every command/information needed for the app configuration within the container.

Registry is deemed to be a digital storage for the container images that also allows the distribution of the images.

Kubectl is one of the best command line tools used for remotely managing Kubernetes cluster.

In vase you utilize MongoDB and Rocket Chat, then steps 1-6 can be skipped.

Easy Steps to Deploy Rocket Chat on the Kubernetes

1. Creating a custom image for the Rocket Chat’s container

First, you need to make a file named Dockerfile as the image for Rocket Chat container.

Rocket-Chats-containerOur app would be based on the NodeJS, therefore, we are using NodeJS docker’s image from the docker hub as the base image. Afterwards, we use codes for the container and install every dependency of app to the container.

2. Building image for rocket chat docker

rocket-chat-docker

3. Creating image for MongoDB Container

Prepare a new folder by the name of MongoDB.

Creating-image-for-MongoDB-Container

Our image contains Ubuntu as base image for using the official MongoDB’s docker image. Due to compatibility purposes, the dockerfile is created for the 3.0 version of MongoDB.

Now, we mount the volume named /data/db for the container’s persistent storage.

After that, the 27017 port is exposed for the incoming MongoDB server requests.

Now, the server is started in the dforeground mode for seeing the logs within the container stdout.

4. Creating image for MongoDB Docker

Creating image for MongoDB Docker

5. Add a container registry to the docker daemon

In case the users are not utilizing docker hub for storing images, then you must add a container registry with local Kubernetes nodes and docker daemon.

Numerous ways can be availed for doing so like:

Add-a-container-registry-to-the-docker-daemon

For verifying the container registry’s addition to the local docker, you have to use the given steps:

$ docker info

Now you will get registries like:

Insecure Registries:

<your container registry name>

127.0.0.0/8

6. Shifting PostgreSQL image to the container registry

Now you have to upload the image to any container registry such as:

  • Google Container Registry
  • AWS ECR
  • Private Docker Hub
  • Docker Store

In case the authentication is enable, you have to first login and only then download or upload images from the registry.

For logging in, follow the given command:

$ docker login <name of your container registry>

Username : xxxx

Password: xxxxx

If there is AWS EXR, then you’ll receive username, password, and registry url from the respective cloud provider launched at the registry.

Here’s the shell script to add the aws credentials:

script-to-add-the-aws-credentials

Now tag the images and move them to anywhere on the posted registry.

For tagging the images:

For tagging the images

For pushing the images:

For pushing the images

7. Creating Stroage Volume with GluterFS

First you have to make volume within the GluterFS. Add DNS or IP address in place of node2 and node1 as mentioned in the GluterFS installation guide.

Creating-Stroage-Volume-with-GluterFS

8. Deploying MongoDB over Kubernetes

You need:

Docker Image created in the 4th step where it was moved to docker registry or docker hub.

Persistent Shared Volume created in the 6th step of GluterFS.

Service and Deployment Files will be created now.

Deploying-MongoDB-over-Kubernetes

9. Deploying Rocket Chat

You need: 

Docker Image for the rocket chat created in the 2nd step.

Now we will male Service and Deployment files.

Make a file for deployment by the name of rocketchat.deployment.yml.

rocket-chat-docker

10. Testing the Database of MongoDB

Testing the Database of MongoDB

11.Testing the Rocket Chat App

Launch the Cluster IP with the 3000 port on your web browser for checking whether the app’s functioning or not.

12.Fixing Rocket Chat App Container

Overview the logs of MongoDB pods and rocket chat app.

Check service/pods/containers NameSpace of RocketChat and MongoDB.

Try connecting MongoDB from the local client of Mongo with the clustered IP address.

Overview the network connectivity from the rocket chat to the mongodo pods.

Frequently Asked Questions

What is Rocket.Chat on Kubernetes?
+
Rocket.Chat on Kubernetes refers to deploying the open-source team communication platform Rocket.Chat within a Kubernetes cluster, allowing for scalable, containerized, and manageable chat infrastructure.
What are the benefits of running Rocket.Chat on Kubernetes?
+
Running Rocket.Chat on Kubernetes offers easy scalability, high availability, automated deployment, and simplified management through container orchestration, ensuring reliable and flexible communication services.
How do I deploy Rocket.Chat on Kubernetes?
+
You can deploy Rocket.Chat using Helm charts or Kubernetes manifests, configuring persistent storage, load balancers, and environment variables to ensure proper operation and data persistence.
Can Rocket.Chat on Kubernetes handle enterprise-level workloads?
+
Yes, Kubernetes enables Rocket.Chat to scale horizontally, handle large numbers of users, and maintain uptime, making it suitable for enterprise communication needs.
What are common challenges when running Rocket.Chat on Kubernetes?
+
Challenges include managing persistent storage, configuring networking and ingress properly, securing the deployment, and monitoring resource usage to optimize performance.
Navdeep Garg, CEO of Revinfotech
Article written by

Navdeep Garg, CEO of Revinfotech

<p>I am the founder and CEO of Revinfotech Inc., with over 15 years of experience in leadership, financial services, FinTech, technology, and business management. I am a strategic business leader and hands-on practitioner with a strong track record ... read more

Inspired by These Insights? Let’s Talk.

From understanding trends to building solutions, we're here to help you take the next step. Our experts are ready to guide your digital transformation.

  Yes, I agree to the  terms and conditions*.
Enter the Captcha

Leave a Comment

Your email address will not be published. Required fields are marked *