Rocket Chat:Contrib
)
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
ID | Product | Version | Status | Summary |
---|---|---|---|---|
12390 | SME Contribs | 10.0 | RESOLVED | First 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.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