Difference between revisions of "Rocket Chat:Contrib"

From SME Server
Jump to navigationJump to search
Line 188: Line 188:
  
 
From Rocketchat 0.40 onwards you require a higher version of node than the one in the EPEL repos.
 
From Rocketchat 0.40 onwards you require a higher version of node than the one in the EPEL repos.
 +
 +
===Setup===
  
 
Add the following repos:
 
Add the following repos:
  
/sbin/e-smith/db yum_repositories set epel repository \
+
/sbin/e-smith/db yum_repositories set epel repository \
Name 'Epel - EL6' \
+
Name 'Epel - EL6' \
BaseURL 'http://download.fedoraproject.org/pub/epel/6/$basearch' \
+
BaseURL 'http://download.fedoraproject.org/pub/epel/6/$basearch' \
MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch' \
+
MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch' \
EnableGroups no \
+
EnableGroups no \
GPGCheck yes \
+
GPGCheck yes \
GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
+
GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
Exclude perl-Razor-Agent \
+
Exclude perl-Razor-Agent \
Visible no \
+
Visible no \
status disabled
+
status disabled
  
/sbin/e-smith/db yum_repositories set reetp repository \
+
/sbin/e-smith/db yum_repositories set reetp repository \
BaseURL http://www.reetspetit.com/smeserver/\$releasever \
+
BaseURL http://www.reetspetit.com/smeserver/\$releasever \
EnableGroups no \
+
EnableGroups no \
GPGCheck no \
+
GPGCheck no \
Name "ReetP Repo" \
+
Name "ReetP Repo" \
GPGKey http://www.reetspetit.com/RPM-GPG-KEY \
+
GPGKey http://www.reetspetit.com/RPM-GPG-KEY \
Visible yes status disabled
+
Visible yes status disabled
  
/sbin/e-smith/db yum_repositories set centos-sclo-rh \
+
/sbin/e-smith/db yum_repositories set centos-sclo-rh \
repository Name 'Centos-RH Software collections' \
+
repository Name 'Centos-RH Software collections' \
BaseURL 'http://mirror.centos.org/centos/$releasever/sclo/$basearch/rh/' \
+
BaseURL 'http://mirror.centos.org/centos/$releasever/sclo/$basearch/rh/' \
EnableGroups no Visible yes status disabled
+
EnableGroups no Visible yes status disabled
  
/sbin/e-smith/db yum_repositories set nodejs \
+
/sbin/e-smith/db yum_repositories set nodejs \
repository Name 'Node JS 4' \
+
repository Name 'Node JS 4' \
BaseURL https://rpm.nodesource.com/pub_4.x/el/6/x86_64 \
+
BaseURL https://rpm.nodesource.com/pub_4.x/el/6/x86_64 \
EnableGroups no GPGCheck no Visible yes status disabled
+
EnableGroups no GPGCheck no Visible yes status disabled
  
signal-event yum-modify
+
signal-event yum-modify
  
yum --enablerepo=nodejs install nodejs nodejs-devel
+
yum --enablerepo=nodejs install nodejs nodejs-devel
  
yum --enablerepo=centos-sclo-rh,epel install scl-utils rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server \
+
yum --enablerepo=centos-sclo-rh,epel install scl-utils rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server \
GraphicsMagick  
+
GraphicsMagick  
  
 
You should be able to install the smeserver-rocketchat RPM now
 
You should be able to install the smeserver-rocketchat RPM now
  
yum --enablerepo=reetp install smeserver-rocketchat
+
yum --enablerepo=reetp install smeserver-rocketchat
  
config set rocketchat service TCPPort 3000 mailPort 25 mailURL localhost access public status enabled
+
config set rocketchat service TCPPort 3000 mailPort 25 mailURL localhost access public status enabled
config set rh-mongodb26-mongod service TCPPort 27017 mongoURL localhost access private status enabled
+
config set rh-mongodb26-mongod service TCPPort 27017 mongoURL localhost access private status enabled
  
signal-event post-upgrade;signal-event reboot
+
signal-event post-upgrade;signal-event reboot
  
  
RocketChat itself
+
===RocketChat run checks===
  
 
Check /var/log/rocketchat.log
 
Check /var/log/rocketchat.log
  
