What is Rocket Chat? is a Web Chat Server, developed in JavaScript, using the full stack framework. It is a great solution for communities and companies who wants to privately host their own chat service or for developers who are looking forward to build and evolve their own chat platforms. Rocket.Chat Meteor The Rocket.Chat is an open-source chat platform. It have various features which include - Help Desk Chat File Sharing Video Conference Voice Messages Link Preview API Integration Prerequisites To follow this guide you need - Kubernetes Cluster GlusterFS Cluster Rocket Chat Application Step 1 — Create a Rocket Chat Container Image Create a file name “Dockerfile” for Rocket.Chat. This image contains our custom code for rocket chat and docker file which will look like - FROM node:4-slim MAINTAINER XenonStack COPY bundle/ /app/ RUN cd /app/programs/server \&& npm install ENV PORT=3000 \ ROOT_URL=http://localhost:3000 EXPOSE 3000 CMD ["node", "/app/main.js"] Rocket Chat Docker image has a base image of Node.js Version 4. After that, we put our custom code to the container and install all the required dependencies in Rocket Chat container. Later we put MongoDB URL as the environment variable for the database connection. Rocket Chat application is started in the dforeground mode so that we can see logs in “stdout” of the container. Step 2 — Build Rocket Chat Docker Image $ docker build -t dr.xenonstack.com:5050/rocketchat:v1.0 Step 3 — Create a MongoDB Container Image Create a file name “Dockerfile” for and docker file will look like - MongoDB FROM ubuntu MAINTAINER XenonStack RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \ echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list && \ apt-get update && \ apt-get install -y mongodb-org VOLUME ["/data/db"] WORKDIR /data EXPOSE 27017 CMD ["mongod"] MongoDB Docker image has a base image of Ubuntu. We have created this dockerfile for MongoDB Version 3.0 for some compatibility issues with Rocket Chat. Next, we mount Volume “/data/db” for persistent storage of container. Next, we expose 27017 port for incoming requests to MongoDB server. Then, we start MongoDB server in dforeground mode so that we can see logs in “stdout” of the container. Step 4 — Building a MongoDB Docker Image $ docker build -t dr.xenonstack.com:5050/mongo:v3.0 Step 5 — Create a Storage Volume (Using GlusterFS) Using below mentioned command we create a volume in GlusterFS cluster for MongoDB. As we don’t want to lose our Database data just because a server dies in the cluster, so we put replica, 2 or more if we want the higher availability of data. $ gluster volume create apt-cacher replica 2 transport tcp k8-master:/mnt/brick1/mongodb-disk k8-1:/mnt/brick1/mongodb-disk $ gluster volume start mongodb-disk $ gluster volume info mongodb-disk Step 6 — Deploy MongoDB on Kubernetes Deploying MongoDB on Kubernetes have following prerequisites - We have created a Docker Image for MongoDB in Step 4 Docker Image: We have created a Persistent Shared Storage Volume in Step 5 Persistent Shared Storage Volume: Deployment & Service Files: Next, we will create Deployment & Service Files. Deployment & Service Files: Now let’s create a file name “deployment.yml” for MongoDB. This deployment file will look like - apiVersion: extensions/v1beta1 kind: Deployment metadata: name: mongodb3 namespace: production spec: replicas: 1 template: metadata: labels: k8s-app: mongodb3 spec: containers: - name: mongodb3 image: dr.xenonstack.com:5050/mongo:v3.0 imagePullPolicy: "IfNotPresent" ports: - containerPort: 27017 volumeMounts: - mountPath: /data/db name: mongodisk1 volumes: - name: mongodisk1 glusterfs: endpoints: glusterfs-cluster path: mongodb-disk readOnly: false We also need to create a file named “service.yml” for MongoDB. This service file will look like - Read The Full Article at — XenonStack.com/Blog
Share Your Thoughts