Rocket Chat

From SME Server
Jump to navigation Jump to search
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

Maintainer

RequestedDeletion


About

"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"

  • 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.
  • 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 or even Skype alternative completely and securely self hosted and controlled. Great for closed (company) teams.


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


This how-to can be discussed on the forums here

RocketChat for SME Server 9.x 64-bit only!
Latest Rocket.Chat version tested: 0.27.0


Installation SCL environment

Add epel repo

/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 scl and centos-sclo-rh repo’s

/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-rh \
repository Name 'Centos-RH Software collections' \
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

Before you can install any of the Software Collections applications, you must install the Software Collections tools first. Please see Software Collections how to install and enable Software Collections.

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

using NPM:

scl enable nodejs010 bash
npm install -g inherits
npm install -g n
n 0.10.40
exit

Start Mongodb as service

(please note the usage of mongod and NOT mongodb)

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

nano -w /etc/profile.d/scls-rh-mongodb26.sh

#!/bin/sh
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

#!/bin/sh
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

#!/bin/sh
source /opt/rh/rh-java-common/enable
export X_SCLS="`scl enable rh-java-common 'echo $X_SCLS'`"

nano -w /etc/profile.d/scls-nodejs010.sh

#!/bin/sh
source /opt/rh/nodejs010/enable
export X_SCLS="`scl enable nodejs010 'echo $X_SCLS'`"

A reboot at this point is required to load all of the Software Collections profile/config files.

signal-event reboot

Installation Rocket.Chat

Create SME Server Rocket.Chat service

config set rocketchat service status enabled TCPPort 3000 access public
signal-event remoteaccess-update

Get Rocket.Chat from downloads

cd /root
curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
tar zxvf rocket.chat.tgz
mv bundle /opt/Rocket.Chat
cd /opt/Rocket.Chat/programs/server
npm install

Start Rocket.Chat

cd /opt/Rocket.Chat
node main.js &

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

  Note:
This 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 admin rights to LDAP accounts.



Rocket.Chat on a sub domain

Install the Webapps-common contrib.

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

db domains set chat.mycompany.local domain Description "RocketChat" Nameservers internet \
TemplatePath WebAppVirtualHost 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:

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.

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.


Auto start Rocket.Chat at boot

To be able to auto start Rocket.Chat one could use the /etc/rc.d/rc.local file, but using the init system is cleaner and much more controlled. Nodejs has small utilities (modules) that can create the correct init script based on your specific Rocket.Chat setup.

To install these Nodejs modules issue:

npm install -g forever
npm install -g forever-service

Since SME Server has put it's name in /etc/system-release, the 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 Rocket.Chat init script

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 a directive to the init script that we do:

sed -i '26 a source /etc/profile.d/scls-nodejs010.sh' /etc/rc.d/init.d/rocketchat
  Note:
Please note that if you change anything on your Rocket.Chat environment such 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).


Create SME Server service link

Now we can create a link to the SME Server way of starting services automatically at boot time or manually:

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S99rocketchat

and you can start/stop/status your rocketchat service e.g.:

service rocketchat status
service rocketchat start
service rocketchat stop
service rocketchat restart

Please note that it may take a little while, up to a minute, for rocketchat 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.

LDAP Authentication

As the Rocket.Chat admin go into administration -> LDAP, and use the following setting:

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'.


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...

/etc/rc.d/init.d/rocketchat stop
rm -f /opt/Rocket.Chat

and then repeat download, unpack and move procedure above. Then start Rocket.Chat:

/etc/rc.d/init.d/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.


Remove Rocket.Chat

TBA

TO DO

  • Auto start Rocket.Chat
  • Backup and how to manage Rocket.Chat data (e.g. mongodb and FS options)
  • Fine tune various things (e.g. Security)
  • Enable LDAP authentication
  • Create subdomain e.g. https://chat.yourdomain.com using the webapps-common contrib
  • Activiation/Notification emails are not sent, despite test success
  • Upgrade Rocket.Chat
  • Remove Rocket.Chat


  • Watch developments such as using PostgreSQL/MariaDB opposed to MongoDB
  • Test, test, test
  • Create a contrib
  • 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 WebRTC capabilities WebRTC Troubleshooter