OpenSUSE Leap 42.2

Install and Run Rocket.Chat on OpenSUSE Leap 42.2

Note: This is a community supported installation method. You can discuss about this in the forum threadarrow-up-right.

Last updated 2017-08-26

Node.js version: 8.9.3

Rocket.Chat version: 0.60.0

These are barebones instructions for how to set up a Rocket.Chat server on OpenSUSE Leap 42.2 using nginx as a reverse proxy. These will help you set up a system you can experiment with. THEY ARE NOT INTENDED FOR SETUP OF A PRODUCTION SYSTEM! They are oriented on using a VM from AWS, but should work for any Leap 42.2 system.

Overview

You will install and configure:

  1. Node.js

  2. MongoDB

  3. Let's Encrypt SSL certificates

  4. nginx

  5. Rocket.Chat and its dependencies

To do this, you will:

  1. Acquire a VM to install on

  2. Install all the packages you'll need

  3. Start and configure MongoDB

  4. Install Let's Encrypt SSL certificates

  5. Configure and start nginx

  6. Install and start Rocket.Chat

Things you'll need to do afterwards on your own, especially if you want a production-worthy system:

  • Create a systemctl script to restart Rocket.Chat if the server is rebooted

  • Configure email on the server (so Rocket can request account validation)

  • Secure the server (e.g. get rid of the default user on a VM, etc.)

  • Monitor the server so you can respond if it goes down

    • Rocket.Chat availability

    • MongoDB availability

    • nginx availability

  • Configure MongoDB for production use

    • Use an XFS volume

    • Use persistent (e.g. non-local) storage if you're using a VM

    • Configure replica sets

    • Consider setting /sys/kernel/mm/transparent_hugepage/enabled to "never" as recommended by Mongo at startup

  • Set up periodic updates for the system

Acquire a VM with OpenSUSE Leap 42.2

I like to use AWS spot instances as a very cheap way to experiment with things. I find I can usually get an m3.medium (1 vCPU, 3.75GB RAM) for ~$0.01/hour, or ~$7/month if run continuously. Pick the right region and you'll rarely if ever be shut down.

There's a spot_instance.json below that I generally use to set up an instance. I already have a few security groups to lock down all but the ports I need, an IAMS profile to allow just the privileges I want, and an SSH keypair generated; I'm not going to tackle those here, so if you want to do this, you probably should do some quick research and set those up yourself.

I also use the AWS CLI, so it's preconfigured for my favorite region, credentials, etc. If you don't have that set up, you'll want to.

When you've got those set, getting an instance is really straightforward:

Note: if you get an error saying that you must subscribe to the AMI before using it, copy the URL in the error message and open it in a browser. The "subscription" costs $0.00/hour, so it's just a formality.

Configure the Box

The default user in the Leap 42.2 image is ec2-user. You'll ssh into the box using that user, and immediately become root.

Update and Install Packages using zypper

  1. Add the repo for MongoDB

  2. Refresh metadata for all repos

  3. Update all the packages on the box

  4. Install the new packages we need

Start and Configure MongoDB

  1. Enable and start MongoDB

  2. Create the admin user

  3. Create the DB and user for Rocket.Chat

In a shell:

Now start a MongoDB shell and add the admin user:

Now re-open a MongoDB shell as your admin user and create the Rocket.Chat db and admin user. You'll use these later to tell Rocket how to access its DB.

Note: Don't use : or @ in this user's password or you'll need to URL escape them later. It's easier to avoid those characters.

Install Let's Encrypt SSL Certificates

This is so crazy easy. Remember when this was hard, and when it cost $20-$200 per year? Please consider using one of the donation links given afterwards as a way to support continued development of CertBot.

Replace YOUR.SERVER.NAME below with the hostname your server will be accessed from, e.g. chat.example.com, and replace YOUR@EMAIL.ADDRESS with your email address, e.g. admin@example.com

Configure and Start nginx

  1. Set up a more modern site config management scheme

  2. Set the base nginx config

  3. Add the config needed for Rocket.Chat

  4. Enable and start nginx

Now do two things:

  1. Replace the contents of /etc/nginx.conf with the nginx.conf below.

  2. Copy the contents of rocket_chat.conf below to /etc/nginx/sites-available/rocket_chat.conf

Now you can enable the Rocket.Chat config, then enable and start nginx

Install and Configure Rocket.Chat

  1. Add a rocket user and group

  2. Download the latest Rocket.Chat

  3. Install all the node.js dependencies for Rocket.Chat using npm

  4. Set the required environment variables

  5. Start the Rocket.Chat server

Replace YOUR.SERVER.NAME below with the hostname your server will be accessed from, e.g. chat.example.com

If everything is working as planned, you'll see something like:

... and that's Rocket.Chat all set. Direct a browser to https://YOUR.SERVER.NAME and register a yourself as new user. The first user you register will be made the server admin.

Sources

These are docs and snippets I used to figure all of this out.

Deploy with Ubuntuchevron-rightDeploy with AWSchevron-right

Config Files

/etc/nginx.conf

This config relies on you creating /etc/nginx/sites-available and /etc/nginx/sites-enabled

/etc/nginx/sites-available/rocket_chat.conf

Replace YOUR.SERVER.NAME below with the hostname your server will be accessed from, e.g. chat.example.com

spot_instance.json

Replace Subnet-Id, Arn, and SecurityGroupIds content below with your own. The ImageId given is for the OpenSUSE Leap 42.2 AMI.