Koozali.org: home of the SME Server

[NEW HOWTO] Rocket.Chat

guest22

[NEW HOWTO] Rocket.Chat
« on: April 15, 2016, 11:01:44 AM »
Hi,

there is a new howto in progress for Rocket.Chat: https://wiki.contribs.org/Rocket_Chat
It's not really finished yet (Hence the WIP notice), but the current raw notes should get you up and running. It worked for me.

Please provide your feedback here, so we can fine tune the howto.

TIA.


https://snowulf.com/2015/09/25/why-slack-when-you-can-rocket-chat/

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #1 on: April 15, 2016, 07:20:45 PM »
Very interesting, and timely.  With the news (https://www.techdirt.com/articles/20160414/10482434186/canadian-law-enforcement-can-intercept-decrypt-blackberry-messages.shtml) that law enforcement has a backdoor into BlackBerry, I'm looking for something secure and cross-platform.  This may do it.
......

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #2 on: April 15, 2016, 07:34:49 PM »
Starting to work through the instructions on a test VM.  I note that you set up repositories for scl and centos-sclo-rhl, but your yum install has --enablerepo=centos-rh-scl,epel.  Looks like a mismatch, and the result is that a few of the packages (didn't note which ones) aren't found.

I changed the name of centos-sclo-rhl to centos-rh-scl, and the yum install worked fine.

The remainder of the instructions went without error until the end, where you're supposed to start Rocket.Chat:
Code: [Select]
[root@sme-test2 ~]# cd /opt/Rocket.Chat/programs/server/
[root@sme-test2 server]# ls
app     boot.js        config.json    npm                  package.json  program.json
assets  boot-utils.js  mini-files.js  npm-shrinkwrap.json  packages      shell-server.js
[root@sme-test2 server]# node main.js &
[1] 2962
[root@sme-test2 server]#
module.js:340
    throw err;
          ^
Error: Cannot find module '/opt/Rocket.Chat/programs/server/main.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:935:3

[1]+  Exit 8                  node main.js
[root@sme-test2 server]#
« Last Edit: April 15, 2016, 07:59:17 PM by DanB35 »
......

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #3 on: April 15, 2016, 10:16:49 PM »
Thanks Dan, start instructions corrected. Will check the other feedback over the weekend.

ps. enable repo command adjusted too.

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #4 on: April 15, 2016, 10:34:00 PM »
Still not starting:
Code: [Select]
[root@sme-test2 Rocket.Chat]# node main.js &
[1] 23653
[root@sme-test2 Rocket.Chat]#
/opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:245
throw(ex);
      ^
Error: MONGO_URL must be set in environment
    at Object.<anonymous> (packages/mongo/remote_collection_driver.js:36:1)
    at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
    at new Mongo.Collection (packages/mongo/collection.js:102:1)
    at AccountsServer.AccountsCommon (accounts_common.js:23:18)
    at new AccountsServer (accounts_server.js:16:5)
    at Package (globals_server.js:5:12)
    at /opt/Rocket.Chat/programs/server/packages/accounts-base.js:1814:4
    at /opt/Rocket.Chat/programs/server/packages/accounts-base.js:1825:3
    at /opt/Rocket.Chat/programs/server/boot.js:242:10
    at Array.forEach (native)

[1]+  Exit 8                  node main.js
[root@sme-test2 Rocket.Chat]#

I thought it might be a result of the boot scripts not being executable, so I changed that (chmod +x /etc/profile.d/scls*) and tried again, but had the same result.  scls-rh-mongodb26 is there, and it does define MONGO_URL.
......

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #5 on: April 15, 2016, 10:39:15 PM »
Thanks again Dan. Please allow me to check over the weekend. CET +1 here.

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #6 on: April 17, 2016, 04:55:09 AM »
Ok, I fixed some things and typo's. Should all be working now.

@DanB35, please do the following on your test VM install:

cd /opt/Rocket.Chat/programs/server
npm install

adjust /etc/profile.d/scls-rh-mongodb26 and add .sh to the end of the filename (scls-rh-mongodb26.sh)
adjust the content of scls-rh-mongodb26.sh according to the wiki

reboot
start Rocket.Chat: node /opt/Rocket.Chat/main.js &


Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #7 on: April 17, 2016, 01:40:55 PM »
I'd reverted the test VM to a previous snapshot (clean 9.1 install with current updates), so I couldn't test if the changes in your last post, standing alone, solved my issue.  However, going back through the wiki's current instructions got me further than before.

I note that the reboot you mention in your last post is necessary, though I don't see it in the wiki.  Whether it's just to start mongod (which could be easily handled by 'service mongod start') or something else, I'm not sure, but 'node main.js' failed in exactly the same way as before if I didn't reboot.  After the reboot, it runs without apparent error.

After that, if I browse to http://myserver:3000, I get the login screen.  If I go to https://myserver:3000, it can't connect.  It seems to be working at this point--I'll have to play around with it and see how far I get.
......

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #8 on: April 17, 2016, 01:50:23 PM »
I note that the reboot you mention in your last post is necessary, though I don't see it in the wiki.  Whether it's just to start mongod (which could be easily handled by 'service mongod start') or something else, I'm not sure, but 'node main.js' failed in exactly the same way as before if I didn't reboot.  After the reboot, it runs without apparent error.
The reboot is required to auto load all the /etc/profile.d entries for the Software Collections applications.


Quote
After that, if I browse to http://myserver:3000, I get the login screen.  If I go to https://myserver:3000, it can't connect.  It seems to be working at this point--I'll have to play around with it and see how far I get.
A secure connection with Rocket.Chat (httpS) is in the making. However, using the webapps-common contrib and create a sub-domain with proxypass (as per the wiki) will enforce a secure connection via Apache.

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #9 on: April 17, 2016, 01:53:40 PM »
It's running fine now on it's own subdomain via a secure connection and LDAP authentication.


Amazing piece of software, all the WebRTC stuff is working great too! Should be a contrib to add value to SME Server ;-)

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #10 on: April 17, 2016, 02:01:25 PM »
A secure connection with Rocket.Chat (httpS) is in the making. However, using the webapps-common contrib and create a sub-domain with proxypass (as per the wiki) will enforce a secure connection via Apache.
Fine, but the wiki also says:
Quote
Browse to https://yourserver:3000 and create the first admin user.
...and that won't work.  Or, at least, it didn't work for me.
......

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #11 on: April 17, 2016, 02:35:19 PM »
Fine, but the wiki also says:...and that won't work.  Or, at least, it didn't work for me.


Corrected. It should be http

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #12 on: April 17, 2016, 09:22:07 PM »
Looking at the ProxyPass configuration makes me wonder--would it be possible to run Rocket.Chat on an internal, private server, and point ProxyPassTarget to that server?  The wiki instructions result in installing a bunch of dependencies, and I'm not sure that I'm comfortable putting all that on my production server.  But if I can spin up a clean SME9 VM, install Rocket.Chat on it, and point https://chat.mydomain to the internal box, I don't need nearly as much installed on the prod box, what is there can be easily removed if desired, and any attack coming by way of Rocket.Chat is going to affect only that internal VM.
......

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #13 on: April 17, 2016, 09:23:22 PM »
Yep, possible. Hence the sub domain, which can be any server.


ps. LDAP authentication (if used) needs to be adjusted then too.

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #14 on: April 18, 2016, 02:45:06 PM »
OK, I've got everything (that's documented on the wiki page so far) working.  Rocket.Chat is installed on an internal server, and the ProxyPass configuration is forwarding chat.mydomain to it without issues.  Somewhat surprisingly, the ProxyPass setup didn't interfere with getting a Let's Encrypt cert for that hostname either.  The mobile app also seems to be working on my Android phone.

Edit: Though it seems account activation emails aren't being sent, and this message is appearing in the logs: "(Mail not sent; to enable sending, set the MAIL_URL environment variable.)".  I've configured the mail server in Administration/SMTP, and the test email button reports success, but no messages are actually sent.

Something that might be helpful until the init script is working properly--install tmux (yum --enablerepo=epel install tmux).  Then create a new session (tmux new) and start Rocket.Chat inside that session (node main.js).  You can then detach from that session and leave it running (Ctrl-B d), log out of the server, etc.  When you log back in, run tmux a to re-attach to that session.  This will leave the server running while you log out.
« Last Edit: April 18, 2016, 02:53:16 PM by DanB35 »
......