RC should be able to query the MongoDB verision.
Output:
Apr 28 13:15:22
Apr 28 13:15:22
Server is runnning so far on this setup. I only saw the error messages above, which I wanted to report.
During Rocketchat Startup:
Apr 28 13:15:04
.................
Apr 28 13:15:21
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
Apr 28 13:15:22
I spent a couple of hours debugging this and here is the solution. I suppose you've set up MongoDB Replicaset rsXX beforehand:
mongo -u ADMINUSER --authenticationDatabase admin -p
# enter password
> admin = db.getSiblingDB("admin");
> admin.grantRolesToUser('OPLOGUSER',[{ role: "clusterMonitor", db: "admin" }])
> admin.grantRolesToUser('ROCKETUSER',[{ role: "clusterMonitor", db: "admin" }])
> exit
# edit the /etc/systemd/system/rocketchat.service unit file to auth against the admin db in both cases:
MONGO_URL=mongodb://ROCKETUSER:ROCKETPASS@localhost:27017/rocketchat?authSource=admin MONGO_OPLOG_URL=mongodb://OPLOGUSER:OPLOGPASS@localhost:27017/local?authSource=admin&replSet=rsXX
systemctl daemon-reload && systemctl restart rocketchat.service && journalctl -xef
# should start up normally
A few links that helped me to solve the same problem:
Rocket.Chat/programs/server/app/app.js to add console.error(e) to the catch part to see the original error: https://github.com/RocketChat/Rocket.Chat/blob/b587351dd30307a908d2df12684b706b7e53ae50/app/statistics/server/functions/get.js#L145-L151Made some edits above to include the involved try-catch blocks + correct some typos. Hope it helps!
@oliob do you have mongo auth as suggested by @immanuelfodor ?
@geekgonecrazy yes I have mongo auth enabled.
@immanuelfodor Thank you for you guidance. It worked.
I ll close this. A section in the docs about this might be helpful.
Agreed! I'll see about getting this added
There is a nice error message added in #14320. Sadly, people don't use the Github search and went all over it again in #14303 to debug the same issue but at least there is an explanation for others next time.
Most helpful comment
I spent a couple of hours debugging this and here is the solution. I suppose you've set up MongoDB Replicaset
rsXXbeforehand:A few links that helped me to solve the same problem:
Rocket.Chat/programs/server/app/app.jsto addconsole.error(e)to the catch part to see the original error: https://github.com/RocketChat/Rocket.Chat/blob/b587351dd30307a908d2df12684b706b7e53ae50/app/statistics/server/functions/get.js#L145-L151