System ➔ startup
+
System ➔ startup
+--------------------------------------------------+
+
+--------------------------------------------------+
|                  SERVER RUNNING                  |
+
|                  SERVER RUNNING                  |
+--------------------------------------------------+
+
+--------------------------------------------------+
|                                                  |
+
|                                                  |
|      Version: 0.xx.x                            |
+
|      Version: 0.xx.x                            |
|  Process Port: 3000                              |
+
|  Process Port: 3000                              |
|      Site URL: http://rocketchat.local.net:3000  |
+
|      Site URL: http://rocketchat.local.net:3000  |
|        OpLog: Disabled                          |
+
|        OpLog: Disabled                          |
|                                                  |
+
|                                                  |
+--------------------------------------------------+
+
+--------------------------------------------------+
  
 
If you have issues make sure you stop the rocket chat service
 
If you have issues make sure you stop the rocket chat service
  
service rocketchat stop
+
service rocketchat stop
  
 
Check your node versions:
 
Check your node versions:
  
[root@test Rocket.Chat]# node -v
+
[root@test Rocket.Chat]# node -v
 
v4.5.0
 
v4.5.0
[root@test Rocket.Chat]# npm -v
+
[root@test Rocket.Chat]# npm -v
 
3.10.8
 
3.10.8
  
 
Modify with
 
Modify with
  
n 0.4.6
+
n 0.4.6
  
 
Try running main.js
 
Try running main.js
/opt/Rocket.Chat
+
/opt/Rocket.Chat
node main.js
+
node main.js
  
  
  
===========================================================
 
Manual config:
 
expand-template /etc/rc.d/init.d/rocketchat
 
expand-template /etc/profile.d/scls-rh-mongodb26.sh
 
expand-template /etc/profile.d/scls-rh-python34.sh
 
expand-template /etc/profile.d/scls-rh-java-common.sh
 
expand-template /etc/opt/rh/rh-mongodb26/mongod.conf
 
  
/etc/rc.d/init.d/rocketchat start
+
===Manual config of templates===
/etc/rc.d/init.d/rh-mongodb26-mongos start
+
expand-template /etc/rc.d/init.d/rocketchat
===========================================================
+
expand-template /etc/profile.d/scls-rh-mongodb26.sh
 +
expand-template /etc/profile.d/scls-rh-python34.sh
 +
expand-template /etc/profile.d/scls-rh-java-common.sh
 +
expand-template /etc/opt/rh/rh-mongodb26/mongod.conf
  
 +
/etc/rc.d/init.d/rocketchat start
 +
/etc/rc.d/init.d/rh-mongodb26-mongos start
  
Proxy Pass - the contrib will sort out the templates. You just need some settings as follows:
 
  
[root@test e-smith]# db domains show
+
 
chat.reetspetit.info=domain
+
===Proxy Pass===
 +
 
 +
The contrib will sort out the templates. You just need some settings as follows:
 +
 
 +
[root@test e-smith]# db domains show
 +
chat.reetspetit.info=domain
 
     Description=RocketChat
 
     Description=RocketChat
 
     Nameservers=internet
 
     Nameservers=internet
Line 298: Line 302:
  
  
SSL
+
===SSL===
Note:
+
{{Note box|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 }}
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.
 
It is recommended to add Letsencrypt support as detailed below.
 +
 
We need some extra settings to enable SSL with ProxyPass.
 
We need some extra settings to enable SSL with ProxyPass.
  
 
First install proxy pass rpm:
 
First install proxy pass rpm:
yum --enablerepo=fws install mod_proxy_wstunnel
+
yum --enablerepo=fws install mod_proxy_wstunnel
  
 
Regenerate httpd.conf
 
Regenerate httpd.conf
signal-event remoteaccess-update
+
signal-event remoteaccess-update
  
 
Now we need to setup our subdomain
 
Now we need to setup our subdomain
  
db domains set chat.mycompany.local domain Description RocketChat Nameservers internet \
+
db domains set chat.mycompany.local domain Description RocketChat Nameservers internet \
TemplatePath ProxyPassVirtualRocketchat ProxyPassTarget http://localhost:3000/
+
TemplatePath ProxyPassVirtualRocketchat ProxyPassTarget http://localhost:3000/
  
 
It should look like this:
 
