Easy methods to Deploy Rocket.Chat on Ubuntu 18.04

Rocket.Chat is an open-source group communication platform, a self-hosted Slack various. It’s developed utilizing the Meteor framework and supplies numerous options together with helpdesk chat, file sharing, video conferencing, voice messages, API, and extra.

Rocket.Chat is an ideal resolution for firms and communities that need to host their very own chat system.

On this tutorial, we are going to present you how one can deploy Rocket.Chat on an Ubuntu 18.04 server and configure Nginx as an SSL reverse proxy.

Conditions #

Earlier than continuing with this tutorial, just remember to have the next conditions.

  • Ubuntu 18.04 server. In response to the official Rocket.Chat system necessities you want no less than 1G of RAM.
  • A website title pointing to your server IP handle. We’ll use chat.instance.com.
  • Nginx put in, by following this tutorial.
  • You may have an SSL certificates put in on your area. You’ll be able to generate a free Let’s Encrypt SSL certificates by following this tutorial.

Putting in Node.js #

Begin by updating your system packages checklist:

sudo apt replace

Set up Node.js, npm and all different dependencies required for constructing npm packages from supply:

sudo apt set up nodejs npm build-essential curl software-properties-common graphicsmagick

On the time of writing this text, the beneficial Node.js model for Rocket.Chat is Node.js v8.11.3.

We will use n, a npm package deal which permits us to interactively handle the Node.js variations.

Challenge the next instructions to put in n and the beneficial Node.js model:

sudo npm set up -g inherits nsudo n 8.11.3

Putting in MongoDB #

MongoDB is a NoSQL document-oriented database and it’s utilized by Rocket.Chat as an information retailer.

We’ll set up MongoDB from the official MongoDB repositories.

Import the MongoDB public key and allow the official MongoDB repository with the next command:

sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 9DA31620334BD75D9DCB49F368818C72E52529D4sudo add-apt-repository ‘deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.Zero multiverse’

As soon as the apt repository is enabled replace the packages checklist and set up MongoDB by typing:

sudo apt updatesudo apt set up mongodb-org

As soon as the set up is accomplished, allow and begin the MongoDB service:

sudo systemctl begin mongodsudo systemctl allow mongod

Create new System Person #

To create a brand new consumer and group named rocket, that can run the Rocket.Chat occasion, sort:

sudo useradd -m -U -r -d /decide/rocket rocket

Add the www-data consumer to the brand new consumer group and alter the /decide/rocket listing permissions in order that the Nginx can entry the Rocket.Chat set up:

sudo usermod -a -G rocket www-datasudo chmod 750 /decide/rocket

Putting in Rocket.Chat #

Change over to the consumer rocket:

sudo su – rocket

The next instructions assume that you’re presently working as consumer rocket.

Obtain the most recent steady model of Rocket.Chat with curl:

curl -L https://releases.rocket.chat/newest/obtain -o rocket.chat.tgz

As soon as the obtain is accomplished extract the archive and rename the listing to Rocket.Chat:

tar zxf rocket.chat.tgzmv bundle Rocket.Chat

Grow to be the Rocket.Chat/applications/server listing and set up all required npm packages:

cd Rocket.Chat/applications/servernpm set up

With a purpose to check our set up earlier than creating systemd unit and establishing a reverse proxy with Nginx we are going to set the required surroundings variables and begin the Rocket.Chat server

export PORT=3000export ROOT_URL=http://0.0.0.0:3000/export MONGO_URL=mongodb://localhost:27017/rocketchat

Change again into the Rocket.Chat listing and begin the Rocket.Chat server by issuing the next instructions:

cd ../../node foremost.js

If there aren’t any errors you must see the next output:

➔ +———————————————+
➔ | SERVER RUNNING |
➔ +———————————————+
➔ | |
➔ | Rocket.Chat Model: 0.71.1 |
➔ | NodeJS Model: 8.11.3 – x64 |
➔ | Platform: linux |
➔ | Course of Port: 3000 |
➔ | Web site URL: http://0.0.0.0:3000/ |
➔ | ReplicaSet OpLog: Disabled |
➔ | Commit Hash: e73dc78ffd |
➔ | Commit Department: HEAD |
➔ | |
➔ +———————————————+

Cease the Rocket.Chat server with CTRL+C.

Swap again to your sudo consumer by typing exit and proceed with the following steps.

Create a Systemd unit #

To run Rocket.Chat as a service we are going to create a rocketchat.service unit file within the /and so forth/systemd/system/ listing.

sudo nano /and so forth/systemd/system/rocketchat.service

Paste the next content material:

/and so forth/systemd/system/rocketchat.service

