Rocket.chat: rocketchat requiring mongodb ReplicaSet

Created on 27 Dec 2016  路  7Comments  路  Source: RocketChat/Rocket.Chat

Rocketchat version : 0.49

Current Scenario :

Currenly we upgraded our rocketchat 馃殌 version to 0.49 from 0.48.1. Till now we have used a standalone mongo instance for our rocketchat app .

Problem Faced :

This upgrade in version has bought some issue while connecting to our mongodb local server as a result our node server cannot be started . After starting the node server with the command PORT=3000 ROOT_URL=http://localhost:3000 MONGO_URL=mongodb://localhost:27017/rocketchat node main.js which basically starts node server taking mongo env as a parameter , I get the following error .

_:>PORT=3000 ROOT_URL=http://localhost:3000 MONGO_URL=mongodb://localhost:27017/rocketchat node main.js
Will load cache for users
0 records load from users

```bash
Your MongoDB is not with ReplicaSet enabled.
Please enable it.
You can see more information at:
* https://docs.mongodb.com/v3.2/tutorial/convert-standalone-to-replica-set/
* https://github.com/RocketChat/Rocket.Chat/issues/5212


Exception in callback of async function: Error: [Your MongoDB is not with ReplicaSet enabled.]
    at ModelsBaseCache.startOplog (meteor://馃捇app/packages/rocketchat:lib/server/models/_BaseCache.js:435:10)
    at ModelsBaseCache.target.(anonymous function) [as startOplog] (meteor://馃捇app/packages/rocketchat:lib/server/models/_BaseCache.js:50:24)
    at ModelsBaseCache.load (meteor://馃捇app/packages/rocketchat:lib/server/models/_BaseCache.js:423:8)
    at meteorInstall.node_modules.meteor.rocketchat:lib.server.startup.cache.CacheLoad.js (meteor://馃捇app/packages/rocketchat:lib/server/startup/cache/CacheLoad.js:36:31)
    at fileEvaluate (packages/modules-runtime.js:181:9)
    at require (packages/modules-runtime.js:106:16)
    at /home/deploy/devops_playground/rocketchat/bundle/programs/server/packages/rocketchat_lib.js:16939:1
    at /home/deploy/devops_playground/rocketchat/bundle/programs/server/packages/rocketchat_lib.js:16991:3
    at /home/deploy/devops_playground/rocketchat/bundle/programs/server/boot.js:295:34
    at Function._.each._.forEach (/home/deploy/devops_playground/rocketchat/node_modules/underscore/underscore.js:153:9)
    at /home/deploy/devops_playground/rocketchat/bundle/programs/server/boot.js:128:5
    at /home/deploy/devops_playground/rocketchat/bundle/programs/server/boot.js:344:5
    at Function.run (/home/deploy/devops_playground/rocketchat/bundle/programs/server/profile.js:480:12)
    at /home/deploy/devops_playground/rocketchat/bundle/programs/server/boot.js:343:11_

Mode of deployment :

We have been using capistrano for our deployment .

The major task performed during deployment are listed respectively :

  • asset.rake :

_namespace :test do

desc "Pull and deflate assets"
task :decompress do
on roles(:app) do |server|
execute "cd #{release_path} && meteor npm install"
execute "cd #{release_path} && meteor build --directory . --architecture os.linux.x86_64"
end
end
end_

  • task.rake

_namespace :test do
desc 'start the meteor server'
task :start do
on roles :app do
within release_path do
execute 'supervisorctl restart node'
end
end
end
end
after 'deploy:updated', 'test:start'_

When supervisor restarts the node app it will search its configuration file for respective app . The supervisor configuration file goes as :

_[program:node]
environment=HOME="/home/deploy",PORT="3000",ROOT_URL="http://localhost:3000",MONGO_URL="mongodb://localhost:27017/rocketchat_staging"
directory=/home/deploy/rocketchat/current/bundle
command=/home/deploy/.meteor/packages/meteor-tool/.1.4.2_3.17tso1e++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node main.js
autorestart=true
redirect_stderr=true
user=deploy
stderr_logfile = /var/log/supervisord/node_stderr.log
stdout_logfile = /var/log/supervisord/node-stdout.log_

changelog of current rocketchat app :

  • Add button to refresh aouth services
  • Fix download on electron
  • Fix issue creating users with username from OAuth
  • Fix message when username field not exists in OAuth data
  • Fix OAuth global variable

Question :

  • Is this upgrade in version requires mongo to be in replica set ? If not what is the main culprit ?
deployment support

Most helpful comment

This issue seems to happen again with 1.0.0

All 7 comments

Yes
You can just set up a replica set with just 1 server, at least that's how I've done it.
See https://github.com/RocketChat/Rocket.Chat/blob/develop/docker-compose.yml#L31 for what arguments you have to supply to mongo and see https://github.com/RocketChat/Rocket.Chat/blob/develop/docker-compose.yml#L39 for what you have to execute to enable it

@lucasvanhalst my bad it was version 0.49 which was throwing issue with replica set @:( so does this version 0.49 requires mongo to be in replicaset .

Yes, the current state of version 0.49 is that is only runs on replicaset. We will try to change that before we merge it to master.

Thank you @engelgabriel

We are working to make it optional again in https://github.com/RocketChat/Rocket.Chat/pull/5371

@engelgabriel yah . I think making optional is a good choice . For local we can work with standalone mongo and for production we can go for ReplicaSet . Thank you again .

This issue seems to happen again with 1.0.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlprieb picture karlprieb  路  3Comments

royalaid picture royalaid  路  3Comments

Buzzele picture Buzzele  路  3Comments

antn89 picture antn89  路  3Comments

marceloschmidt picture marceloschmidt  路  3Comments