Rocket Chat:Contrib

From SME Server
Jump to navigationJump to search

Contrib: [1]John Crisp

Important.png Note:
Please note that there is also a howto on manually installing Rocket.Chat here

However, due to dependencies a manual install will not work on SME

Version up to 0.61.2 will work with this contrib.

Later versions will need my newer smeserver-rocketchat-0.2.x contrib which uses docker.

smeserver-rocketchat contrib

Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.

There is no contrib for v10 as yet. I will work on it when I have time. These are just some notes for reference.

Current version


You may be able to install from source but chances are CentOS7 will be 'too old'

Latest source is here:

Required repos

Add repos:


config set rocketchat service TCPPort 3000 mailPort 25 mailURL localhost access public status enabled

signal-event post-upgrade;signal-event reboot

System ➔ startup
|                  SERVER RUNNING                    |
|                                                    |
|       Version: 0.xx.x                              |
|  Process Port: 3000                                |
|      Site URL:    |
|         OpLog: Disabled                            |
|                                                    |

You should now be able to connect to your Rocket.Chat instance

Registering a new account

Because the SME mail server is fussy you may find it easier to force some settings in the Rocket.Chat DB before trying to register:

You can set your SMTP host as localhost or

use rocketchat
db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":""}})
db.rocketchat_settings.update({"_id": "From_Email"}, {$set: {"value":""}})



Apache SSL with Proxypass

Important.png Note:
This is still experimental and there may be issues with SSL only for the Primary iBay and Letsencrypt. You will need a minimum version of smeserver-rocketchat-0.1-5

It is recommended to add Letsencrypt support as detailed below (see here for my contrib

Make a copy of the ProxyPassVirtualHosts dir

cp -e /etc/e-smith/templates/etc/httpd/conf/httpd.conf/ProxyPassVirtualHosts /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/ProxyPassVirtualRocketchat

Edit this file:


Replace the existing code with this:

   ProxyPreserveHost on
   SetEnv proxy-nokeepalive 1
   ProxyPass /.well-known/acme-challenge/ !

   DocumentRoot /home/e-smith/files/ibays/Primary/html

   <IfModule mod_proxy_wstunnel.c>
     ProxyPassMatch ^/sockjs/(.*)/websocket ws://localhost:3000/sockjs//websocket
     ProxyPass /websocket ws://localhost:3000/websocket

   ProxyPass / http://localhost:3000/
   ProxyPassReverse / http://localhost:3000/

   <Location />
       Require all granted

   <Location /.well-known/acme-challenge/>
       Require all granted

Save, and then run

signal-event webapps-update

Now we need to setup our subdomain for the reverse proxy

db domains set chat.mycompany.local domain Description RocketChat Nameservers internet \
TemplatePath ProxyPassVirtualRocketchat ProxyPassTarget http://localhost:3000/

It should look like this:

  Nameservers=internet (can be localhost)
  letsencryptSSLcert=enabled (with letsencrypt support)

We need to set Rocket.Chat to listen on localhost now:

config setprop rocketchat rootURL chat.mycompany.domain SSLProxy yes
signal-event remoteaccess-update
service rocketchat restart

If you can now successfully get to Rocketchat on your subdomain https://chat.mycompany.local you can disable default access on port 3000:

config setprop rocketchat access private
signal-event remoteaccess-update

You may find you need to clear your browser cache before it works correctly on https://chat.mycompany.local rather than http://chat.mycompany.local:3000

IF you have Letsencrypt support you can now set your main domain to SSL only:

db accounts setprop Primary SSL enabled
signal-event ibay-modify Primary


To upgrade rocketchat:

yum --enablerepo=reetp install rocketchat

To upgrade the rocketchat configurator:

yum --enablerepo=reetp install smeserver-rocketchat


Look for bugs :-) As the contrib is not in CVS please report them in the forum and I will try and keep an eye out.

Mongo DB examples


Example using mongo itself:

use rocketchat

Show all collections in DB

show collections

