make aws-missing-tools a gem

This commit is contained in:
Anuj Biyani 2013-05-30 16:19:08 -07:00
parent e35a0e1a8d
commit 2bdaca25bb
14 changed files with 95 additions and 23 deletions

View File

@ -1,6 +1,4 @@
source 'https://rubygems.org'
gem 'aws-sdk'
gem 'trollop'
gem 'rspec'
gem 'aruba'
# Specify your gem's dependencies in aws-missing-tools.gemspec
gemspec

View File

@ -1,3 +1,10 @@
PATH
remote: .
specs:
aws-missing-tools (0.0.1)
aws-sdk
trollop
GEM
remote: https://rubygems.org/
specs:
@ -40,6 +47,5 @@ PLATFORMS
DEPENDENCIES
aruba
aws-sdk
aws-missing-tools!
rspec
trollop

View File

@ -1,27 +1,30 @@
# Introduction:
# AWS HA Release
## Introduction:
aws-ha-release allows the high-availability / no downtime replacement of all EC2 Instances in an Auto Scaling Group that is behind an Elastic Load Balancer.
#
# Potential Use:
## Potential Use:
Some potential uses for aws-ha-release are listed below:
1. Delivery of new code - if your deployment scheme utilizes the termination of EC2 instances in order to release new code aws-ha-release provides an automated way to do this without incurring any downtime.
2. Return of all EC2 instances to "pristine" or "vanilla" state - all older EC2 instances can be replaced with newer EC2 instances.
# Directions For Use:
## Example of Use:
## Directions For Use:
### Example of Use:
`aws-ha-release.sh -a my-scaling-group`
the above example would terminate and replace each EC2 Instance in the Auto Scaling group "my-scaling-group" with a new EC2 Instance.
## Required Options:
### Required Options:
aws-ha-release.sh requires the following option:
`-a <auto-scaling-group-name>` - the name of the Auto Scaling Group for which you wish to perform a high availability release.
## Optional Parameters:
### Optional Parameters:
`-r <region>` - allows you specify the region in which your Auto Scaling Group is in. By default aws-ha-release assumes the "us-east-1" region.
`-t <elb_timeout>` - time, in seconds, in which an EC2 instance should be given to complete request processing prior to being terminated. Set this value high enough so that any requests sent through an ELB would have time to be completed by an EC2 instance. For example: if the ELB allows connections to stay open for 120 seconds then setting this value to 120 seconds allows an instance behind an ELB 120 seconds to complete all processing before being terminated. By default both an AWS ELB and aws-ha-release.sh utilize 60 seconds timeout period.
`-i <inservice_time_allowed>` - allows you to specify the number of seconds an EC2 instance is provided to come into service. By default EC2 instances are given 300 seconds to come into service - if aws-ha-release.sh notices that an instance has not come into service in 300 seconds it will exit and return an exit status of 79. If an EC2 instance and application combination requires more than 300 seconds to come "InService" from the perspective of an ELB then this value should be set to a greater number.
# Additional Information:
- Author: Colin Johnson / colin@cloudavail.com
- Date: 2012-12-09
- Version 0.1
- Authors: Colin Johnson / colin@cloudavail.com, Anuj Biyani / abiyani@lytro.com
- Date: 2013-05-30
- Version 0.0.1
- License Type: GNU GENERAL PUBLIC LICENSE, Version 3

23
aws-missing-tools.gemspec Normal file
View File

@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/aws-missing-tools/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Colin Johnson', 'Anuj Biyani']
gem.email = %w(colin@cloudavail.com abiyani@lytro.com)
gem.description = %q{Extensions to Amazon's AWS CLI Tools.}
gem.summary = %q{A collection of useful tools to supplement the AWS CLI Tools. Many of these tools depend on official AWS tools to function.}
gem.homepage = 'https://github.com/colinbjohnson/aws-missing-tools/'
gem.files = `git ls-files`.split("\n")
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'aws-missing-tools'
gem.require_paths = %w(lib)
gem.version = AwsMissingTools::VERSION
gem.add_dependency 'aws-sdk'
gem.add_dependency 'trollop'
gem.add_development_dependency 'aruba'
gem.add_development_dependency 'rspec'
end

View File

@ -10,7 +10,7 @@ end
opts = Trollop::options do
opt :as_group_name, 'AutoScaling Group Name', type: :string, short: '-a'
opt :region, 'Region', type: :string, short: '-r'
opt :region, 'Region', default: 'us-east-1', type: :string, short: '-r'
opt :elb_timeout, 'ELB Timeout', type: :int, default: 60, short: '-t'
opt :inservice_time_allowed, 'InService Time Allowed', type: :int, default: 300, short: '-i'
opt :aws_access_key, 'AWS Access Key', type: :string, short: '-o'

View File

@ -1,3 +1 @@
require 'aruba/cucumber'
ENV['PATH'] = "#{Dir.pwd}/aws-ha-release#{File::PATH_SEPARATOR}#{ENV['PATH']}"

8
lib/aws-missing-tools.rb Normal file
View File

@ -0,0 +1,8 @@
require 'aws-missing-tools/version'
module AwsMissingTools
require 'aws-sdk'
require 'trollop'
require 'aws-missing-tools/aws-ha-release/aws-ha-release'
end

View File

@ -0,0 +1,2 @@
class AwsHaRelease
end

View File

@ -0,0 +1,3 @@
module AwsMissingTools
VERSION = '0.0.1'
end

View File

@ -1,5 +0,0 @@
require 'rspec'
require File.expand_path('aws-ha-release/aws-ha-release.rb')
describe 'aws-ha-release' do
end

View File

@ -0,0 +1,22 @@
require 'spec_helper'
describe 'aws-ha-release' do
let(:opts) do
{
as_group_name: 'test_group',
aws_access_key: 'testaccesskey',
aws_secret_key: 'testsecretkey',
region: 'test-region'
}
end
before do
AWS.stub(:config)
AWS::AutoScaling.stub(:new).and_return(AWS::FakeAutoScaling.new)
end
describe '#initialize' do
it 'initializes the AWS connection'
it 'ensures the as group exists'
end
end

8
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,8 @@
require 'rspec'
require 'aws-missing-tools'
Dir['spec/support/**/*.rb'].each { |f| require File.expand_path(f) }
RSpec.configure do |config|
config.order = 'random'
end

View File

@ -0,0 +1,6 @@
module AWS
class FakeAutoScaling
def initialize
end
end
end