必须在环境中设置 Meteor Deployment to Galaxy MONGO_URL

Meteor Deployment to Galaxy MONGO_URL must be set in environment

我正在尝试使用 Monglab 作为我的后端数据库来部署到 Meteor Galaxy。 Mongolab 账号设置正确,用户名和密码都正常。我经常收到 MONGO_URL must be set in environment

我的代码: 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)

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

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

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

试试这个:

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

谢谢 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"
 }

} }

我正在部署到 eu-west Galaxy 站点 eu-west-1.galaxy.meteor.com,但我部署的 Galaxy 应用程序仍然崩溃并显示 "MONGO_URL must be set in environment" 消息,直到我在 settings.json 文件在两个地方(见上面 user2690440 的 post)。