Difference between revisions of "Rocket Chat:Contrib"

From SME Server
Jump to navigationJump to search
 
(35 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''[[Rocket_Chat#smeserver-rocketchat_contrib|Contrib]]''': [mailto:jcrisp@safeandsound.co.uk[[User:ReetP|John Crisp]]]
+
'''[[Rocket_Chat#smeserver-rocketchat_contrib|Contrib]]''': [mailto:jcrisp@safeandsound.co.uk][[User:ReetP|John Crisp]]
{{Note box|Please note that there is also a howto on manually installing Rocket.Chat [[Rocket_Chat|'''here''']]}}
+
{{Note box|Please note that there is also a howto on manually installing Rocket.Chat [[Rocket_Chat|'''here.''' That manual installing is largely obsolete.]]}}
 +
 
 +
Later versions will need my newer smeserver-rocketchat-0.4.x contrib which uses docker.
 +
 
 
==smeserver-rocketchat contrib==
 
==smeserver-rocketchat contrib==
 
{{WIP box}}
 
{{WIP box}}
This contrib aims to reduce some of the setup for rocketchat and add some flexibility with settings
+
 
 +
===Version===
 +
{{ #smeversion: smeserver-rocketchat }}
 +
 
 +
 
 +
==Required repos==
  
 
Add repos:
 
Add repos:
  
 
* [[epel]]
 
* [[epel]]
* [[Centos-sclo-rh]]
+
* [[mongoDB]]
 +
* [[Docker]]
 
* [[User:ReetP|reetp]]  
 
* [[User:ReetP|reetp]]  
* [[Fws]]
 
 
==RocketChat 0.40+==
 
 
From Rocketchat 0.40 onwards you require a higher version of node than the one in the SCL repos.
 
 
Rocket.Chat v 48.1 requires:
 
node: v4.6.2
 
npm: v3.10.9
 
 
Rocket.Chat v 49.0 requires:
 
node: v4.7.2
 
 
This can be installed from the node repo
 
 
===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
 
  
Setup node versions:
+
===Installation===
  
Install latest version:
+
There is now a smeserver-rocketchat contrib to install Rocket.Chat with docker.
npm install -g npm
 
  
Install specific version:
+
Install Mongo DB natively as per the wiki page https://wiki.koozali.org/MongoDB
npm install -g npm@3.10.9
 
  
Install n version manager:
+
Currently it is suggested to use Mongo 4.4
npm install -g n
 
  
Install node version
+
Mongo 5+ requires additional instructions in the CPU that older CPUs may not have. See teh wiki page for more.
n 4.7.2
 
  
[root@test ~]# node -v
+
Do not go further than initiating the replicaset. Users are not required.
v4.7.2
 
  
[root@test ~]# npm --version
+
Next install smeserver-docker following the wiki page https://wiki.koozali.org/Docker
3.10.9
 
  
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
+
Settings
  
Don't post-upgrade yet.
+
config set rocketchat service TCPPort 3000 mailPort 25 mailURL localhost access private status enabled SSLProxy yes Version 5.4.9 rootURL chat.domain.com
  
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
 
  signal-event post-upgrade;signal-event reboot
  
Now we should be able to install rocketchat itself
 
yum --enablerepo=reetp install rocketchat
 
 
Check the progress:
 
tailf /var/log/rocketchat.log
 
  
 
  System ➔ startup
 
  System ➔ startup
Line 127: Line 69:
 
  use rocketchat
 
  use rocketchat
 
  db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
 
  db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
  db.rocketchat_settings.update({"_id" : "From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
+
  db.rocketchat_settings.update({"_id": "From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
  exit
+
      exit<
 +
 
 +
 
 +
===Reverse proxy===
 +
 
 +
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/
  
Restart Rocket.Chat to be sure:
+
It should look like this:
 +
chat.mycompany.local=domain
 +
  Nameservers=internet (can be localhost)
 +
  ProxyPassTarget=http://127.0.0.1:3000/
 +
  TemplatePath=ProxyPassVirtualRocketchat
 +
  letsencryptSSLcert=enabled (with letsencrypt support)
  
service rocketchat restart
+
We need to set Rocket.Chat to listen on localhost now:
  
You should now be able to register a new account and get a confirmation email. Check /var/log/qpsmtpd/current for any errors.
+
config setprop rocketchat rootURL chat.mycompany.domain SSLProxy yes
 +
signal-event smeserver-rocketchat-update
  
If you have not set the From address you are likely to get:
+
Now start the docker container (always run compose from the docker directory)
  
  Mail with no From header not accepted here
+
  cd /home/e-smith/files/docker/configs
 +
docker-compose up -d rocketchat
 +
docker logs -f rocketchat
  
===Errors===
+
db accounts setprop Primary SSL enabled
 +
signal-event ibay-modify Primary
  
If you have issues make sure you stop the rocket chat service
 
  
service rocketchat stop
+
==Bugs==
  
Check /var/log/rocketchat.log
+
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title=bugzilla}}and select the smeserver-rocketchat component or use
 +
{{BugzillaFileBug|product=SME%20Contribs|component=smeserver-rocketchat |title=this link}}.
  
Try running main.js
 
/opt/Rocket.Chat
 
node main.js
 
  
===SSL with Proxypass===
+
{{#bugzilla:columns=id,product,version,status,summary |sort=id |order=desc |disablecache=1 |component=smeserver-rocketchat |noresultsmessage="No open bugs found."}}
{{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 }}
 
  
It is recommended to add Letsencrypt support as detailed below (see here for my contrib https://wiki.contribs.org/Letsencrypt)
 
  
We need some extra settings to enable SSL with ProxyPass.
+
==Mongo DB examples==
  
Add the FWS repo:
+
===Usage===
  
db yum_repositories set fws repository \
+
Example using mongo itself:
BaseURL http://repo.firewall-services.com/centos/\$releasever \
 
EnableGroups no GPGCheck yes \
 
Name "Firewall Services" \
 
GPGKey http://repo.firewall-services.com/RPM-GPG-KEY \
 
Visible yes status disabled
 
  
Update the repos:
+
  mongo
  signal-event yum-modify
 
  
Install proxy pass rpm:
+
  use rocketchat
  yum --enablerepo=fws install mod_proxy_wstunnel
 
  
Regenerate httpd.conf
+
Show all collections in DB
  signal-event remoteaccess-update
+
  show collections
  
Now we need to setup our subdomain
+
Show all entries in a collection
 +
db.rocketchat_avatars.chunks.find()
  
  db domains set chat.mycompany.local domain Description RocketChat Nameservers internet \
+
  db.rocketchat_settings.find({"_id" : "SMTP_Host"})
  TemplatePath ProxyPassVirtualRocketchat ProxyPassTarget http://localhost:3000/
+
  db.rocketchat_settings.find({"_id" : "From_Email"})
  
It should look like this:
+
  db.getCollection("rocketchat_settings").find({"name":"Joe Blogs"})
  chat.mycompany.local=domain
 
  Nameservers=internet (can be localhost)
 
  ProxyPassTarget=http://127.0.0.1:3000/
 
  TemplatePath=ProxyPassVirtualRocketchat
 
  letsencryptSSLcert=enabled (with letsencrypt support)
 
  
We need to set Rocket.Chat to listen on localhost now:
+
db.getCollection("rocketchat_settings").find({"_id":{$regex:"^LDAP"}})
 +
db.getCollection("rocketchat_settings").find({"value": {$regex: 'hostname', $options: 'i'}});
  
  config setprop rocketchat rootURL chat.mycompany.domain SSLProxy yes
+
  db.rocketchat_settings.findOne({_id : "From_Email"}, {_id:0, value: 1})
  signal-event remoteaccess-update
+
  db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1})
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:
+
db.rocketchat_settings.update({"_id":"From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
 +
db.rocketchat_settings.update({"_id":"SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
  
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
+
Remove all entries in a collection (CAREFUL!!!!!!)
 +
db.rocketchat_avatars.chunks.remove({})
  
IF you have Letsencrypt support you can now set your main domain to SSL only:
+
Help
 +
help
  
db accounts setprop Primary SSL enabled
+
Some more mongo commands for reference
signal-event ibay-modify Primary
 
  
===Bugs===
+
https://github.com/RocketChat/Rocket.Chat/issues/15880#issuecomment-570070433
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.
 
  
==Manual config of templates==
+
Directly check a specific user ID from bash:
  expand-template /etc/rc.d/init.d/rocketchat
+
  mongo rocketchat --eval "db.users.find({'username':'usernamehere'}).forEach( function(u) { print(u._id + \" ; \" + u.username); } )"
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
+
Log into rocketchat database:
  /etc/rc.d/init.d/rh-mongodb26-mongos start
+
  mongo rocketchat
  
==Mongod fails to start after reboot==
+
Check out all the user IDs in the database:
 +
db.users.find().forEach( function(u) { print(u._id + ";" + u.username); } )
  
Sometimes it appears that mongo fails to start after a reboot.
+
Or just a specific user's ID:
 +
db.users.find({'username':'usernamehere'}).forEach( function(u) { print(u._id + \" ; \" + u.username); } )
  
This appears to be caused by a lock file
+
Replace specific user ID's password in the database:
 +
db.users.update( {'_id': 'useridhere'}, {$set: {'services.password.bcrypt': 'bcryptedpasswordhere'}}, {multi:true} )
  
Remove the following files if they exist:
+
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.
  
rm /var/opt/rh/rh-mongodb26/lib/mongodb/mongod.lock
+
There are bcrypt password generators online, and various libraries you can use
rm /var/opt/rh/rh-mongodb26/run/mongodb/mongod.pid
 
  
Restart the mongod service:
+
For listing out any passwords in the database I used:
  
service rh-mongodb26-mongod start
+
  db.users.find().forEach( function(u) { print(u.services.password.bcrypt + " ; " + u.username); } )
  
Restart the rocketchat service:
+
If you have deactivated users it may fail so use this for individual accounts.
  
service rocketchat restart
+
However, you can get it for an individual user with:
  
==Mongo DB examples==
+
db.users.find({'username':'SomeUserName'}).forEach( function(u) { print(u.services.password.bcrypt + " ; " + u.username); } )
  
===Usage===
+
Set a user config item:
  
Example using mongo itself:
+
db.users.update( {'username': 'SomeUserName'}, {$set: {'settings.preferences.showMessageInMainThread': 'true'}} )
  
mongo
+
Find a single user:
  
  use rocketchat
+
  db.getCollection('users').find( {'username':'SomeUserName'} )
  
db.rocketchat_settings.find({"_id" : "SMTP_Host"})
+
Get limited information:
db.rocketchat_settings.find({"_id" : "From_Email"})
 
  
  db.rocketchat_settings.findOne({_id : "From_Email"}, {_id:0, value: 1})
+
  db.getCollection('users').find({}, {"username":1, "settings.preferences.showMessageInMainThread":1})
db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1})
 
  
 +
Reset 2FA nonsense:
  
  db.rocketchat_settings.update({"_id" : "From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
+
  db.users.update({'username': 'SomeUserName'}, {$unset: {'services.totp': 1}});
  db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
+
  db.users.update({'username': 'SomeUserName'}, {$unset: {'services.email2fa': 1}});
  
 
===Database Backup===
 
===Database Backup===
Line 270: Line 209:
  
 
  mongorestore --restoreDbUsersAndRoles -d rocketchat -dir  /root/rocketchatmongo/rocketchat --quiet
 
  mongorestore --restoreDbUsersAndRoles -d rocketchat -dir  /root/rocketchatmongo/rocketchat --quiet
 +
 +
===Database Fix tables===
 +
 +
To remove user data file links a variation on this link
 +
https://github.com/RocketChat/feature-requests/issues/718
 +
 +
mongo
 +
use rocketchat
 +
db.rocketchat_user_data_files.remove( { } )
 +
db.runCommand({ compact: 'rocketchat_user_data_files', force: true });
 +
quit;
  
 
==Node usage==
 
==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 http://stackoverflow.com/questions/7718313/how-to-change-to-an-older-version-of-node-js)
 
Use n, an extremely simple Node version manager that can be installed via npm (See http://stackoverflow.com/questions/7718313/how-to-change-to-an-older-version-of-node-js)
Line 323: Line 275:
 
     status=enabled
 
     status=enabled
  
  rh-mongodb26-mongod=service
+
 
    TCPPort=27017
+
 
    access=private
+
==Koozali SME v10==
    mongoURL=localhost
+
 
    status=enabled
+
I am starting to look at running this under docker on v10
 +
 
 +
Some quick notes.
 +
 
 +
You will need
 +
 
 +
Docker
 +
https://wiki.contribs.org/Docker
 +
 
 +
Docker Compose (because it makes it easier to template)
 +
https://github.com/docker/compose/releases
 +
 
 +
Docker environment settings to disable 2FA
 +
 
 +
  - OVERWRITE_SETTING_Accounts_TwoFactorAuthentication_Enforce_Password_Fallback=false
 +
  - OVERWRITE_SETTING_Accounts_TwoFactorAuthentication_Enabled=false
 +
 
 +
Mongo (I prefer to run a full instance rather than a docker one)
 +
https://wiki.contribs.org/MongoDB
 +
 
 +
Make sure you add replicaset support in Mongo and set it up:
 +
 
 +
mongo --eval "printjson(rs.initiate())"
 +
 
 +
 
 +
I'll add more later, and try and make a full contrib in due course
 +
 
 +
FAQ
 +
 
 +
https://handbook.rocket.chat/company/tools/rocket.chat
 +
 
 +
==Bugs==
 +
 
 +
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title=bugzilla}}and select the smeserver-rocketchat component or use
 +
{{BugzillaFileBug|product=SME%20Contribs|component=smeserver-rocketchat |title=this link}}.
 +
 
 +
 
 +
{{#bugzilla:columns=id,product,version,status,summary |sort=id |order=desc |disablecache=1 |component=smeserver-rocketchat |noresultsmessage="No open bugs found."}}

Latest revision as of 16:35, 16 August 2024

Contrib: [1]John Crisp

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


Later versions will need my newer smeserver-rocketchat-0.4.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.


Version

Alpha 10:
smeserver-rocketchat
The latest version of smeserver-rocketchat is available in the SME repository, click on the version number(s) for more information.



Required repos

Add repos:

Installation

There is now a smeserver-rocketchat contrib to install Rocket.Chat with docker.

Install Mongo DB natively as per the wiki page https://wiki.koozali.org/MongoDB

Currently it is suggested to use Mongo 4.4

Mongo 5+ requires additional instructions in the CPU that older CPUs may not have. See teh wiki page for more.

Do not go further than initiating the replicaset. Users are not required.

Next install smeserver-docker following the wiki page https://wiki.koozali.org/Docker


Settings

config set rocketchat service TCPPort 3000 mailPort 25 mailURL localhost access private status enabled SSLProxy yes Version 5.4.9 rootURL chat.domain.com


signal-event post-upgrade;signal-event reboot


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

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

http://rocketchat.local.net:3000

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 mail.yourdomain.com

mongo
use rocketchat
db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
db.rocketchat_settings.update({"_id": "From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
      exit<


Reverse proxy

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:

chat.mycompany.local=domain
  Nameservers=internet (can be localhost)
  ProxyPassTarget=http://127.0.0.1:3000/
  TemplatePath=ProxyPassVirtualRocketchat
  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 smeserver-rocketchat-update

Now start the docker container (always run compose from the docker directory)

cd /home/e-smith/files/docker/configs
docker-compose up -d rocketchat
docker logs -f rocketchat
db accounts setprop Primary SSL enabled
signal-event ibay-modify Primary


Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-rocketchat component or use

this link .


IDProductVersionStatusSummary
12390SME Contribs10.0RESOLVEDFirst import smeserver-rocketchat to SME 10 [smeserver-rocketchat] v0.4-1


Mongo DB examples

Usage

Example using mongo itself:

mongo
use rocketchat

Show all collections in DB

show collections

Show all entries in a collection

db.rocketchat_avatars.chunks.find()
db.rocketchat_settings.find({"_id" : "SMTP_Host"})
db.rocketchat_settings.find({"_id" : "From_Email"})
db.getCollection("rocketchat_settings").find({"name":"Joe Blogs"})
db.getCollection("rocketchat_settings").find({"_id":{$regex:"^LDAP"}})
db.getCollection("rocketchat_settings").find({"value": {$regex: 'hostname', $options: 'i'}});
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@yourdomain.com"}})
db.rocketchat_settings.update({"_id":"SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})


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

db.rocketchat_avatars.chunks.remove({})

Help

help

Some more mongo commands for reference

https://github.com/RocketChat/Rocket.Chat/issues/15880#issuecomment-570070433

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.services.password.bcrypt + " ; " + 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.services.password.bcrypt + " ; " + 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

Database Fix tables

To remove user data file links a variation on this link https://github.com/RocketChat/feature-requests/issues/718

mongo
use rocketchat
db.rocketchat_user_data_files.remove( { } )
db.runCommand({ compact: 'rocketchat_user_data_files', force: true });
quit;

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 http://stackoverflow.com/questions/7718313/how-to-change-to-an-older-version-of-node-js)

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

Usage:

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:

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

Typical proxy subdomain setup:

rocketchat=service
   SSLProxy=yes
   TCPPort=3000
   access=private
   mailPort=25
   mailURL=localhost
   rootURL=chat.mydomain.co.uk
   status=enabled


Koozali SME v10

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

Some quick notes.

You will need

Docker https://wiki.contribs.org/Docker

Docker Compose (because it makes it easier to template) https://github.com/docker/compose/releases

Docker environment settings to disable 2FA

  - OVERWRITE_SETTING_Accounts_TwoFactorAuthentication_Enforce_Password_Fallback=false
  - OVERWRITE_SETTING_Accounts_TwoFactorAuthentication_Enabled=false

Mongo (I prefer to run a full instance rather than a docker one) https://wiki.contribs.org/MongoDB

Make sure you add replicaset support in Mongo and set it up:

mongo --eval "printjson(rs.initiate())"


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

FAQ

https://handbook.rocket.chat/company/tools/rocket.chat

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-rocketchat component or use

this link .


IDProductVersionStatusSummary
12390SME Contribs10.0RESOLVEDFirst import smeserver-rocketchat to SME 10 [smeserver-rocketchat] v0.4-1