Modules: BlueGreen
Mina module for Blue Green Deployment.
Installation
Add this line to your application's Gemfile:
gem 'mina-blue_green', require: falseAnd then execute:
$ bundle
Or install it yourself as:
$ gem install mina-blue_green
Usage
Require mina/blue_green in your config/deploy.rb:
require 'mina/blue_green'
set :blue, '198.51.100.1' # Use an IP address
set :green, 'example.com' # or domain name
...
task setup: :environment do
...
end
desc 'Deploys the current version to the server.'
task deploy: :environment do
...
endThen run:
$ bundle exec mina blue statusYou can run commands on either blue or green:
$ bundle exec mina green unicorn:startOr:
$ bundle exec mina blue deployWith mina-multistage:
$ bundle exec mina production green deploySuggestions for use with AWS
This requires two EC2 instances (blue and green) and two ELBs (production and staging). The production ELB's health check gets a healthy response when an instance is running in production. Likewise, the staging ELB points to an endpoint that only responds healthily when an instance is running in staging. In this way, by promoting an instance to production it will automatically go live. If no staging environment is needed, both blue and green can be run in production mode and the ELB will balance their load.
Switching environments
If you're running unicorn you need to stop it first:
$ bundle exec mina blue unicorn:stop$ bundle exec mina staging blue deployContributing
Bug reports and pull requests are welcome on GitHub at https://github.com/reedlaw/mina-blue_green.
License
The gem is available as open source under the terms of the MIT License.