Rocket.Chat is an open source chat system that facilitates team communication by replacing emails with channels, similarly to Slack.
You can try the service by registering at https://open.rocket.chat.
Create the VPS
We will install it on a server with 1 vCore, 2GB of RAM, and 10GB of hard disk space. We will use the Docker image with Ubuntu 18.04. As always, resource requirements will vary depending on the number of users who will use the system.
You need to open the following ports in the Firewall settings:
- 22/TCP: for connecting through SSH
- 80/TCP (optional): the connection will initially use HTTPS, but this port can be opened for development and testing.
- 443/TCP: to provide the service through HTTPS
First of all, we need to install: docker-compose: apt install docker-compose
Installation
As mentioned, we will use Docker to deploy Rocket, creating the following containers:
- Rocket.Chat
- MongoDB: will host the database
We will not deploy the Nginx web server and Let's Encrypt in containers.
Nginx and Let's Encrypt
To install Nginx on our server: apt install nginx
We must configure an SSL certificate to allow access through HTTPS. Using a verified certificate is recommended; in our case, we will use one from Let's Encrypt.
Install certbot:
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install certbot python3-certbot-nginxModify the nginx configuration file vim /etc/nginx/sites-available/default:
# HTTPS Server
server {
listen 443 ssl;
server_name ejemplo.dominio.com;
error_log /var/log/nginx/rocketchat_error.log;
location / {
proxy_pass http://127.0.0.1:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}Restart nginx: service nginx configtest && service nginx restart and then run certbot --nginx:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: ejemplo.dominio.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for ejemplo.dominio.com
Using default address 80 for authentication.
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/default
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
No matching insecure server blocks listening on port 80 found.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled
ejemplo.dominio.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=DOMINIO
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/ejemplo.dominio.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/ejemplo.dominio.com/privkey.pem
Your cert will expire on 2020-07-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le Docker
First, we will create the directories needed for the Docker volumes:
mkdir -p /var/www/rocket.chat/data/runtime/db
mkdir -p /var/www/rocket.chat/data/dumpCreate the docker-compose file vim /var/www/rocket.chat/docker-compose.yml and add the following code to it:
{YAML}
version: '2'
services:
rocketchat:
image: rocket.chat:latest
command: bash -c 'for i in `seq 1 30`; do node main.js && s=$$? && break || s=$$?; echo "Tried $$i times. Waiting 5 secs..."; sleep 5; done; (exit $$s)'
restart: unless-stopped
volumes:
- ./uploads:/app/uploads
environment:
- PORT=3000
- ROOT_URL=DOMINIO
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
- Accounts_UseDNSDomainCheck=false
depends_on:
- mongo
ports:
- 3000:3000
mongo:
image: mongo:4.0e
restart: unless-stopped
volumes:
- ./data/db:/data/db
- ./data/dump:/dump
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
mongo-init-replica:
image: mongo
command: 'bash -c "for i in `seq 1 30`; do mongo mongo/rocketchat --eval \"rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})\" && s=$$? && break || s=$$?; echo \"Tried $$i times. Waiting 5 secs...\"; sleep 5; done; (exit $$s)"'
depends_on:
- mongoWe can now access our Rocket.chat at https://ejemplo.dominio.com (only HTTPS connections will work)
Finally, we must configure nginx to run at startup, so we run: systemctl enable nginx
Note
You may initially see a 502: Bad Gateway error while it is starting up. This is resolved by waiting for the service to load, which takes a couple of minutes at most.
Configuration
When we access it, the first screen we will see is the following:
It asks us for the system administrator's details.
Then it will ask us for certain details to display and information about the server:
Usage
If you are familiar with similar tools such as Slack, you will find it very easy to use.
Conversations are grouped into channels. Initially, there will only be one general channel that all users who register will join. You can create as many groups as you like, both public and private.
The site administrator also has several reports available in the corresponding tab, and can install extensions (such as Jitsi for video conferencing) or manage users.
For more information about what this tool can do, we recommend visiting its documentation.
CC-BY - This article was written by David Población, a regular Clouding contributor.