Best way to host MongoDB for a Meteor server running on EC2?

I decided to host my Meteor server on an EC2 instance, which worked great with mupx, thanks to Arunoda and his team.

mupx also allows to install MongoDB right away on the same server, which is perfect for sand-boxing, but for a productive setup I’d rather like to separate the database from the server.

So I am asking myself what’s the best way to do this, i.e. how you folks are doing these kind of setups?

One option would be to use one of the dedicated services (like Compose, MongoDB Cloud Manager, or MongoLab). What are your experiences with these, which one would you recommend for a performant set-up (i.e. with oplog tailing). And, most important, is there any tutorial about how to connect a mupx-based Meteor instance to such an external service? Is it enough to just set the env variables in mupx.json? And how does this have to look like?

I have to apologize, but I’m quite a noob when it comes to DevOps, which is also the reason why a hosted Mongo service would be my first choice.

Another option would be, of course, to set-up a separate EC2 instance for the MongoDB server, so everything runs on AWS. Would there be any benefit for such a set-up, beyond not requiring another third party service? And is there any tutorial / recommendation on how to do this?

Thanks.

EDIT: A last question on this: How easy is it to move a production MongoDB instance to another provider? Is there some sort of export/import feature you could use for this? Or in other word: how hard is the “vendor-lock-in”, once you decide for such a hosted solution?

2 Likes

Just go with Compose and never look back - they’re awesome. To get up and running with mupx and oplog, just add something like the following to your mup.json (you can get the exact settings from your Compose dashboard):

...
  "env": {
    ...
    "MONGO_URL": "mongodb://db_name:db_pass@c44.candidate.56.mongolayer.com:10044,candidate.56.mongolayer.com:10044,candidate.55.mongolayer.com:10087/db_name?replicaSet=set-561a69337a8c1f81393939389",
    "MONGO_OPLOG_URL": "mongodb://db_name:db_pass@c44.candidate.56.mongolayer.com:10044,candidate.56.mongolayer.com:10044,candidate.55.mongolayer.com:10087/local?authSource=db_name"
  },
...
2 Likes

Thanks a lot for your fast reply and your sample config! Are you relying on Compose.io for your backups as well, or would you recommend an additional monitoring / backup service such as MongoDB’s Cloud Manager?

I rely on them for backups, but also have a scheduled process in place to routinely grab a copy of the db using Mongo’s mongodump tool, which is then stored in separate backup system.

1 Like

Great, sounds like a good plan!

Hmm, isn’t Compose expensive? Cheapest plan is for $18.00 / mo

BTW how about Galaxy, if I will host there should I host MongoDB somewhere else? If not, then Galaxy looks like much cheaper (and I think easier) solution than EC2 + Compose.

P.S. shouldn’t this topic be in #deployment category?

The cheapest Galaxy pricing plan
https://www.meteor.com/why-meteor/pricing
says: $650 per month (if paid monthly) or $495 per month (if paid yearly). This is way beyond my capabilities.

Why do you think EC2 and Compose would be even more expensive than that? At the moment, I’m using the AWS free tier, and $18 / GB / month for Mongo @ Compose.io seems way cheaper for me than the $650. Am I calculating wrong / missing something?!

EDIT: Changed the topic to #deployment. Thanks for the tip, it’s easy to miss as you won’t see it directly.

Absolutely not - sure you can find cheaper alternatives, but I’ve used them with 4 separate production apps, all with different scaling needs, and never once had a problem. Anytime I’ve reached out to them they’ve responded quickly and effectively (it was very clear they knew what they were talking about). These days a latte costs $4-$7 - paying $18/month to know my database is in good hands is more than worth it.

Just an FYI, Galaxy does not provide Mongo hosting (see item 3).

2 Likes

I did some additional research today and could not find any other provider that a comparable low price as Compose. Especially, if you take into account what you get for the money. The cheapest I found was MongoLab ($15 p.m.), but according to their website even a back-up run costs extra. The only pro I found was that they charge on a per-byte basis if you exceed the first GB. That might be actually cheaper than Compose. I also looked at Object Rocket, but was so confused by their pricing model that I went on.

@chompomonim: Which other providers did you have in mind when you said “Compose.io is expensive”?

Absolutely true.

If I understand their website correctly, they will raise the initial price to $31 / month when MongoDB+ is out of its beta phase (at least for the first GB; additional storage will be at $18). Do you happen to know if existing customers will be charged this higher price as well? Did they send out any customer information about this recently? Otherwise, it might be a good time-point to get their $18 tier as long as it is still available.

Take a look at their How We Price Our Databases post, the “MongoDB+ specced out” section in particular. They explain the reason for the price hike in honest detail. When MongoDB+ is out of beta it’s going to become their default Mongo offering. Existing customers will be able to maintain their existing plan (for a while anyways) but they won’t be able to take advantage of the newer MongoDB+ features. That being said, if you need to scale up, the price balances out between their MongoDB and MongoDB+ plans in the end (see the linked to article for more details).

1 Like

Thanks for this additional info and link. After reading to some of their documentation, I already got the feeling they have a very fair pricing model and market approach. Liked the statement that they might increase server capacity to make their devops teams’ life easier - without applying additional charges to their customers. Nice.

Do you happen to know if it is possible to move the Compose.io database location to another AWS datacenter? I would like to host it in eu-west-1 instead of us-east-1 (it was created automatically there). I read in their docs that they support other data-centers, but I am unsure if this is possible with the $18 service as I could not find an option to switch the data-center.

Sure thing:

Strange. I wasn’t asked this when I created my database. Do I have to delete the standard deployment to get this dialog?!

EDIT: Ok, I just dared to delete the standard deployment. And voilà, I got this dialog. Thanks again.

Thanks again for your support. My EC2 is now sucessfully connected to the Compose db, including oplog tailing etc. Worked like a charm! Of course I would still be interested if there’s a cheaper alternative out there with a comparable price-value relation (as I dunno if my app will ever make some money), but the time being I am more than happy with the solution. The admin front-end they’re providing is really great; I would definitely miss that if I had implemented MongoDB on EC2 on my own. And I know that backups are working correctly, which is a great relief.

Oh, good to see that MongoLab now offers their $15/mo shared solution in us-west-2 region! I was going to go with Compose because MongoLab didn’t offer that not too long ago. I’ll have to consider them again down the road.

I’d be curious about the cost of Compose MongoDB+ (with SSL) at $31/mo vs the equivalent on MongoLab (SSL, backups, etc).

What are the benefits you’d be expecting from MongoLab over Compose (besides the $3 lower price)?

Still if you are not very skilled in DevOps, I would consider some Meteor auto deployment solutions.
In US it is Galaxy Developer’s edition - I believe every1 have invite already
In EU I would probably look on Scalingo or IBM Bluemix

None, I was just comparing based on price. I believe Compose might have better stats/reporting though.

I was talking about Galaxy developer edition ($13 / container / month): http://info.meteor.com/blog/unlimited-containers-galaxy-developer-edition

Thanks for info. In this case compose.io totally makes sense :wink:

That my post was more question than suggestion :wink:
I’m running my apps on DigitalOcean and don’t have problems with Mongo at this stage. I’m not Mongo magician, but with spending a few hours, it’s not a problem to run it on separate server. When app usage will grow at least 10x times then I will look for solutions like compose.io. But for now don’t see any need for that.