It should look like this:
chat.mycompany.local=domain
+
chat.mycompany.local=domain
 
   Nameservers=internet
 
   Nameservers=internet
 
   ProxyPassTarget=http://127.0.0.1:3000/
 
   ProxyPassTarget=http://127.0.0.1:3000/
Line 325: Line 329:
 
We need to set Rocket.Chat to listen on localhost now:
 
We need to set Rocket.Chat to listen on localhost now:
  
config setprop rocketchat rootURL localhost
+
config setprop rocketchat rootURL localhost
signal-event remoteaccess-update
+
signal-event remoteaccess-update
service rocketchat restart
+
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:
 
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
+
config setprop rocketchat access private
signal-event remoteaccess-update
+
signal-event remoteaccess-update

Revision as of 14:36, 23 November 2016

Contrib: John Crisp

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


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.


This contrib aims to reduce some of the setup for rocketchat and add some flexibility with settings


Important.png Note:
This will ONLY work up to Rocket Chat version 0.39 as they changed the required node version after that. I am working on an update to the contrib - see the end for notes


Add repos:

yum install rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server nodejs010 GraphicsMagick --enablerepo=centos-sclo-rh,epel
scl enable nodejs010 bash
npm install -g inherits
npm install -g n
n 0.10.40
exit


Important.png Note:
Please be careful to only install JUST the required packages in my repo. There are various testing packages in there that will BREAK YOUR SYSTEM !


You should now be able to install the rocketchat bundle with:

yum --enablerepo=reetp install rocketchat

This may take a while on first install as it installs the npm modules for the first time.

Now you should be able to install the rocketchat contrib:

yum --enablerepo=reetp install smeserver-rocketchat
db configuration setprop rocketchat status enabled
signal-event post-upgrade;signal-event reboot

DB settings

rocketchat=service
   TCPPort=3000
   access=public
   mailPort=25
   mailURL=localhost
   status=enabled
rh-mongodb26-mongod=service
   TCPPort=27017
   access=private
   mongoURL=localhost
   status=enabled

BEFORE we login for the first time we need to set up mail settings correctly:

From bash:

mongo rocketchat --eval 'db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"localhost"}});'
mongo rocketchat --eval 'db.rocketchat_settings.update({"_id" : "From_Email"}, {$set: {"value":"admin@yourdomain.com"}});'

We can check the individual values set like this:

mongo rocketchat --eval 'db.rocketchat_settings.find({"_id":"From_Email"}, {_id:0, value:1}).shellPrint();'
mongo rocketchat --eval 'db.rocketchat_settings.find({"_id":"SMTP_Host"}, {_id:0, value: 1}).shellPrint();'

All values per _id:

mongo rocketchat --eval 'db.rocketchat_settings.find({"_id" : "SMTP_Host"}).shellPrint();'
mongo rocketchat --eval 'db.rocketchat_settings.find({"_id" : "From_Email"}).shellPrint();'


Now restart rocketchat to reread the DB settings:

service rocketchat restart

Login at http://yourdomain:3000

It will first get you to create an admin user.

If you have an issue with no email sent/received then login using the email address and password you just set

Updates

If there is an update to Rocket.Chat I will add to my repo. You should just be able to run:

yum --enablerepo=reetp install rocketchat

You can also update the smeserver-rocketchat contrib in the same way

yum --enablerepo=reetp install smeserver-rocketchat

SSL

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



Important.png Note:
I've realised I need to re-hack the web templates for this but still trying to work it out - please ask in the forums and I can give you some tips to get it working


It is recommended to add Letsencrypt support as detailed below.

We need some extra settings to enable SSL with ProxyPass.

First install proxy pass rpm:

Add the FWS repo

yum --enablerepo=fws install mod_proxy_wstunnel

Regenerate httpd.conf

signal-event remoteaccess-update

Now we need to setup our subdomain

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

It should look like this:

chat.mycompany.local=domain
   Nameservers=internet
   ProxyPassTarget=http://127.0.0.1:3000/
   TemplatePath=ProxyPassVirtualRocketchat


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

config setprop rocketchat rootURL localhost
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

Letsencrypt support

Important.png Note:
26 Aug 2016 - This should now work for a subdomain


