Coder Social home page Coder Social logo

opsworks-wrapper's Introduction

OpsworksWrapper

A simple wrapper for aws-sdk to make handling opsworks operations easier.

Supported Operations

Deployment

  • Rolling/Non-Rolling deployment by layer
  • Update custom cookbooks
  • Non-Rolling Deployment Creation for all layers except a specified layer (exclusion by layer name)
  • Retrieve all instances for a given layer name

ELB

  • Detach instance from ELB (wait for draining)
  • Attach instance to ELB (wait for health check)

Installation

Add this line to your application's Gemfile:

gem 'opsworks_wrapper'

And then execute:

$ bundle

Or install it yourself as:

$ gem install opsworks_wrapper

Usage

Example OpsWorks Configuration

A simple OpsWorks stack with 2 layers, one is attached to an ELB

Layer 1:

  • name: Frontend
  • ELB attached: yes

Layer 2:

  • name: Backend
  • ELB attached: no

Rolling Deployment

require 'aws-sdk'
require 'opsworks_wrapper'

ACCESS_KEY = "yourAccessKey"
SECRET_KEY = "yourSecretKey"
OPSWORKS_APP_ID = "yourAppID"

# update AWS credentials
Aws.config.update({
                      region: 'us-east-1',
                      credentials: Aws::Credentials.new(ACCESS_KEY, SECRET_KEY)
                  })
                  
opsworks = OpsworksWrapper::Deployer.new(OPSWORKS_APP_ID)

# Do rolling deploy to backend layer
opsworks.deploy_layer_rolling('Backend')


# Do rolling deploy to frontend layer
# Note: Since frontend has an ELB, instances will be detached before deployment
# and re-attached. After re-attaching, wait for ELB health-check to pass
opsworks.deploy_layer_rolling('Frontend')

Update Custom Cookbooks

require 'aws-sdk'
require 'opsworks_wrapper'

ACCESS_KEY = "yourAccessKey"
SECRET_KEY = "yourSecretKey"
OPSWORKS_APP_ID = "yourAppID"

# update AWS credentials
Aws.config.update({
                      region: 'us-east-1',
                      credentials: Aws::Credentials.new(ACCESS_KEY, SECRET_KEY)
                  })
                  
opsworks = OpsworksWrapper::Deployer.new(OPSWORKS_APP_ID)

# Run command update-custom-cookbooks on all layers
# Note: this will not run deploy command
opsworks.update_cookbooks

Contributions

Bug reports and pull requests are welcome on GitHub at https://github.com/ukayani/opsworks-wrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

opsworks-wrapper's People

Stargazers

Zivago Lee avatar Calvin Lee Fernandes avatar

Watchers

 avatar Calvin Lee Fernandes avatar  avatar

Forkers

calvinlfer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.