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''']] |
| + | However, due to dependencies a manual install will not work on SME}}Version up to 0.61.2 will work with this contrib. |
| + | |
| + | Later versions will need my newer smeserver-rocketchat-0.2.x contrib which uses docker. |
| + | |
| ==smeserver-rocketchat contrib== | | ==smeserver-rocketchat contrib== |
| {{WIP box}} | | {{WIP box}} |
| This contrib aims to reduce some of the setup for rocketchat and add some flexibility with settings | | This contrib aims to reduce some of the setup for rocketchat and add some flexibility with settings |
| | | |
− | Add repos:
| + | ==Current version== |
| + | |
| + | 3rd March 2018 |
| + | |
| + | Rocket RPM in my repo is 0.61.2 |
| + | |
| + | 0.61.2 is likely to be the last version that can be installed direct to CentOS 6/ Koozali SME v9.x due to node module dependency requirements |
| + | |
| + | I have tried to build 0.62.0 so far without success see this bug https://github.com/RocketChat/Rocket.Chat/issues/9943 |
| | | |
− | * [[epel]]
| + | https://reetspetit.com/smeserver/6/repoview/rocketchat.html |
− | * [[Centos-sclo-rh]]
| |
− | * [[User:ReetP|reetp]]
| |
− | * [[Fws]]
| |
| | | |
− | ==RocketChat 0.40+==
| + | Latest source is here: |
| | | |
− | From Rocketchat 0.40 onwards you require a higher version of node than the one in the SCL repos.
| + | https://github.com/RocketChat/Rocket.Chat/tags |
| | | |
− | Rocket.Chat v 48.1 requires:
| + | {{Note box|Latest version is 0.61.2 |
− | node: v4.6.2 | + | This requires node 8.x and a prebuilt module which the RPM should install}}I am currently looking at running Rocket 0.62 on docker in CentOS 6 which I do have working using the existing local Mongo DB |
− | npm: v3.10.9
| |
| | | |
− | Rocket.Chat v 49.0 requires:
| + | I will post a link to a new wiki page when I have it tested further and know what I am doing with Docker |
− | node: v4.7.2
| |
| | | |
− | This can be installed from the node repo
| + | ==Required repos== |
| | | |
− | ===Setup===
| + | Add repos: |
| | | |
− | Add the following repos:
| + | * [[epel]] |
| + | * [[Centos-sclo-rh]] |
| + | * [[User:ReetP|reetp]] |
| + | * [[Fws]] |
| | | |
| /sbin/e-smith/db yum_repositories set epel repository \ | | /sbin/e-smith/db yum_repositories set epel repository \ |
Line 53: |
Line 63: |
| 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 nodejs8 \ |
− | repository Name 'Node JS 4' \ | + | repository Name 'Node JS 8' \ |
− | BaseURL https://rpm.nodesource.com/pub_4.x/el/6/x86_64 \ | + | BaseURL https://rpm.nodesource.com/pub_8.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=nodejs8 install nodejs nodejs-devel |
| | | |
− | Setup node versions:
| + | ==RocketChat 0.40+== |
| | | |
− | Install latest version:
| + | From Rocketchat 0.40 onwards you require a higher version of node than the one in the SCL repos. |
− | npm install -g npm
| + | |
| + | Rocket.Chat v 60.0+ requires: |
| + | node: v8.9.3 |
| + | npm: v5.6.0 |
| + | |
| + | This can be installed from the node repo. The following is how to check and set up node versions manually - the rpm should sort this out for you. |
| + | |
| + | ===Setup node versions:=== |
| | | |
− | Install specific version:
| + | Some of this is magic (to me!) and I still don't get the local and global stuff. Be careful with paths. See NPM Usage below for more. |
− | npm install -g npm@3.10.9
| |
| | | |
− | Install n version manager:
| + | The node rpm install node to /usr/bin but the npm 'n' module will install to /usr/local/bin |
− | npm install -g n
| |
| | | |
− | Install node version
| + | Check the version of node in /usr/bin |
− | n 4.7.2
| |
| | | |
| [root@test ~]# node -v | | [root@test ~]# node -v |
− | v4.7.2 | + | v8.9.3 |
| | | |
− | [root@test ~]# npm --version | + | Install n version manager: |
− | 3.10.9
| + | npm install -g n |
| + | Install specific node version (which will go in /usr/local/bin)<syntaxhighlight> |
| + | n 8.9.3 |
| + | </syntaxhighlight>Install the LTS version<syntaxhighlight> |
| + | n lts |
| + | </syntaxhighlight>List available versions<syntaxhighlight> |
| + | n ls |
| + | </syntaxhighlight>Install latest version of npm: |
| + | npm install -g npm |
| | | |
− | yum --enablerepo=centos-sclo-rh,epel install scl-utils rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server \ | + | Install specific npm version: |
− | GraphicsMagick
| + | npm install -g npm@5.6.0 |
| + | Show the npm version<syntaxhighlight> |
| + | [root@test ~]# npm --version |
| + | 5.6.0 |
| + | </syntaxhighlight> |
| + | |
| + | === Install required rpms === |
| + | <syntaxhighlight> |
| + | yum --enablerepo=centos-sclo-rh,epel install scl-utils rh-python34-python rh-mongodb26-mongodb rh-mongodb26-mongodb-server \ |
| + | GraphicsMagick |
| + | </syntaxhighlight> |
| | | |
| You should be able to install the smeserver-rocketchat RPM now | | You should be able to install the smeserver-rocketchat RPM now |
Line 96: |
Line 128: |
| signal-event post-upgrade;signal-event reboot | | signal-event post-upgrade;signal-event reboot |
| | | |
− | Now we should be able to install rocketchat itself | + | Now we should be able to install rocketchat itself - it is better to specify a version here in case a newer version breaks anything: |
− | yum --enablerepo=reetp install rocketchat | + | yum --enablerepo=reetp install rocketchat-0.59.6 |
| | | |
| Check the progress: | | Check the progress: |
Line 127: |
Line 159: |
| 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< |
| | | |
| Restart Rocket.Chat to be sure: | | Restart Rocket.Chat to be sure: |
Line 148: |
Line 180: |
| Check /var/log/rocketchat.log | | Check /var/log/rocketchat.log |
| | | |
− | Try running main.js | + | Try running main.js manually:<syntaxhighlight> |
− | /opt/Rocket.Chat
| + | export PORT=3000 |
− | node main.js
| + | export MAIL_URL=smtp://localhost:25 |
| + | export MONGO_URL=mongodb://localhost:27017/rocketchat |
| + | export ROOT_URL=http://my.smeserver.net/opt/Rocket.Chat |
| + | node main.js |
| + | </syntaxhighlight> |
| | | |
| ===SSL with Proxypass=== | | ===SSL with Proxypass=== |
Line 177: |
Line 213: |
| signal-event remoteaccess-update | | signal-event remoteaccess-update |
| | | |
− | Now we need to setup our subdomain | + | Now we need to setup our subdomain for the reverse proxy |
| | | |
| db domains set chat.mycompany.local domain Description RocketChat Nameservers internet \ | | db domains set chat.mycompany.local domain Description RocketChat Nameservers internet \ |
Line 206: |
Line 242: |
| db accounts setprop Primary SSL enabled | | db accounts setprop Primary SSL enabled |
| signal-event ibay-modify Primary | | signal-event ibay-modify Primary |
| + | |
| + | ===Upgrades=== |
| + | |
| + | To upgrade rocketchat: |
| + | |
| + | yum --enablerepo=reetp install rocketchat |
| + | |
| + | To upgrade the rocketchat configurator: |
| + | |
| + | yum --enablerepo=reetp install smeserver-rocketchat |
| | | |
| ===Bugs=== | | ===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. | | 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. |
| | | |
Line 243: |
Line 290: |
| service rocketchat restart | | service rocketchat restart |
| | | |
− | I haven't tested yet but the answer may be simpler:
| + | The following is simpler and appears to work: |
| | | |
| service rocketchat stop | | service rocketchat stop |
− | /etc/rc.d/init.d/rh-mongodb26-mongod start | + | /etc/rc.d/init.d/rh-mongodb26-mongod restart |
− | service rocketchat stop | + | service rocketchat start |
− | | |
− | When I get a chance I will test this and advise accordingly.
| |
| | | |
| ==Mongo DB examples== | | ==Mongo DB examples== |
Line 260: |
Line 305: |
| | | |
| use rocketchat | | 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" : "SMTP_Host"}) |
Line 267: |
Line 318: |
| db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_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"}}) |
| | | |
− | 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=== | | ===Database Backup=== |
Line 340: |
Line 447: |
| mongoURL=localhost | | mongoURL=localhost |
| status=enabled | | 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 |
| + | |
| + | 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 |
| + | https://docs.rocket.chat/installation/manual-installation/centos |
| + | |
| + | I'll add more later, and try and make a full contrib in due course |
| + | |
| + | ===CentOS 7 notes=== |
| + | |
| + | Setup storage engine and replication for MongoDB (mandatory for versions > 1), and enable and start MongoDB and Rocket.Chat: |
| + | |
| + | They still recommend mmapv1 but it is probably better to stick with the default WiredTiger. Here's how to change if required: |
| + | |
| + | sed -i "s/^# engine:/ engine: mmapv1/" /etc/mongod.conf |
| + | |
| + | You MUST initialise a replicaset so we must add this to the conf file: |
| + | |
| + | sed -i "s/^#replication:/replication:\n replSetName: rs01/" /etc/mongod.conf |
| + | |
| + | Start Mongo |
| + | |
| + | systemctl enable mongod && sudo systemctl start mongod |
| + | |
| + | Initiate the set: |
| + | |
| + | mongo --eval "printjson(rs.initiate())" |