Search code examples
javascriptmeteordeploymentmeteor-blazemeteor-accounts

Meteor Galaxy Deployment fails - Containers crashing


I am using Meteor Blaze and now wanted to deploy my app via Meteor Galaxy. Everything works on local host.

Now, I tried to deploy my app to Galaxy from a Windows computer.

Unfortunately, I always receive the following error logs and the containers are crashing:

2017-08-14 11:50:38+02:00/app/bundle/programs/server/node_modules/fibers/future.js:313
2017-08-14 11:50:38+02:00   throw(ex);
2017-08-14 11:50:38+02:00   ^
2017-08-14 11:50:39+02:00MongoError: not authorized on admin to execute command { listIndexes: “users”, cursor: { } }
2017-08-14 11:50:39+02:00 at Object.Future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:449:15)
2017-08-14 11:50:39+02:00 at [object Object].MongoConnection._ensureIndex (packages/mongo/mongo_driver.js:832:10)
2017-08-14 11:50:39+02:00 at [object Object].Mongo.Collection._ensureIndex (packages/mongo/collection.js:686:20)
2017-08-14 11:50:39+02:00 at setupUsersCollection (packages/accounts-base/accounts_server.js:1490:9)
2017-08-14 11:50:39+02:00 at new AccountsServer (packages/accounts-base/accounts_server.js:51:5)
2017-08-14 11:50:39+02:00 at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
2017-08-14 11:50:39+02:00 at fileEvaluate (packages/modules-runtime.js:333:9)
2017-08-14 11:50:39+02:00 at require (packages/modules-runtime.js:228:16)
2017-08-14 11:50:39+02:00 at /app/bundle/programs/server/packages/accounts-base.js:2038:15
2017-08-14 11:50:39+02:00 at /app/bundle/programs/server/packages/accounts-base.js:2049:3
2017-08-14 11:50:39+02:00 - - - - -
2017-08-14 11:50:39+02:00 at Function.MongoError.create (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/error.js:31:11)
2017-08-14 11:50:39+02:00 at queryCallback (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/cursor.js:212:36)
2017-08-14 11:50:39+02:00 at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:469:18
2017-08-14 11:50:39+02:00 at nextTickCallbackWith0Args (node.js:489:9)
2017-08-14 11:50:39+02:00 at process._tickCallback (node.js:418:13)
2017-08-14 11:50:39+02:00 Application exited with code: 1
2017-08-14 11:50:44+02:00 The container has crashed. A new container will be started to replace it.

Could it have something to do with the “dev_bundle” folder which is created as soon as I start the app or deploy the app? Or do I have to search the error within the environmental variables in the settings.json file?

I am using MongoDB Atlas and the structure of the connection string is the same as provided from mongoDB Atlas. The settings.json file looks like this:

{
  "galaxy.meteor.com": {
    "env": {
      "ROOT_URL": "http://myapp.eu.meteorapp.com", 
      "MONGO_URL": "mongodb://<myUsername>:<password>@<clusterName>-shard-00-00-<xxxxx>.mongodb.net:27017,<clusterName>-shard-00-01-<xxxxx>.mongodb.net:27017,<clusterName>-shard-00-02-<xxxxx>.mongodb.net:27017/admin?ssl=true&replicaSet=<clusterName>-shard-0&authSource=admin",
      "MONGO_OPLOG_URL": "mongodb://<myUsernameForOplog>:<password>@<clusterName>-shard-00-00-<xxxxx>.mongodb.net:27017,<clusterName>-shard-00-01-<xxxxx>.mongodb.net:27017,<clusterName>-shard-00-02-<xxxxx>.mongodb.net:27017/local?ssl=true&replicaSet=<clusterName>-shard-0&authSource=admin"
    }
  }

}  

Solution

  • Your error is:

    MongoError: not authorized on admin to execute command { listIndexes: “users”, cursor: { } }

    Seems like your MONGO_URL is wrong, could you share it (excluding crucial information: credentials etc)?

    Added:

    You're trying to read/write to the admin DB, but you should create your own, for example, meteor.

    Here is how your MONGO_URL should look like:

    mongodb://.../meteor?ssl=true&replicaSet=...&authSource=admin
    

    Your MONGO_OPLOG_URL is good, you need not change it.