Install Rocket.Chat services with MongoDB ReplicaSet error
I am using forever-service to create the services of Rocket.Chat with MongoDB ReplicaSet.
Error occured when the service was installed:
Invalid env variable MONGO_URL='mongodb://user:pwd@server1:port,server2:port,server3:port/dbname?replicaSet=setname'
The shell I used:
sudo forever-service install -s /home/rocket/Rocket.Chat/main.js -e "ROOT_URL=http://example.com/ MONGO_URL='mongodb://user:pwd@server1:port,server2:port,server3:port/dbname?replicaSet=<setname>' MONGO_OPLOG_URL='mongodb://user:pwd@server1:port,server2:port,server3:port/oplogdb?authSource=dbname&replicaSet=setname' INSTANCE_IP=hostip PORT=3000" -r rocket rocket1
After several times trying, I found that it was the commond to appoint the Replica Set name(or the = in the words) did cause this error. If I changed MONGO_URL without those, something like
MONGO_URL='mongodb://user:pwd@server1:port,server2:port,server3:port/dbname'
The Invalid env variable disappeared. Of course this service didn't work as it couldn't find the Replica Set.
So how can I do if I don't want to set the env variable in the linux immediately?
Any help is much appreciated : )
Try changing your MONGO_OPLOG_URL to this:
mongodb://user:pwd@localhost/oplogdb?authSource=dbname
I have been struggling with this for a while and this is what got it to work for me. I'm also configured with mongodb running in a replicaset.
We aim to keep our Github issues for bugs and feature requests. This does not fit that criteria. Please see our guidelines for support. If you feel like we are closing in error, please re-open and add additional details about the bug or feature request.