MongoDB URI Authentication
The connection between Rocket.Chat and MongoDB instance is achieved using a MongoDB Connection String URI. MongoDB authentication is done with the username and password.
Adding the following snippet in your env does the trick.
1
MONGO_URL=mongodb://[username:[email protected]]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
Copied!
In your container, passing in MONGO_URL and MONGO_OPLOG_URL with the right values for connection.
Depending on the password you're using, you might need to escape some characters, for example.. Please take a look at MongoDB documentation https://docs.mongodb.com/manual/reference/connection-string/
Your docker-compose.yml file should look like this
1
environment:
2
- "MONGO_URL=mongodb://rctestuser:[email protected]:27017/rocketchat?authSource=admin"
3
- "MONGO_OPLOG_URL=mongodb://rctestuser:[email protected]:27017/local?authSource=admin"
Copied!
If using docker run, it should look like this:
1
docker run \ -e "MONGO_URL=mongodb://rctestuser:[email protected]:27017/rocketchat?authSource=admin" \
2
-e "MONGO_OPLOG_URL=mongodb://rctestuser:[email protected]:27017/local?authSource=admin" \
3
rocketchat/rocket.chat:X.X.X
Copied!
Export as PDF
Copy link