Skip to content

ujuettner/opsworks-mongodb-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opsworks-mongodb-example

Using the mongodb community cookbook to set up a MongoDB replicat set within an AWS OpsWorks custom layer.

Inspired by the blog post Deploying MongoDB with OpsWorks.

  1. In AWS OpsWorks create a stack with the following properties:
{
  "mongodb": {
    "app_name": "todo_express",
    "config": {
      "replSet": "todors"
    }
  },
  "opsworks": {
    "data_bags": {
      "mongodb": {
        "mongodb1": {
          "mongodb": {
            "config": {
              "port": 27017
            },
            "replica_build_indexes": true,
            "replica_slave_delay": 0,
            "replica_priority": 1,
            "replica_tags": {},
            "replica_votes": 1
          }
        },
        "mongodb2": {
          "mongodb": {
            "config": {
              "port": 27017
            },
            "replica_build_indexes": true,
            "replica_slave_delay": 0,
            "replica_priority": 1,
            "replica_tags": {},
            "replica_votes": 1
          }
        },
        "mongodb3": {
          "mongodb": {
            "config": {
              "port": 27017
            },
            "replica_build_indexes": true,
            "replica_slave_delay": 0,
            "replica_priority": 1,
            "replica_tags": {},
            "replica_votes": 1
          }
        },
...
      }
    }
  }
}
  1. Add a custom layer, name it mongodb and add the following Custom Chef Recipes:
  • Setup: server
  • Configure: mongodb::replicaset
  1. Add a Node.js App Server layer and add client::deploy as Custom Chef Recipe for the Deploy lifecycle event.
  2. Add an app with the following properties:

Using Chef 11.10 is required, as Berkshelf, search and data bags are used:

  • Berkshelf is used to load the mongodb community cookbook.
  • Using search to find all online nodes within the mongodb layer.
  • Data bags to store required properties for the found nodes - as there's no Chef Server as central storage of such properties, a data bag is used.
  • mongodb/definitions/mongodb.rb is an overriding copy from the mongodb community cookbook to implement our special search query and to retreive the required properties from the data bag.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages