How to deploy Rocket Chat 6.2.6 – Team Communication Tool in docker swarm behind Traefik v2.0
- Rajasekhar Gundala
- 16 Dec, 2019
Rocketchat is an open-source popular Team Collaboration Software that should replace email, HipChat, Slack & Microsoft Teams. Rocket Chat has a lot of features.
In this post, I going to show you how to deploy Rocket.Chat 2.3.2 in our Docker Swarm Cluster using Docker Compose as mentioned in my earlier post of MongoDB.
Rocketchat is an open-source popular Team Collaboration Software that should replace email, HipChat, Slack & Microsoft Teams. Rocket Chat has a lot of features.
Please make sure you should fulfill the below requirements before proceeding to the actual deployment.
-
Docker Swarm Cluster with GlusterFS as persistent tool.
-
Traefik as reverse proxy to expose micro-services to external.
-
Database stack to host application databases.
Introduction to Rocket Chat 6.2.6
Rocket Chat is a Web Chat Server, developed in JavaScript, using the Meteor full-stack framework.
Rocket Chat is free, unlimited and open source Team Collaboration Software that should replace email, HipChat, Slack & Microsoft Teams.
Communicate and collaborate with your team, share files, chat in real time or switch to video/audio conferencing.
It is a great solution for communities and companies wanting to privately host their own chat service or for developers looking forward to building and evolve their own chat platforms.
We can replace email, HipChat, Slack & Microsoft Teams with Rocket Chat, ultimate team chat software solution.
Rocket Chat Features
Rocket Chat has a lot of features, like Live Chat, Real-time translation, Endless Customization. You can take Rocket.Chat anywhere with web, desktop & mobile apps, Live Chat clients, and SDK.
A safe workspace with username restriction and admin transparency. Remove bad actors by adding moderators and provide admins with additional controls.
Customize your platform to tailor its exact look & feel by adding or removing features and selecting your own integrations, plugins & themes.
With complete access to the source code, you can fully customize, extend or add new functionality to meet your requirements
That’s the beauty of free software, free refers not only to price but also the freedom to have complete control over it.
The most common features of Rocket Chat are Free audio and video conferencing, guest access, screen sharing, file sharing, Live Chat, LDAP Group Sync, two-factor authentication (2FA), E2E encryption, SSO, and dozens of OAuth providers.
Also, unlimited features include
-
Users
-
Messages
-
Channels
-
Guests
-
Search
-
File Upload
If you want to learn more about Rocket Chat and its features, please go through the official URL.
Persist Rocket Chat Data
Containers are fast to deploy and make efficient use of system resources. Developers get application portability and programmable image management and the operations team gets standard run time units of deployment and management.
With all the known benefits of containers, there is one common misperception that the containers are ephemeral, which means if we restart the container or in case of any issues with it, we lose all the data for that particular container. They are only good for stateless micro-service applications and that it’s not possible to containerize stateful applications.
I am going to use GlusterFS to overcome the ephemeral behavior of Containers.
I already set up a replicated GlusterFS volume to have data replicated throughout the cluster if I would like to have some persistent data.
The below diagram explains how the replicated volume works.
Volume will be mounted on all the nodes, and when a file is written to the
/mnt
partition, data will be replicated to all the nodes in the Cluster
In case of any one of the nodes fails, the application automatically starts on other node without loosing any data and that’s the beauty of the replicated volume.
Persistent application state or data needs to survive application restarts and outages. We are storing the data or state in GlusterFS and had periodic backups performed on it.
We will use a backup of the volume to spin a new application container anywhere else in case of unexpected issues occur in the current environment.
I am going to persistent /app/upload
folder of Rocket Chat
Create folder in /mnt
directory to persistent Rocker Chat Upload data folder, /app/upload
cd /mnt
sudo mkdir -p rocketchatupload
Prepare Rocket Chat Environment
I am going to use docker compose
to prepare environment file for deploying Rocket Chat application. The compose file is known as YAML ( YAML stands for Yet Another Markup Language) and has extension .yml or .yaml
I am going to create application folders in
/opt
location in Ubuntu to store configuration files, nothing but docker compose files (.yml or .yaml).
Now it’s time to create a folder, rock
inside /opt
directory and also place configuration file, rock.yml
inside of it to deploy Rocket Chat using docker-compose.
Use the below commands to create the folder.
Go to /opt
directory by typing cd /opt
in Ubuntu console
Make a folder in /opt
with sudo mkdir -p rock
Let’s get into rock
folder by typing cd rock
Now create docker compose
file inside rock
folder using sudo touch rock.yml
Open rock.yml
docker-compose file with nano editor using sudo nano rock.yml
and copy and paste the below code in it.
Rocket Chat Docker Compose
Here is the docker compose
file for Rocket Chat. I am going to utilize the MongoDB stack as a back-end database for it that was deployed in the previous post.
version: "3.7"
services:
rocketchat:
image: rocketchat/rocket.chat:latest
volumes:
- /mnt/chatuploads:/app/uploads
depends_on:
- mongo
environment:
- PORT=3000
- ROOT_URL=http://127.0.0.1:3000
- MONGO_URL=mongodb://mongo/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo/local
- Accounts_UseDNSDomainCheck=False
- ADMIN_USERNAME=user
- ADMIN_PASS_FILE=/run/secrets/rock_password
- ADMIN_EMAIL=user@example.com
networks:
- proxy
ports:
- "3000:3000"
deploy:
placement:
constraints: [node.role == worker]
replicas: 1
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.rocketchat.rule=Host(`team.example.com`)"
- "traefik.http.routers.rocketchat.tls=true"
- "traefik.http.routers.rocketchat.tls.certresolver=default"
- "traefik.http.routers.rocketchat.entrypoints=websecure"
- "traefik.http.services.rocketchat.loadbalancer.server.port=3000"
volumes:
chatuploads:
driver: "local"
networks:
proxy:
external: true
I used Traefik stack that was deployed (
proxy stack
) earlier to Docker Swarm Cluster as a reverse proxy / load balancer.
Also
proxy
docker overlay network for the application to be accessible externally.
Deploy Rocket Chat using Docker Compose
Now it’s time to deploy our docker compose
file above, rock.yml
using the below command
docker stack deploy --compose-file rock.yml rock
In the above command, you have to replace rock.yml
with your docker-compose file name and rock with whatever name you want to call this particular application.
As mentioned earlier I named my docker-compose as rock.yml
and named my application stack as rock
With docker compose in docker swarm what ever we are deploying is called as docker stack and it has multiple services in it as per the requirement.
Check rock
stack status using docker stack ps rock
We can use docker service logs rock
to see rock
stack logs
Access or Install Rocket Chat
Now type http://team.example.com
in the browser of choice, it will automatically redirect to https://team.example.com/home
( Be sure to replace example.com
in the example above with your actual domain name
).
Make sure that you have DNS entry for your application (team.example.com) in your DNS Management Application.
Fill in the details in the setup wizard to continue.
-
Your name
-
Your user name (admin)
-
Your email address
-
Your password.
Click on Continue to go to the next step.
You will be asked to provide your organization’s information. Fill in the required information and click on continue.
Next, you will be asked to provide information about your Rocket.Chat instance. Fill in your site name, language, and if you want to have a private or public community. Then click on continue.
In the final step of the setup, you will be asked if you want to keep your server as a stand-alone instance or if you want to register it with Rocket.Chat to have access to additional functions and resources. Keep the instance standalone.
Once the setup is completed, you can access your Rocket.Chat and be the first user in the #general channel
Please find below images for your reference.
We can customize the login screen of the Rocket Chat instance by going to the Assets option in the Administration window. See the below image for reference.
Rocket Chat is trusted by blockchain innovators such as Aragon, Brave, Hyperledger, Golem, and Token.
If you want to migrate from other platforms to Rocket Chat, there are plenty of tools available.
Migrating from Slack. Do so easily with Slack Importer and Slack Bridge.
Migrating from Atlassian? There is HipChat Importers for the purpose.
Now we have Rocket Chat Team Collaboration installed in our Docker Swarm successfully.
Stay tuned for Wekan (Open Source Kanban) deployment in the next post…🙄
Let me know your feedback or thoughts by commenting on it below.