You can add letsencrypt should you wish - please see https://wiki.contribs.org/Letsencrypt

You will need to add the domain key as follows, and add your letsencrypt certificates as per the wiki page:

db domains setprop chat.mycompany.local letsencryptSSLcert enabled

Note that smeserver-rocketchat adds redirect on port 80 for the letsencrypt directory .well-known/acme-challenge

You should be able to reach:

http://chat.mycompany.local/.well-known/acme-challenge/ 

This should redirect to:

https://chat.mycompany.local/.well-known/acme-challenge/

Anything else going to chat.mycompany.local should get to Rocket.Chat

Bugs

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.

You ay get an error on install of the rocketchat rpm as follows:

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

This is due to the installed version of npm/node from SCL. Rocket.Chat should till work

Mongo DB examples

Example using mongo itself:

mongo
use rocketchat
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":"admin@reetspetit.info"}})
db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"mail.reetspetit.info"}})

Rocketchat 0.40+

From Rocketchat 0.40 onwards you require a higher version of node than the one in the EPEL repos.

Setup

Add the following repos:

/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
/sbin/e-smith/db yum_repositories set reetp repository \
BaseURL http://www.reetspetit.com/smeserver/\$releasever \
EnableGroups no \
GPGCheck no \
Name "ReetP Repo" \
GPGKey http://www.reetspetit.com/RPM-GPG-KEY \
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
/sbin/e-smith/db yum_repositories set nodejs \
repository Name 'Node JS 4' \
BaseURL https://rpm.nodesource.com/pub_4.x/el/6/x86_64 \
EnableGroups no GPGCheck no Visible yes status disabled
signal-event yum-modify
yum --enablerepo=nodejs install nodejs nodejs-devel
yum --enablerepo=centos-sclo-rh,epel install scl-utils rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server \
GraphicsMagick 

You should be able to install the smeserver-rocketchat RPM now

yum --enablerepo=reetp install smeserver-rocketchat
config set rocketchat service TCPPort 3000 mailPort 25 mailURL localhost access public status enabled
config set rh-mongodb26-mongod service TCPPort 27017 mongoURL localhost access private status enabled
signal-event post-upgrade;signal-event reboot


RocketChat run checks

Check /var/log/rocketchat.log

System ➔ startup
+--------------------------------------------------+
|                  SERVER RUNNING                  |
+--------------------------------------------------+
|                                                  |
|       Version: 0.xx.x                            |
|  Process Port: 3000                              |
|      Site URL: http://rocketchat.local.net:3000  |
|         OpLog: Disabled                          |
|                                                  |
+--------------------------------------------------+

If you have issues make sure you stop the rocket chat service

service rocketchat stop

Check your node versions:

[root@test Rocket.Chat]# node -v

v4.5.0

[root@test Rocket.Chat]# npm -v

3.10.8

Modify with

n 0.4.6

Try running main.js

/opt/Rocket.Chat
node main.js



Manual config of templates

expand-template /etc/rc.d/init.d/rocketchat
expand-template /etc/profile.d/scls-rh-mongodb26.sh
expand-template /etc/profile.d/scls-rh-python34.sh
expand-template /etc/profile.d/scls-rh-java-common.sh
expand-template /etc/opt/rh/rh-mongodb26/mongod.conf
/etc/rc.d/init.d/rocketchat start
/etc/rc.d/init.d/rh-mongodb26-mongos start


Proxy Pass

The contrib will sort out the templates. You just need some settings as follows:

[root@test e-smith]# db domains show
chat.reetspetit.info=domain
   Description=RocketChat
   Nameservers=internet
   ProxyPassTarget=http://127.0.0.1:3000/
   TemplatePath=ProxyPassVirtualRocketchat
   letsencryptSSLcert=enabled


SSL

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.

We need some extra settings to enable SSL with ProxyPass.

First install proxy pass rpm:

yum --enablerepo=fws install mod_proxy_wstunnel

Regenerate httpd.conf

signal-event remoteaccess-update

Now we need to setup our subdomain

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

It should look like this:

chat.mycompany.local=domain
  Nameservers=internet
  ProxyPassTarget=http://127.0.0.1:3000/
  TemplatePath=ProxyPassVirtualRocketchat

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

config setprop rocketchat rootURL localhost
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