Changes

From SME Server
Jump to navigationJump to search
1,621 bytes added ,  14:08, 7 October 2020
no edit summary
Line 158: Line 158:  
  mongo
 
  mongo
 
  use rocketchat
 
  use rocketchat
  db.rocketchat_settings.update({"_id" <nowiki>: "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
+
  db.rocketchat_settings.update({"_id" : "SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
      db.rocketchat_settings.update({"_id"</nowiki> <nowiki>: "From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
+
db.rocketchat_settings.update({"_id": "From_Email"}, {$set: {"value":"admin@yourdomain.com"}})
       exit</nowiki>
+
       exit<
    
Restart Rocket.Chat to be sure:
 
Restart Rocket.Chat to be sure:
Line 318: Line 318:  
  db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1})
 
  db.rocketchat_settings.findOne({_id : "SMTP_Host"}, {_id:0, value: 1})
   −
  <nowiki>db.rocketchat_settings.update({"_id":"From_Email"}, {$set: {"value":"admin@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"}})</nowiki>
+
  db.rocketchat_settings.update({"_id":"SMTP_Host"}, {$set: {"value":"mail.yourdomain.com"}})
      Line 345: Line 345:     
Replace specific user ID's password in the database:
 
Replace specific user ID's password in the database:
  <nowiki>db.users.update( {'_id': 'useridhere'}, {$set: {'services.password.bcrypt': 'bcryptedpasswordhere'}}, {multi:true} )</nowiki>
+
  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.
 
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.
Line 361: Line 361:  
  db.users.find({'username':'SomeUserName'}).forEach( function(u) { print(u.services.password.bcrypt + " ; " + u.username); } )  
 
  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 431: 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())"

Navigation menu