0.01
Repository is archived
No release in over 3 years
Low commit activity in last 3 years
autocanary24 provides a small convenient module for blue/green and canary deployments with CloudFormation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies
 Project Readme

AutoCanary24

Build Status

AutoCanary24 is a ruby utility to do blue/green and canary deployments with AWS CloudFormation stacks.

This library use the Swap AutoScaling Groups approach and expects two stacks. A "base" stack which includes at least the ELB and another which includes the AutoScaling Group.

Installation

Add this line to your application's Gemfile:

gem 'autocanary24'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install autocanary24

Usage

Prerequisite: Deploy the base stack before

Initialize the client, e.g. in your Rakefile and deploy your stack:

# Configure the AutoCanary24 Client
ac = AutoCanary24::Client.new({
  keep_inactive_stack: false,
  keep_instances_balanced: false,
  scaling_instance_percent: 50
})

The available configuration:

  • keep_inactive_stack: If true the inactive stack gets not deleted. Default is false
  • keep_instances_balanced: If true a instance from current stack gets removed whenever a new instance from the new stack is added. If false first all new instances are created and afterwards the old instances gets removed. Default is false
  • scaling_instance_percent: Percent of instances which are added at once (depends on the actual number of instances, read from desired). Default is 100
  • wait_timeout: Timeout in seconds to wait for checking AWS operations are done before do a rollback. Default is 300
# Execute the deployment
ac.deploy_stack(parent_stack_name, template, parameters, tags, deployment_check)

The available parameters:

  • parent_stack_name: the name of the 'base' stack. In addition AutoStacker24 will read the output parameters of an existing stack and merge them to the given parameters.
  • template: is either the template json data itself or the name of a file containing the template body
  • parameters: specify the input parameter as a simple ruby hash. It gets converted to the cumbersome AWS format automatically. The template body will be validated and optionally preprocessed.
  • tags: Optional. Key-value pairs to associate with this stack.
  • deployment_check: Optional. A lambda which is executed whenever new instances are added to the ELB. If true AutoCanary continues, if false it will rollback to the current stack.

For more information about stacked CloudFormation stacks visit AutoStacker24.

Examples

Have a look into the examples subfolder

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/autoscout24/autocanary24.

License

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