Show all entries in a collection

db.rocketchat_settings.find({"_id" : "SMTP_Host"})
db.rocketchat_settings.find({"_id" : "From_Email"})
db.rocketchat_settings.findOne({_id : "From_Email"}, {_id:0, value: 1})
db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1})
db.rocketchat_settings.update({"_id":"From_Email"}, {$set: {"value":""}})
db.rocketchat_settings.update({"_id":"SMTP_Host"}, {$set: {"value":""}})

Remove all entries in a collection (CAREFUL!!!!!!)




Some more mongo commands for reference

Directly check a specific user ID from bash:

mongo rocketchat --eval "db.users.find({'username':'usernamehere'}).forEach( function(u) { print(u._id + \" ; \" + u.username); } )"

Log into rocketchat database:

mongo rocketchat

Check out all the user IDs in the database:

db.users.find().forEach( function(u) { print(u._id + ";" + u.username); } ) 

Or just a specific user's ID:

db.users.find({'username':'usernamehere'}).forEach( function(u) { print(u._id + \" ; \" + u.username); } )

Replace specific user ID's password in the database:

db.users.update( {'_id': 'useridhere'}, {$set: {'services.password.bcrypt': 'bcryptedpasswordhere'}}, {multi:true} )

My only issue with above (only time I needed it for recovery purposes), was that I didn't know which tool to use to generate a bcrypted password. So in the hurry I copied the hash from one account I already knew (my own). If someone knows a good command for creating one directly in bash, I assume it would do.

There are bcrypt password generators online, and various libraries you can use

For listing out any passwords in the database I used:

 db.users.find().forEach( function(u) { print( + " ; " + u.username); } ) 

If you have deactivated users it may fail so use this for individual accounts.

However, you can get it for an individual user with:

db.users.find({'username':'SomeUserName'}).forEach( function(u) { print( + " ; " + u.username); } ) 

Set a user config item:

db.users.update( {'username': 'SomeUserName'}, {$set: {'settings.preferences.showMessageInMainThread': 'true'}} )

Find a single user:

db.getCollection('users').find( {'username':'SomeUserName'} )

Get limited information:

db.getCollection('users').find({}, {"username":1, "settings.preferences.showMessageInMainThread":1})

Reset 2FA nonsense:

db.users.update({'username': 'SomeUserName'}, {$unset: {'services.totp': 1}});
db.users.update({'username': 'SomeUserName'}, {$unset: {'services.email2fa': 1}});

Database Backup

You can dump the tables to a directory of your choice:

mongodump --dumpDbUsersAndRoles -d rocketchat -o /root/rocketchatmongo

Database Restore

You can restore you database as follows:

mongorestore --restoreDbUsersAndRoles -d rocketchat -dir  /root/rocketchatmongo/rocketchat --quiet

Node usage

  • This should go to a new Node page for reference

Use n, an extremely simple Node version manager that can be installed via npm (See

Say you want Node.js v0.10.x to build Atom.

npm install -g n   # Install n globally
n 0.10.33          # Install and use v0.10.33 local only


n                            # Output versions installed
n latest                     # Install or activate the latest node release
n stable                     # Install or activate the latest stable node release
n <version>                  # Install node <version>
n use <version> [args ...]   # Execute node <version> with [args ...]
n bin <version>              # Output bin path for <version>
n rm <version ...>           # Remove the given version(s)
n --latest                   # Output the latest node version available
n --stable                   # Output the latest stable node version available
n ls                         # Output the versions of node available

NPM Usage

To update your version of npm run the following

npm install -g npm

Or for a specific version:

npm install -g npm@3.10.9

DB settings

Typical standard setup:


Typical proxy subdomain setup:


Koozali SME v10

I am starting to look at running this under docker on v10

Some quick notes.

You will need


Docker Compose (because it makes it easier to template)

Mongo (I prefer to run a full instance rather than a docker one)

Make sure you add replicaset support in Mongo

I'll add more later, and try and make a full contrib in due course