Home » INSIGHTS » blogs » Rocket Chat on kubernets

Rocket Chat on kubernets

5 min read


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.

Our 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

3. Creating image for MongoDB Container

Prepare a new folder by the name of MongoDB.

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

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:

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>

6. Shifting PostgreSQL image to the container registry

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

  • Google Container Registry
  • 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:

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

For tagging 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.

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.

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.

10. 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.

Create a Web Design that Looks Perfect on Every Device

Request Free Consultation

    Contact Us
    Attachment if any