Difference between revisions of "Rocket Chat"

From SME Server
Jump to navigationJump to search
 
(263 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{WIP box}}
+
{{Level|Advanced}}
 
<blockquote style="float: right;">
 
<blockquote style="float: right;">
 
[[File:Rocket-dot-chat-logo.png|200px]]
 
[[File:Rocket-dot-chat-logo.png|200px]]
 
</blockquote>
 
</blockquote>
 +
{{Warning box| Due to the changes in Rockets requirements noted below please see the [[Rocket_Chat:Contrib|Rocket Chat Contrib]] This will run Rocket in a docker container}}
 +
{{Warning box| Most of the following is obsolete but here for posterity and reference}}
 +
 +
===Maintainer===
 +
'''Maintainer:''' [mailto:RequestedDeletion@gmail.com[[User:RequestedDeletion|RequestedDeletion]]]
  
 
==About==
 
==About==
"[https://rocket.chat/ Rocket.Chat,] the ultimate webchat platform. From group messages and video calls all the way to helpdesk killer features. Our goal is to become the number one cross-platform open source chat solution"
+
"[https://rocket.chat/ Rocket.Chat,] the ultimate webchat platform. From group messages and video/audio calls all the way to helpdesk killer features. Our goal is to become the number one cross-platform open source chat solution"
 
* '''Messaging''' Direct and group messages, public or private.
 
* '''Messaging''' Direct and group messages, public or private.
 