[Unit]
Description=Rocket.Chat server
After=community.goal nss-lookup.goal mongod.goal

[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
Person=rocket
Setting=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=https://chat.instance.com PORT=3000
ExecStart=/usr/native/bin/node /decide/rocket/Rocket.Chat/foremost.js

[Install]
WantedBy=multi-user.goal

Notify systemd that we now have created a brand new unit file and begin the Rocket.Chat service by executing:

sudo systemctl daemon-reloadsudo systemctl begin rocketchat

Examine the service standing by typing:

sudo systemctl standing rocketchat* rocketchat.service – Rocket.Chat server
Loaded: loaded (/and so forth/systemd/system/rocketchat.service; disabled; vendor preset: enabled)
Lively: lively (operating) since Wed 2018-11-07 14:36:24 PST; 5s in the past
Primary PID: 12693 (node)
Duties: 10 (restrict: 2319)
CGroup: /system.slice/rocketchat.service
`-12693 /usr/native/bin/node /decide/rocket/Rocket.Chat/foremost.js

Lastly, allow the Rocket.Chat service to be routinely began at boot time with the next command:

sudo systemctl allow rocketchat

Arrange a reverse proxy with Nginx #

Should you adopted our how one can set up Nginx on Ubuntu 18.04 and how one can safe Nginx with Let’s Encrypt on Ubuntu 18.04 guides you must have already got Nginx put in and configured with SSL certificates.

Now we have to create a brand new Nginx server block for the Rocket.Chat set up.

Open your textual content editor and create the next file:

sudo nano /and so forth/nginx/sites-available/chat.instance.com.conf

/and so forth/nginx/sites-available/chat.instance.com.conf

upstream rocketchat_backend {
server 127.0.0.1:3000;
}

server {
pay attention 80;
server_name chat.instance.com;

embrace snippets/letsencrypt.conf;
return 301 https://chat.instance.com$request_uri;
}

server {
pay attention 443 ssl http2;
server_name chat.instance.com;

ssl_certificate /and so forth/letsencrypt/dwell/chat.instance.com/fullchain.pem;
ssl_certificate_key /and so forth/letsencrypt/dwell/chat.instance.com/privkey.pem;
ssl_trusted_certificate /and so forth/letsencrypt/dwell/chat.instance.com/chain.pem;
embrace snippets/ssl.conf;

access_log /var/log/nginx/chat.instance.com-access.log;
error_log /var/log/nginx/chat.instance.com-error.log;

location / {
proxy_pass http://rocketchat_backend/;
proxy_http_version 1.1;
proxy_set_header Improve $http_upgrade;
proxy_set_header Connection “improve”;
proxy_set_header Host $http_host;

proxy_set_header X-Actual-IP $remote_addr;
proxy_set_header X-Ahead-For $proxy_add_x_forwarded_for;
proxy_set_header X-Ahead-Proto http;
proxy_set_header X-Nginx-Proxy true;

proxy_redirect off;
}
}

Allow the brand new server block by making a symbolic hyperlink from the file to the sites-enabled listing:

sudo ln -s /and so forth/nginx/sites-available/chat.instance.com.conf /and so forth/nginx/sites-enabled/

Reload the Nginx service for adjustments to take impact:

sudo systemctl reload nginx

Configuring Rocket.Chat #

Open your browser and sort: http://chat.instance.com.

Assuming that the set up is profitable, you will be introduced with the Rocket.Chat Setup Wizard which can information you thru establishing your first admin consumer, configuring your group and registering your server to obtain free push notifications and extra.

The primary part of the Preliminary Setup wizard will ask you to arrange your Admin consumer:

As soon as you might be finished coming into the Admin information click on on the Proceed button and within the subsequent step enter your group information:

The third part of the Preliminary Setup wizard will immediate you to enter the server data:

Within the subsequent step, you may be requested whether or not you need to use the Rocket.Chat’s preconfigured gateways and proxies. Choosing this selection offers you entry to the Rocket.Chat Apps market and different options reminiscent of push notifications will work out of the field.

Make your selection, click on on the Proceed button, and you may be redirected to the next web page indicating that your workspace is able to use:

Click on on the Go to your workspace button and you may be redirected to the Rocket.Chat dashboard logged in because the admin consumer.

Conclusion #

On this tutorial, you realized how set up Rocket.Chat on Ubuntu 18.04 and how one can setup Nginx as a reverse proxy.

It’s best to now go to the Rocket.Chat Documentation web page and be taught extra about your new chat system.

If you’re going through any downside with the set up, be at liberty to go away a remark.

Supply

Germany Devoted Server

Leave a Reply