必须在环境中设置到Galaxy的Meteor部署MONGO_URL

时间:2016-03-27 12:46:45

标签: mongodb meteor mlab

我正在尝试使用Monglab作为我的后端数据库部署到Meteor Galaxy。 Mongolab帐户设置正确,用户名和密码都正常工作。我不断得到一个MONGO_URL必须在环境中设置

我的代码: settings.json

{
    "galaxy.meteor.com": {
        "env": {
        "ROOT_URL": "http://<myapp>.meteorapp.com/", 
        "MONGO_URL":"mongodb://<login>:<password>@ds012345.mlab.com:12345/<db>"
        }
    }
}

部署命令

$ meteor deploy <myapp>.meteorapp.com --settings <pathto>/settings.json

这是我收到的错误消息:

p67c 2016-03-27 08:41:09 04:00/app/bundle/programs/server/node_modules/fibers/future.js:245
p67c 2016-03-27 08:41:09-04:00  throw(ex);
p67c 2016-03-27 08:41:09-04:00  ^
p67c 2016-03-27 08:41:10-04:00 Error: MONGO_URL must be set in environment
p67c 2016-03-27 08:41:10-04:00 at Object.<anonymous> (packages/mongo/remote_collection_driver.js:36:1)
p67c 2016-03-27 08:41:10-04:00 at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
p67c 2016-03-27 08:41:10-04:00 at new Mongo.Collection (packages/mongo/collection.js:102:1)
p67c 2016-03-27 08:41:10-04:00 at AccountsServer.AccountsCommon (accounts_common.js:23:18)
p67c 2016-03-27 08:41:10-04:00 at new AccountsServer (accounts_server.js:16:5)
p67c 2016-03-27 08:41:10-04:00 at Package (globals_server.js:5:12)
p67c 2016-03-27 08:41:10-04:00 at /app/bundle/programs/server/packages/accounts-base.js:1814:4
p67c 2016-03-27 08:41:10-04:00 at /app/bundle/programs/server/packages/accounts-base.js:1825:3
p67c 2016-03-27 08:41:10-04:00 at /app/bundle/programs/server/boot.js:242:10
p67c 2016-03-27 08:41:10-04:00 at Array.forEach (native)

非常感谢您的建议和指导。谢谢。

3 个答案:

答案 0 :(得分:3)

您需要使用环境变量DEPLOY_HOSTNAME指定部署到Galaxy。

否则它将尝试部署到旧的Meteor托管服务IIRC。

试试这个:

DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy <myapp>.meteorapp.com --settings <pathto>/settings.json

答案 1 :(得分:3)

谢谢hexsprite。这确实有效。好吧,我在命令行输入了它作为变量。我需要做的是将其作为我的settings.json和POW的一部分输入!有效。谢谢

{
    "galaxy.meteor.com": {
        "env": {
            "ROOT_URL": "http://<myapp>.meteorapp.com/", 
            "DEPLOY_HOSTNAME":"galaxy.meteor.com",    
            "MONGO_URL": "mongodb://<login>:<password>@ds0012345.mlab.com:12345/mydata"
 }

} }

答案 2 :(得分:0)

我正在部署到欧洲西部银河网站eu-west-1.galaxy.meteor.com,但我部署的Galaxy应用程序仍然与#34; MONGO_URL崩溃必须在环境中设置&#34;消息,直到我在两个地方的settings.json文件中使用galaxy.meteor.com(参见上面的user2690440和帖子)。