* '''Video Conference''' Chat with your colleagues and friends face-to-face over audio and video. [https://github.com/RocketChat/Rocket.Chat/pull/989 '''See details'''.] Test your device [https://test.webrtc.org/ here].
 
* '''Video Conference''' Chat with your colleagues and friends face-to-face over audio and video. [https://github.com/RocketChat/Rocket.Chat/pull/989 '''See details'''.] Test your device [https://test.webrtc.org/ here].
 
* '''Helpdesk chat''' Have your website visitors contact you in real-time and increase conversions.
 
* '''Helpdesk chat''' Have your website visitors contact you in real-time and increase conversions.
 
* '''File sharing''' Drag-and-drop files or select them from your computer or mobile device.
 
* '''File sharing''' Drag-and-drop files or select them from your computer or mobile device.
 +
* '''Screen sharing''' Select any window to share with your audience.
 
* '''Voice messages''' Record and transmit voice messages to a channel, group or private conversation.
 
* '''Voice messages''' Record and transmit voice messages to a channel, group or private conversation.
 
* '''Link preview''' Post a link and immediately view its content. YouTube, Twitter, Gifs!
 
* '''Link preview''' Post a link and immediately view its content. YouTube, Twitter, Gifs!
Line 17: Line 23:
 
* '''Mobile applications''' Mobile client applications available for iOS and Android on their respective stores.
 
* '''Mobile applications''' Mobile client applications available for iOS and Android on their respective stores.
  
In short, a [https://slack.com/ Slack] or [https://www.hipchat.com/ HipChat] alternative completely and securely self hosted and controlled. Great for closed (company) teams.
 
  
==RAW NOTES==
+
In short, a [https://slack.com/ Slack], [https://www.hipchat.com/ HipChat], Jabber (XMMP), IRC or even a [https://skype.com Skype] alternative, completely and '''securely self hosted and controlled'''. Great for closed (company/family/friends/community) teams.
RocketChat install script for SME Server 9.x 64-bit only!<br>Copyright 2016 RequestedDeletion (RequestedDeletion@gmail.com)
 
  
===Add epel repo===
+
{{Note box|Rocket.Chat is a young project and therefore under very active development. Very regularly they release new (minor) versions. Your mileage may vary! Please see their [https://github.com/RocketChat/Rocket.Chat development] on [https://github.com/RocketChat/Rocket.Chat GitHub] for the activities and Rocket.Chat developments.}}
/sbin/e-smith/db yum_repositories set epel repository \
 
Name 'Epel - EL6' \
 
BaseURL 'http://download.fedoraproject.org/pub/epel/6/$basearch' \
 
MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch' \
 
EnableGroups no \
 
GPGCheck yes \
 
GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
 
Exclude perl-Razor-Agent \
 
Visible no \
 
status disabled
 
  
===Add Centos-rh SCL repo’s===
+
==Obsolete Notes==
/sbin/e-smith/db yum_repositories set scl \
 
repository Name 'Software collections' \
 
BaseURL 'http://mirror.centos.org/centos/$releasever/SCL/$basearch/' \
 
EnableGroups no Visible yes status disabled
 
  
  
/sbin/e-smith/db yum_repositories set centos-sclo-rhl \
+
This how-to can be discussed on the forums [https://forums.contribs.org/index.php/topic,52405.0.html '''here''']
repository Name 'Software collections' \
+
Latest Rocket.Chat version tested: '''0.39''' (please see the change log [https://github.com/RocketChat/Rocket.Chat/releases here]).
BaseURL 'http://mirror.centos.org/centos/$releasever/sclo/$basearch/rh/' \
 
EnableGroups no Visible yes status disabled
 
Expand new repo’s
 
signal-event yum-modify
 
  
===Install Software Collections applications===
+
==Requirements==
yum install rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server nodejs010 GraphicsMagick --enablerepo=centos-sclo-rhl,epel
+
{{Warning box|Please be aware that for now only Rocket.Chat up to version '''0.39''' can be installed due to dependencies on the Nodejs version available via software collections.}}
 +
Rocket.Chat requires several higher versions of applications and frameworks than provided by Koozali SME Server by default. Therefore we need to install some '''[[Software Collections]]''' Packages and enable some addition repo's.
  
using NPM:
+
# You must have '''SME Server 9.x 64-bit'''
scl enable nodejs010 bash
+
# You must install the '''[[epel]]''' repository
npm install -g inherits
+
# You must install the '''[[centos-sclo-rh]]''' repository
npm install -g n
+
# You must install the '''[[Software Collections]]''' tool
n 0.10.40
 
exit
 
  
===Start Mongodb as service===
+
After having installed the above repo's and installing Software Collections, you can install the required collections by:
(please note the usage of mongod and NOT mongodb)
+
  yum install rh-python34-python rh-mongodb32-mongodb rh-mongodb32-mongodb-server nodejs010 GraphicsMagick --enablerepo=centos-sclo-rh,epel
  ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S99rh-mongodb26-mongod
 
config set rh-mongodb26-mongod service
 
config setprop rh-mongodb26-mongod status enabled
 
config setprop rh-mongodb26-mongod access private
 
config setprop rh-mongodb26-mongod TCPPort 27017
 
  
===Create boot scripts for Software Collections applications===
+
After installing the Software Collections we need to update some packages using NodeJS package manager NPM:
nano -w /etc/profile.d/scls-rh-mongodb26.sh
+
scl enable nodejs010 'npm install -g npm ws inherits n forever forever-service'
#!/bin/sh
+
  scl enable nodejs010 'n 0.10.40'
source /opt/rh/rh-mongodb26/enable
 
  export X_SCLS="`scl enable rh-mongodb26 'echo $X_SCLS'`"
 
export ROOT_URL=http://localhost:3000/
 
export PORT=3000
 
export MONGO_URL=mongodb://localhost:27017/rocketchat
 
  
nano -w /etc/profile.d/scls-rh-python34.sh
+
== Installation of Rocket.Chat==
#!/bin/sh
+
First we need to create the SME Server services:
source /opt/rh/rh-python34/enable
 
export X_SCLS="`scl enable rh-python34 'echo $X_SCLS'`"
 
  
nano -w /etc/profile.d/scls-rh-java-common.sh
+
For Rocket.Chat:
#!/bin/sh
+
ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99rocketchat
source /opt/rh/rh-java-common/enable
+
  config set rocketchat service status enabled TCPPort 3000 access public
  export X_SCLS="`scl enable rh-java-common 'echo $X_SCLS'`"
 
  
nano -w /etc/profile.d/scls-nodejs010.sh
+
For MongoDB (please note the usage of mongod and NOT mongod'''b'''):
#!/bin/sh
+
ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99rh-mongodb32-mongod
source /opt/rh/nodejs010/enable
+
  config set rh-mongodb32-mongod service status enabled access private TCPPort 27017
  export X_SCLS="`scl enable nodejs010 'echo $X_SCLS'`"
 
  
===Create SME Server Rocket.Chat service===
+
And to update the ports:
config set rocketchat service status enabled TCPPort 3000 access public
 
 
  signal-event remoteaccess-update
 
  signal-event remoteaccess-update
  
A reboot at this point is required to load all of the Software Collections profile/config files.
+
Now we can download and install the latest Rocket.Chat version from their [https://rocket.chat/releases/ downloads] repository:
signal-event reboot
 
 
 
===Get Rocket.Chat from [https://rocket.chat/releases/ downloads]===
 
 
  cd /root
 
  cd /root
  curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
+
  curl -L https://rocket.chat/releases/0.39.0/download -o rocket.chat.tgz
 
  tar zxvf rocket.chat.tgz
 
  tar zxvf rocket.chat.tgz
 
  mv bundle /opt/Rocket.Chat
 
  mv bundle /opt/Rocket.Chat
 +
 +
Once Rocket.Chat has been downloaded and unpacked, we need to 'register' Rocket.Chat with NodeJS with NPM:
 
  cd /opt/Rocket.Chat/programs/server
 
  cd /opt/Rocket.Chat/programs/server
  npm install
+
  scl enable nodejs010 'npm install'
  
===Start Rocket.Chat===
+
Rocket.Chat has now been installed and you can test-drive you installation.
 +
 
 +
First we need to set some environment variables manually (Please use your own correct settings):
 +
export ROOT_URL=http://yourserver.com/
 +
export MONGO_URL=mongodb://localhost:27017/rocketchat
 +
export PORT=3000
 +
export MAIL_URL=smtp://localhost:25
 +
 
 +
and then we can start Rocket.Chat manually (with CTL-C you can quit Rocket.Chat):
 
  cd /opt/Rocket.Chat
 
  cd /opt/Rocket.Chat
  node main.js &
+
  node main.js
  
Browse to https://yourserver:3000 and create the first admin user.
+
Browse to http://yourserver:3000 and create the first admin user.
  
===Rocket.Chat on a sub domain===
+
{{Note box|This FIRST user will be the 'master administrator' even if you use [[Rocket_Chat#LDAP_Authentication|'''LDAP authentication''']] for your users. So if even if you use LDAP, this user will still be able to login and grant Rocket.Chat admin rights to [[Rocket_Chat#LDAP_Authentication|LDAP]] accounts.}}
Install the [[Webapps-common]] contrib.
+
 
 +
==Auto start Rocket.Chat at boot==
 +
Since SME Server has put it's name in /etc/system-release, the (NodeJS) forever utility will not be able to detect the main distribution name (e.g. CentOS) and will exit with an error. To add 'SME Server' to the list of recognised distributions so that the forever-service tool will run properly, is to execute the following command (don't be disturbed by the Oracle mentioning, it's just to locate the correct position):
 +
sed -i -e 's/(Oracle Linux)/(Oracle Linux)|(SME Server)/' \
 +
/opt/rh/nodejs010/root/usr/lib/node_modules/forever-service/templates/sysvinit/installer.js
 +
 
 +
Generate the init script 'rocketchat' that will automatically be placed into /etc/rc.d/init.d:
 +
cd /opt/Rocket.Chat
 +
forever-service install -s main.js -e "ROOT_URL=https://chat.mycompany.local/ \
 +
MONGO_URL=mongodb://localhost:27017/rocketchat PORT=3000 MAIL_URL=smtp://mycompany.local:25" \
 +
-p "/opt/rh/nodejs010/root/usr/lib/node_modules/forever/bin" rocketchat
 +
Please use the correct values in the command above from your specific setup.
 +
 
 +
The created init script '/etc/rc.d/init.d/rocketchat' is not aware that we use [[Software Collections]], so we have to add directives to the init script that we do:
 +
sed -i '26 a source /opt/rh/nodejs010/enable' /etc/rc.d/init.d/rocketchat
 +
sed -i '27 a source /opt/rh/rh-mongodb26/enable' /etc/rc.d/init.d/rocketchat
 +
sed -i '28 a source /opt/rh/rh-python34/enable' /etc/rc.d/init.d/rocketchat
 +
sed -i '29 a source /opt/rh/rh-java-common/enable' /etc/rc.d/init.d/rocketchat
 +
 
 +
 
 +
{{Note box|Please note that if you change anything on your Rocket.Chat environment such as URL's, subdomain name(s), ports or mail server, you have to run the above again to reflect your new environment. If so, please remove /etc/rc.d/init.d/rocketchat first. (rm /etc/rc.d/init.d/rocketchat).}}
 +
 
 +
Rocket.Chat will now start at boot time or manually:
 +
service rocketchat start|stop|status|restart
 +
 
 +
 
 +
Please note that it may take a little while, up to a minute, for Rocket.Chat to become available. In the mean time you can be shown a HTTP error 503. Please try again in a minute or a bit longer. Why this is? No Idea for now, other that it may be related to MongoDB processes.
 +
 
 +
==Make Rocket.Chat available on a sub domain==
 +
Install the '''[[Webapps-common]]''' contrib.
  
 
To create your sub domain (e.g. https://chat.yourserver.com)
 
To create your sub domain (e.g. https://chat.yourserver.com)
  db domains set chat.mycompany.local domain Description "RocketChat" Content Primary \
+
  db domains set chat.yourserver.local domain Description "RocketChat" Nameservers internet \
  Nameservers internet TemplatePath WebAppVirtualHost DocumentRoot /opt/Rocket.Chat \
+
  TemplatePath WebAppVirtualHost RequireSSL enabled ProxyPassTarget http://localhost:3000/ ProxyPreserveHost yes
RequireSSL enabled ProxyPassTarget http://localhost:3000/
+
The 'ProxyPassTarget' property could also point to another host (IP) that has Rocket.Chat installed, e.g. a virtual SME Server on the same LAN. In that case, also LDAP and open/close ports have to be taken into consideration.
 
To expand and activate:
 
To expand and activate:
 
  signal-event webapps-update
 
  signal-event webapps-update
  
To disable the default access on port 3000 for we now access our chat platform via the subdomain and for security we close the default access method.
+
If your servers' default FQDN is already chat.yourserver.com, there is no need to create a new subdomain. Instead of the above command, you can enter the following:
 +
db domains setprop chat.yourserver.com TemplatePath WebAppVirtualHost RequireSSL enabled ProxyPassTarget http://localhost:3000/ ProxyPreserveHost yes
 +
 
 +
To disable the default access on port 3000, for we now access our chat platform via the subdomain, and for security we change the default access method from public to private.
 
  config setprop rocketchat access private
 
  config setprop rocketchat access private
 
  signal-event remoteaccess-update
 
  signal-event remoteaccess-update
Line 127: Line 136:
 
You can now visit Rocket.Chat at https://chat.yourserver.com. Rocket.Chat will notice that the URL that is being used to access Rocket.Chat has been changed, and will propose to change it to the new URL.
 
You can now visit Rocket.Chat at https://chat.yourserver.com. Rocket.Chat will notice that the URL that is being used to access Rocket.Chat has been changed, and will propose to change it to the new URL.
  
===LDAP Authentication===
+
==WebRTC configuration==
As the Rocket.Chat admin go into administration -> LDAP, and use the following setting:
+
{{Note box|Please note that WebRTC connections on the chromium engines based browsers '''require''' secure connections (http'''s'''). Normal http connections will be refused. Please see the '''[[letsencrypt]]''' wiki page for more info on how to obtain a valid certificate for your Koozali SME Server(s) and domains. Please see [https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins '''this'''] article on why. How other browsers such as Firefox and IE manage this is not known, if you do, please add a note.}}
  Enable -> True
+
Rocket.Chat uses WebRTC to make voice/video calls. This requires the additional Apache module proxy_wstunnel. This is available from the '''[[fws]]''' repository.
  Host -> localhost
+
yum install mod_proxy_wstunnel --enablerepo=fws
  Port -> 389
+
 
  Domain base -> as displayed in server manager e.g. dc=mycompany,dc=local
+
A custom template is required to load the proxy_wstunnel module by default and in the correct order:
  Custom domain search -> {"filter": "(&(objectClass=inetOrgPerson)(objectClass=sambaSamAccount))"}
+
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
  Sync data -> True
+
nano -w /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModule60
  Default domain -> chat.yourserver.com (as per the subdomain)
+
and paste the following content and save:
Save the settings and use the test button to test the connection to the LDAP directory. Then 'Sync users'.
+
{
 +
    $OUT .= load_modules(qw(
 +
    proxy_wstunnel
 +
    ));
 +
}
 +
Then expand httpd.conf and restart Apache:
 +
expand-template /etc/httpd/conf/httpd.conf
 +
service httpd-e-smith restart
 +
 
 +
To show if the module is correctly loaded:
 +
apachectl -M |grep wstunnel
 +
it should be listed as '''proxy_wstunnel_module (shared)'''
 +
 
 +
To be able to redirect websocket requets to the Rocket.Chat engine, the following must be present in httpd.conf under the virtualhost sub-domain:
 +
ProxyPass /.well-known/acme-challenge/ !
 +
ProxyPreserveHost On
 +
ProxyPassMatch ^/sockjs/(.*)/websocket ws://localhost:3000/sockjs/$1/websocket
 +
ProxyPass / http://localhost:3000/
 +
ProxyPassReverse / http://localhost:3000/
 +
 
 +
==LDAP Authentication==
 +
As the Rocket.Chat admin go into administration -> LDAP, and use the following settings (please use your server details):
 +
  Enable: True
 +
  Host: 127.0.0.1
 +
  Port: 389
 +
  Domain base: ou=Users,dc=mycompany,dc=local
 +
  Domain search user: uid=admin,ou=Users,dc=mycompany,dc=local
 +
Domain search password: admin password of your server
 +
Doamin search user ID: uid
 +
  Sync data: True
 +
  Default domain: chat.yourserver.com (as per the subdomain)
 +
Save the settings and use the test button to test the connection to the LDAP directory. Then 'Sync users'. For more specific details on Rocket.Chat and LDAP user authentication please see [https://rocket.chat/docs/administrator-guides/authentication/ldap '''their documentation'''].
 +
 
 +
==Maintenance==
 +
====Upgrade Rocket.Chat====
 +
Interestingly there is not much information on upgrading your Rocket.Chat version. It does not help either that the Rocket.Chat team closed their wiki and took it off-line in favour of a new doc system which is not populated with info as much.
 +
 
 +
The preferred way as it seems is completely remove /opt/Rocket.Chat...
 +
service rocketchat stop
 +
rm -rf /opt/Rocket.Chat
 +
and then repeat the download, unpack and move as descibed above. Then start Rocket.Chat:
 +
service rocketchat start
 +
Please note it can take a bit for the Rocket.Chat service to become available for the MongoDB structure version is being checked and automatically updated according to the Rocket.Chat version.
 +
 
 +
====Backup Rocket.Chat====
 +
{{Note box|Please note that this section is experimental. Somebody with more extensive knowledge of MongoDB may help here. This section is not finished yet, so please do NOT use on production servers, just test VM's. The default storage location of MongoDB is '/var/opt/rh/rh-mongodb26/lib/mongodb' (as set in '/etc/opt/rh/rh-mongodb26/mongod.conf'.) We might want to change this to /home/e-smith/files/mongodb' or '/var/lib/mongodb' and run a script to be included in the pre-backup event, just like MySQL, to hold transactions and make a backup.}}
  
===TO DO===
+
To be able to backup Rocket.Chat data with the default SME Server backup mechanisms, the data should be available within the backup paths. In this case we will place the Rocket.Chat backup data in /home/e-smith/files.
* Auto start Rocket.Chat
+
 
* <s>Fine tune various things (e.g. Security)</s>
+
To dump the Rocket.Chat data:
* <s>Enable LDAP authentication</s>
+
mongodump --dumpDbUsersAndRoles -d rocketchat -o /home/e-smith/files
* <s>Create subdomain e.g. https://chat.yourdomain.com using the webapps-common contrib</s>
+
([https://docs.mongodb.org/v2.6/reference/program/mongodump/ Documentation])
 +
and to restore the Rocket.Chat data:
 +
mongorestore --restoreDbUsersAndRoles -d rocketchat -dir /home/e-smith/files/rocketchat --quiet
 +
 
 +
You may want to automate the execution of the above mongodump command by means of a cron job. For easy management of this, you could use the excellent [[Crontab_Manager|'''Crontab Manager''']] contrib.
 +
 
 +
====Remove Rocket.Chat====
 +
TBA
 +
 
 +
==Rocket.Chat clients==
 +
Next to your browser, you can use Rocket.Chat desktop clients for Linux, Windows and Mac. Please see https://github.com/RocketChat/Rocket.Chat.Electron/releases
 +
 
 +
Obviously there are mobile clients for both Android and iOS. Please search for 'Rocket chat' in either app store.
 +
 
 +
==TO DO==
 +
* Backup and how to manage Rocket.Chat data (e.g. mongodb and FS options)
 +
* Include the push server config for both Android and iOS
 +
* Remove Rocket.Chat
 +
* Watch developments such as using PostgreSQL/MariaDB opposed to MongoDB
 
* Test, test, test
 
* Test, test, test
* Create a contrib
 
 
* Showcase SME Server, contribs and software collections.
 
* Showcase SME Server, contribs and software collections.
 +
 +
==Tips & Tricks==
 +
* Nice website for 'Cartoonish' avatars that can be used to replace your initials in all your Rocket.Chat conversations. [http://pickaface.net/ '''Pick a face''']
 +
* Test/troubleshoot your device for WebRTC capabilities [https://test.webrtc.org/ '''WebRTC Troubleshooter''']
 +
 +
[[Category:Howto]]
 +
[[Category: Webapps]]

Latest revision as of 15:35, 27 July 2023

PythonIcon.png Skill level: Advanced
The instructions on this page may require deviations from standard procedures. A good understanding of linux and Koozali SME Server is recommended.


Rocket-dot-chat-logo.png

Warning.png Warning:
Due to the changes in Rockets requirements noted below please see the Rocket Chat Contrib This will run Rocket in a docker container


Warning.png Warning:
Most of the following is obsolete but here for posterity and reference


Maintainer

Maintainer: RequestedDeletion

About

"Rocket.Chat, the ultimate webchat platform. From group messages and video/audio calls all the way to helpdesk killer features. Our goal is to become the number one cross-platform open source chat solution"

  • Messaging Direct and group messages, public or private.
  • Video Conference Chat with your colleagues and friends face-to-face over audio and video. See details. Test your device here.
  • Helpdesk chat Have your website visitors contact you in real-time and increase conversions.
  • File sharing Drag-and-drop files or select them from your computer or mobile device.
  • Screen sharing Select any window to share with your audience.
  • Voice messages Record and transmit voice messages to a channel, group or private conversation.
  • Link preview Post a link and immediately view its content. YouTube, Twitter, Gifs!
  • API Integrate your chat to multiple services: GitHub, GitLab, JIRA, Confluence and others.
  • Extendability Want a killer new feature? Add a new package. It's as simple as that.
  • Native applications Native client applications available for download on Linux, Windows and OSX.
  • Mobile applications Mobile client applications available for iOS and Android on their respective stores.


In short, a Slack, HipChat, Jabber (XMMP), IRC or even a Skype alternative, completely and securely self hosted and controlled. Great for closed (company/family/friends/community) teams.


Important.png Note:
Rocket.Chat is a young project and therefore under very active development. Very regularly they release new (minor) versions. Your mileage may vary! Please see their development on GitHub for the activities and Rocket.Chat developments.


Obsolete Notes

This how-to can be discussed on the forums here Latest Rocket.Chat version tested: 0.39 (please see the change log here).

Requirements

Warning.png Warning:
Please be aware that for now only Rocket.Chat up to version 0.39 can be installed due to dependencies on the Nodejs version available via software collections.


Rocket.Chat requires several higher versions of applications and frameworks than provided by Koozali SME Server by default. Therefore we need to install some Software Collections Packages and enable some addition repo's.

  1. You must have SME Server 9.x 64-bit
  2. You must install the epel repository
  3. You must install the centos-sclo-rh repository
  4. You must install the Software Collections tool

After having installed the above repo's and installing Software Collections, you can install the required collections by:

yum install rh-python34-python rh-mongodb32-mongodb rh-mongodb32-mongodb-server nodejs010 GraphicsMagick --enablerepo=centos-sclo-rh,epel

After installing the Software Collections we need to update some packages using NodeJS package manager NPM:

scl enable nodejs010 'npm install -g npm ws inherits n forever forever-service'
scl enable nodejs010 'n 0.10.40'

Installation of Rocket.Chat

First we need to create the SME Server services:

For Rocket.Chat:

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99rocketchat
config set rocketchat service status enabled TCPPort 3000 access public

For MongoDB (please note the usage of mongod and NOT mongodb):

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S99rh-mongodb32-mongod
config set rh-mongodb32-mongod service status enabled access private TCPPort 27017

And to update the ports:

signal-event remoteaccess-update

Now we can download and install the latest Rocket.Chat version from their downloads repository:

cd /root
curl -L https://rocket.chat/releases/0.39.0/download -o rocket.chat.tgz
tar zxvf rocket.chat.tgz
mv bundle /opt/Rocket.Chat

Once Rocket.Chat has been downloaded and unpacked, we need to 'register' Rocket.Chat with NodeJS with NPM:

cd /opt/Rocket.Chat/programs/server
scl enable nodejs010 'npm install'

Rocket.Chat has now been installed and you can test-drive you installation.

First we need to set some environment variables manually (Please use your own correct settings):

export ROOT_URL=http://yourserver.com/
export MONGO_URL=mongodb://localhost:27017/rocketchat
export PORT=3000
export MAIL_URL=smtp://localhost:25

and then we can start Rocket.Chat manually (with CTL-C you can quit Rocket.Chat):

cd /opt/Rocket.Chat
node main.js

Browse to http://yourserver:3000 and create the first admin user.


Important.png Note:
This FIRST user will be the 'master administrator' even if you use LDAP authentication for your users. So if even if you use LDAP, this user will still be able to login and grant Rocket.Chat admin rights to LDAP accounts.


Auto start Rocket.Chat at boot

Since SME Server has put it's name in /etc/system-release, the (NodeJS) forever utility will not be able to detect the main distribution name (e.g. CentOS) and will exit with an error. To add 'SME Server' to the list of recognised distributions so that the forever-service tool will run properly, is to execute the following command (don't be disturbed by the Oracle mentioning, it's just to locate the correct position):

sed -i -e 's/(Oracle Linux)/(Oracle Linux)|(SME Server)/' \
/opt/rh/nodejs010/root/usr/lib/node_modules/forever-service/templates/sysvinit/installer.js

Generate the init script 'rocketchat' that will automatically be placed into /etc/rc.d/init.d:

cd /opt/Rocket.Chat
forever-service install -s main.js -e "ROOT_URL=https://chat.mycompany.local/ \
MONGO_URL=mongodb://localhost:27017/rocketchat PORT=3000 MAIL_URL=smtp://mycompany.local:25" \
-p "/opt/rh/nodejs010/root/usr/lib/node_modules/forever/bin" rocketchat

Please use the correct values in the command above from your specific setup.

The created init script '/etc/rc.d/init.d/rocketchat' is not aware that we use Software Collections, so we have to add directives to the init script that we do:

sed -i '26 a source /opt/rh/nodejs010/enable' /etc/rc.d/init.d/rocketchat
sed -i '27 a source /opt/rh/rh-mongodb26/enable' /etc/rc.d/init.d/rocketchat
sed -i '28 a source /opt/rh/rh-python34/enable' /etc/rc.d/init.d/rocketchat
sed -i '29 a source /opt/rh/rh-java-common/enable' /etc/rc.d/init.d/rocketchat


Important.png Note:
Please note that if you change anything on your Rocket.Chat environment such as URL's, subdomain name(s), ports or mail server, you have to run the above again to reflect your new environment. If so, please remove /etc/rc.d/init.d/rocketchat first. (rm /etc/rc.d/init.d/rocketchat).


Rocket.Chat will now start at boot time or manually:

service rocketchat start|stop|status|restart


Please note that it may take a little while, up to a minute, for Rocket.Chat to become available. In the mean time you can be shown a HTTP error 503. Please try again in a minute or a bit longer. Why this is? No Idea for now, other that it may be related to MongoDB processes.

Make Rocket.Chat available on a sub domain

Install the Webapps-common contrib.

To create your sub domain (e.g. https://chat.yourserver.com)

db domains set chat.yourserver.local domain Description "RocketChat" Nameservers internet \
TemplatePath WebAppVirtualHost RequireSSL enabled ProxyPassTarget http://localhost:3000/ ProxyPreserveHost yes

The 'ProxyPassTarget' property could also point to another host (IP) that has Rocket.Chat installed, e.g. a virtual SME Server on the same LAN. In that case, also LDAP and open/close ports have to be taken into consideration. To expand and activate:

signal-event webapps-update

If your servers' default FQDN is already chat.yourserver.com, there is no need to create a new subdomain. Instead of the above command, you can enter the following:

db domains setprop chat.yourserver.com TemplatePath WebAppVirtualHost RequireSSL enabled ProxyPassTarget http://localhost:3000/ ProxyPreserveHost yes

To disable the default access on port 3000, for we now access our chat platform via the subdomain, and for security we change the default access method from public to private.

config setprop rocketchat access private
signal-event remoteaccess-update

You can now visit Rocket.Chat at https://chat.yourserver.com. Rocket.Chat will notice that the URL that is being used to access Rocket.Chat has been changed, and will propose to change it to the new URL.

WebRTC configuration

Important.png Note:
Please note that WebRTC connections on the chromium engines based browsers require secure connections (https). Normal http connections will be refused. Please see the letsencrypt wiki page for more info on how to obtain a valid certificate for your Koozali SME Server(s) and domains. Please see this article on why. How other browsers such as Firefox and IE manage this is not known, if you do, please add a note.


Rocket.Chat uses WebRTC to make voice/video calls. This requires the additional Apache module proxy_wstunnel. This is available from the fws repository.

yum install mod_proxy_wstunnel --enablerepo=fws

A custom template is required to load the proxy_wstunnel module by default and in the correct order:

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
nano -w /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModule60

and paste the following content and save:

{
   $OUT .= load_modules(qw(
   proxy_wstunnel
   ));
}

Then expand httpd.conf and restart Apache:

expand-template /etc/httpd/conf/httpd.conf
service httpd-e-smith restart

To show if the module is correctly loaded:

apachectl -M |grep wstunnel

it should be listed as proxy_wstunnel_module (shared)

To be able to redirect websocket requets to the Rocket.Chat engine, the following must be present in httpd.conf under the virtualhost sub-domain:

ProxyPass /.well-known/acme-challenge/ !
ProxyPreserveHost On
ProxyPassMatch ^/sockjs/(.*)/websocket ws://localhost:3000/sockjs/$1/websocket
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/

LDAP Authentication

As the Rocket.Chat admin go into administration -> LDAP, and use the following settings (please use your server details):

Enable: True
Host: 127.0.0.1
Port: 389
Domain base: ou=Users,dc=mycompany,dc=local
Domain search user: uid=admin,ou=Users,dc=mycompany,dc=local
Domain search password: admin password of your server
Doamin search user ID: uid
Sync data: True
Default domain: chat.yourserver.com (as per the subdomain)

Save the settings and use the test button to test the connection to the LDAP directory. Then 'Sync users'. For more specific details on Rocket.Chat and LDAP user authentication please see their documentation.

Maintenance

Upgrade Rocket.Chat

Interestingly there is not much information on upgrading your Rocket.Chat version. It does not help either that the Rocket.Chat team closed their wiki and took it off-line in favour of a new doc system which is not populated with info as much.

The preferred way as it seems is completely remove /opt/Rocket.Chat...

service rocketchat stop
rm -rf /opt/Rocket.Chat

and then repeat the download, unpack and move as descibed above. Then start Rocket.Chat:

service rocketchat start

Please note it can take a bit for the Rocket.Chat service to become available for the MongoDB structure version is being checked and automatically updated according to the Rocket.Chat version.

Backup Rocket.Chat

Important.png Note:
Please note that this section is experimental. Somebody with more extensive knowledge of MongoDB may help here. This section is not finished yet, so please do NOT use on production servers, just test VM's. The default storage location of MongoDB is '/var/opt/rh/rh-mongodb26/lib/mongodb' (as set in '/etc/opt/rh/rh-mongodb26/mongod.conf'.) We might want to change this to /home/e-smith/files/mongodb' or '/var/lib/mongodb' and run a script to be included in the pre-backup event, just like MySQL, to hold transactions and make a backup.


To be able to backup Rocket.Chat data with the default SME Server backup mechanisms, the data should be available within the backup paths. In this case we will place the Rocket.Chat backup data in /home/e-smith/files.

To dump the Rocket.Chat data:

mongodump --dumpDbUsersAndRoles -d rocketchat -o /home/e-smith/files

(Documentation) and to restore the Rocket.Chat data:

mongorestore --restoreDbUsersAndRoles -d rocketchat -dir /home/e-smith/files/rocketchat --quiet

You may want to automate the execution of the above mongodump command by means of a cron job. For easy management of this, you could use the excellent Crontab Manager contrib.

Remove Rocket.Chat

TBA

Rocket.Chat clients

Next to your browser, you can use Rocket.Chat desktop clients for Linux, Windows and Mac. Please see https://github.com/RocketChat/Rocket.Chat.Electron/releases

Obviously there are mobile clients for both Android and iOS. Please search for 'Rocket chat' in either app store.

TO DO

  • Backup and how to manage Rocket.Chat data (e.g. mongodb and FS options)
  • Include the push server config for both Android and iOS
  • Remove Rocket.Chat
  • Watch developments such as using PostgreSQL/MariaDB opposed to MongoDB
  • Test, test, test
  • Showcase SME Server, contribs and software collections.

Tips & Tricks

  • Nice website for 'Cartoonish' avatars that can be used to replace your initials in all your Rocket.Chat conversations. Pick a face
  • Test/troubleshoot your device for WebRTC capabilities WebRTC Troubleshooter