setting up mongodb via AWS opsworks
Asked Answered
H

2

11

I am trying to setup a rails stack on AWS Opsworks and i want to use mongodb as the database.

I think that you set this up by creating a new custom layer and adding your chef reciepts to the relevant life cycle hooks but i am unsure as to what receipts to put where.

Can anyone help with how to add mongodb via a chef to AWS Opsworks?

I have seen there is a community mongodb cookbook but from what i can see its not compatible with Opsworks.

Does anyone have any experience of setting this up ?

Please can anyone help with this.

thanks a lot Rick

Hershey answered 5/9, 2013 at 13:30 Comment(1)
what did you end up doing for this?Lacreshalacrimal
R
5

I tried setting up a MongoDB 3-node replica set in OpsWorks a few months back. I will share a bit of my experience:

1) How to install a single MongoDB: It is possible and easy to install a single mongodb using the EDelight Chef MongoDB Cookbook. Just add it as a submodule in your custom opsworks chef repository.

To get it to work create a custom layer and call it MongoDB and excecute the following recipes

  • SETUP: mongodb:10gen_repo
  • CONFIGURE: mongodb:default

This will install the latest version of MongoDB.

NOTE: I used Ubuntu instances.

2) MongoDB Best Practices If you talk to MongoDB engineers or customer service reps, they will all tell you that the recommended setup for MongoDB is a 3 node replica set. This means one master and two read replicas hopefully in different availability zones. Also an ideal setup will have lots of RAM, to give you an example: the smallest instance provided by MongoDB that you can find in the AWS market place is a standard large:

MongoDB instance on AWS marketplace

You also have to consider using EBS on RAID10, maybe reserved IOPS...

See the white paper MongoDB on AWS for more info.

3) Security Considerations Ideally you want only application instances to access the DB instances. In AWS you could create a security group with custom rules and assign EC2 instances to the group you just created... Is not quite like this when it comes to OpsWorks as it forces you to have default security groups that have very lax restrictions. AWS will always adopt lax permissions over stricter ones.

4) Time and Money Considerations If the recommended setup is a 3 node replica set using large instances you are looking at at least $600 (on demand) for the DB and this doesn't add reserved IOPS, EBS, and so on. Automating this setup is possible yet not simple. It will take time or an expert in the subject to get you going. If you have the resources and personnel to deal with this go for it. If you are part of a small development team that want's to code more and do less operations, read on.

5) Find a reliable Managed Solution At first I was reluctant to the idea of using a third party company that offered MongoDB as a service. After much evaluation of the different options (Managed, AWS Marketplace, OpsWorks, Direct EC2 installation), I concluded that for our small team the best thing to do was to use either MongoLab or MongoHQ. They host and mange MongoDB instances of all sizes and prices. They even let you choose the hosting (AWS, Rackspace, etc), region and AZ. Price wise will be more expensive if you look at the hardware alone, but like I mentioned before you have to consider not only the price but the operational time MongoDB will require.

I have been there, done that, and ended up not using OpsWorks to host MongodDB. Hopefully this will save you some time and headaches.

Rickert answered 25/11, 2013 at 18:42 Comment(0)
V
1

I just tested this repo on github, it works for MongoDB / OpsWorks. Goto OpsWorks > Layers > In the "Custom Chef Recipes" section reference this github link "https://github.com/Cyclic/cookbooks" then add "yum::default" to the Setup lifecycle event. Then add "mongodb::10gen_repo" "mongodb::default" and "mongodb::10gen_remrepo" to the Setup lifecycle event

Vile answered 23/9, 2013 at 21:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.