11

I would like to use my own MongoHQ database to use when deploying a Meteor app using meteor deploy. The documentation explains how to do this when deploying and running on a machine I control:

$ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js

But the documentation seems a bit sparse on how to do this with meteor deploy. Is it possible?

EDIT: I tried following http://docs.meteor.com/#meteor_settings and added a settings.json file and put in it:

{"MONGO_URL" : "mongodb://user:pass@mongohq.com:10000/mydatabase"} 

then deployed with

meteor deploy myappname.meteor.com --settings settings.json

but the deployed version doesn't seen to be using my database

nickponline
  • 25,354
  • 32
  • 99
  • 167
  • You need to decide where the web server for meteor will run. MongoHQ can only fill the role of a DB Server. I suspect that the deploy bundler doesn't include the MONGO_URL, so deploying to the Meteor infrastructure won't use the MongoHQ database. But you should definitely ask the Meteor devs, and put in a request. – mjhm Jan 15 '13 at 04:51
  • I want to deploy it with "meteor deploy", which I think deploys to their server. But I would like to use my own instance of MongoHQ instead of the default one. – nickponline Jan 15 '13 at 12:22
  • I added a settings.json file and put in it: {"MONGO_URL" : "mongodb://user:pass@mongohq.com:10000/mydatabase"} then deployed with meteor `deploy myappname.meteor.com --settings settings.json` but the deployed version doesn't seen to be using my database. – nickponline Jan 15 '13 at 12:37

2 Answers2

3

I ended up deploying to Heroku instead using the buildpack. Then I could set the variables using the heroku configs.

nickponline
  • 25,354
  • 32
  • 99
  • 167
2

A quick scan of the codebase reveals this line in remote_collection_driver.js:

Meteor._RemoteCollectionDriver = new Meteor._RemoteCollectionDriver(process.env.MONGO_URL);

I'm sure if you hacked that to point where you wanted it, it would work. If that's too much of a kluge (for instance, if you plan on ever updating Meteor versions) you could experiment with trying to change Meteor._RemoteCollectionDriver or process.env.MONGO_URL early enough, from your own code (without hacking into Meteor's js directly). Good luck.

Jameson Quinn
  • 1,060
  • 15
  • 21