elbas 0.19.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.travis.yml +2 -2
- data/README.md +3 -0
- data/bin/rspec +16 -0
- data/elbas.gemspec +1 -2
- data/lib/elbas.rb +1 -1
- data/lib/elbas/ami.rb +1 -2
- data/lib/elbas/aws/autoscaling.rb +1 -2
- data/lib/elbas/aws/credentials.rb +1 -2
- data/lib/elbas/aws/ec2.rb +1 -2
- data/lib/elbas/aws_resource.rb +3 -6
- data/lib/elbas/launch_configuration.rb +8 -10
- data/lib/elbas/logger.rb +1 -3
- data/lib/elbas/retryable.rb +0 -2
- data/lib/elbas/taggable.rb +0 -2
- data/lib/elbas/version.rb +1 -1
- data/spec/ami_spec.rb +1 -1
- data/spec/elbas_spec.rb +6 -2
- data/spec/support/stubs/DescribeLaunchConfigurations.200.xml +2 -2
- data/spec/support/stubs/DescribeTags.200.xml +7 -1
- metadata +26 -24
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjI4YjhlOTY3ZjBjOTBmMDhlYjg3ZDcwODIzN2M0YjBlY2RkMTNmNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTdlMDNhMjBiZWZiOTU5MmQ3OGU0YjRkOGUwNWU5MzJiNWJhNTg3ZA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OWViMWYwMGM1MjAzZGYzODE1NmNjMGNkYjkyOTdkYzczNTg1Zjc5NTFhOWQ3
|
10
|
+
OTRhMWRlYzk0NGQ0NDAyY2EzYWMxZjAxZTdlZmRjNjM2M2U2MTcwODM4MTE3
|
11
|
+
MDhlOTRlYzg5MGQ5MWVhMjU3ZGI2YjFiMmZhOTI2NzAxYTBmNTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
N2E2NjgzNzhjNzU4NGZmNWE5ODgwNzEyMjQ0OGIzMjU4Y2VhMDY2ZWRjYWJl
|
14
|
+
NWFkODljMzU1Y2NiZjI3OTUxNjljZmQ4Y2RhNmYzYWViYjBjZTRlMTE3MmE0
|
15
|
+
Y2ZlODEwZGI3NzliZjlkMTYwMDM4ZmU4ODJlOTJlZWNjNmUzMGE=
|
data/.travis.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.
|
4
|
+
- 2.3.0
|
5
5
|
sudo: false
|
6
6
|
deploy:
|
7
7
|
provider: rubygems
|
@@ -11,4 +11,4 @@ deploy:
|
|
11
11
|
repo: lserman/capistrano-elbas
|
12
12
|
branch: master
|
13
13
|
api_key:
|
14
|
-
secure:
|
14
|
+
secure: gRiZBVBq+/AtMoOeSsMlnCLawQVzN/SVXyOC7+5gni8iKPGDpXL+CBrUv410WStBmA2c4SYn9lNmeLOea31TOA0yIMnjfjA36jPNKzKWThRb9NuUzV8ySGqBcqp1YhvZta46Jv+d3HovGgSJ0aw5tCSfB+gPdwNvkFvqe+zIy3Y=
|
data/README.md
CHANGED
@@ -30,6 +30,9 @@ set :aws_region, ENV['AWS_REGION']
|
|
30
30
|
|
31
31
|
set :aws_no_reboot_on_create_ami, true
|
32
32
|
set :aws_autoscale_instance_size, 'm1.small'
|
33
|
+
|
34
|
+
set :aws_launch_configuration_detailed_instance_monitoring, true
|
35
|
+
set :aws_launch_configuration_associate_public_ip, true
|
33
36
|
```
|
34
37
|
|
35
38
|
## Usage
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/elbas.gemspec
CHANGED
@@ -23,8 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
spec.add_development_dependency "webmock"
|
25
25
|
|
26
|
-
spec.add_dependency 'aws-sdk', '~> 1'
|
26
|
+
spec.add_dependency 'aws-sdk-v1', '~> 1'
|
27
27
|
spec.add_dependency 'capistrano', '> 3.0.0'
|
28
28
|
spec.add_dependency 'activesupport', '>= 4.0.0'
|
29
|
-
|
30
29
|
end
|
data/lib/elbas.rb
CHANGED
data/lib/elbas/ami.rb
CHANGED
@@ -7,6 +7,7 @@ module Elbas
|
|
7
7
|
ami.cleanup do
|
8
8
|
ami.save
|
9
9
|
ami.tag 'Deployed-with' => 'ELBAS'
|
10
|
+
ami.tag 'ELBAS-Deploy-group' => ami.autoscale_group_name
|
10
11
|
yield ami
|
11
12
|
end
|
12
13
|
end
|
@@ -27,7 +28,6 @@ module Elbas
|
|
27
28
|
end
|
28
29
|
|
29
30
|
private
|
30
|
-
|
31
31
|
def name
|
32
32
|
timestamp "#{environment}-AMI"
|
33
33
|
end
|
@@ -37,6 +37,5 @@ module Elbas
|
|
37
37
|
deployed_with_elbas? ami
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
41
40
|
end
|
42
41
|
end
|
data/lib/elbas/aws/ec2.rb
CHANGED
data/lib/elbas/aws_resource.rb
CHANGED
@@ -15,8 +15,7 @@ module Elbas
|
|
15
15
|
self
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
private
|
20
19
|
def base_ec2_instance
|
21
20
|
@_base_ec2_instance ||= autoscale_group.ec2_instances.filter('instance-state-name', 'running').first
|
22
21
|
end
|
@@ -29,11 +28,9 @@ module Elbas
|
|
29
28
|
"#{str}-#{Time.now.to_i}"
|
30
29
|
end
|
31
30
|
|
32
|
-
private
|
33
|
-
|
34
31
|
def deployed_with_elbas?(resource)
|
35
|
-
resource.tags['Deployed-with'] == 'ELBAS'
|
32
|
+
resource.tags['Deployed-with'] == 'ELBAS' &&
|
33
|
+
resource.tags['ELBAS-Deploy-group'] == autoscale_group_name
|
36
34
|
end
|
37
|
-
|
38
35
|
end
|
39
36
|
end
|
@@ -17,7 +17,7 @@ module Elbas
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def attach_to_autoscale_group!
|
20
|
-
info
|
20
|
+
info 'Attaching Launch Configuration to AutoScale Group'
|
21
21
|
autoscale_group.update(launch_configuration: aws_counterpart)
|
22
22
|
end
|
23
23
|
|
@@ -29,9 +29,8 @@ module Elbas
|
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
|
-
|
33
32
|
def name
|
34
|
-
timestamp "ELBAS-#{environment}-LC"
|
33
|
+
timestamp "ELBAS-#{environment}-#{autoscale_group_name}-LC"
|
35
34
|
end
|
36
35
|
|
37
36
|
def instance_size
|
@@ -39,21 +38,21 @@ module Elbas
|
|
39
38
|
end
|
40
39
|
|
41
40
|
def create_options
|
42
|
-
|
41
|
+
options = {
|
43
42
|
security_groups: base_ec2_instance.security_groups.to_a,
|
44
|
-
detailed_instance_monitoring: true,
|
45
|
-
associate_public_ip_address: true
|
43
|
+
detailed_instance_monitoring: fetch(:aws_launch_configuration_detailed_instance_monitoring, true),
|
44
|
+
associate_public_ip_address: fetch(:aws_launch_configuration_associate_public_ip, true)
|
46
45
|
}
|
47
46
|
|
48
47
|
if user_data = fetch(:aws_launch_configuration_user_data, nil)
|
49
|
-
|
48
|
+
options.merge user_data: user_data
|
50
49
|
end
|
51
50
|
|
52
|
-
|
51
|
+
options
|
53
52
|
end
|
54
53
|
|
55
54
|
def deployed_with_elbas?(lc)
|
56
|
-
lc.name
|
55
|
+
lc.name.include? "ELBAS-#{environment}-#{autoscale_group_name}-LC"
|
57
56
|
end
|
58
57
|
|
59
58
|
def trash
|
@@ -61,6 +60,5 @@ module Elbas
|
|
61
60
|
deployed_with_elbas? lc
|
62
61
|
end
|
63
62
|
end
|
64
|
-
|
65
63
|
end
|
66
64
|
end
|
data/lib/elbas/logger.rb
CHANGED
data/lib/elbas/retryable.rb
CHANGED
data/lib/elbas/taggable.rb
CHANGED
data/lib/elbas/version.rb
CHANGED
data/spec/ami_spec.rb
CHANGED
@@ -3,7 +3,7 @@ describe Elbas::AMI do
|
|
3
3
|
subject { Elbas::AMI.new }
|
4
4
|
|
5
5
|
it 'retries the tag 3 times' do
|
6
|
-
expect(subject).to receive(:aws_counterpart).exactly(3).times {
|
6
|
+
expect(subject).to receive(:aws_counterpart).exactly(3).times { fail RuntimeError }
|
7
7
|
subject.tag 'Test' => true
|
8
8
|
end
|
9
9
|
end
|
data/spec/elbas_spec.rb
CHANGED
@@ -33,6 +33,10 @@ describe 'ELBAS' do
|
|
33
33
|
it 'tags the new AMI with Deployed-with=ELBAS' do
|
34
34
|
expect(WebMock).to have_requested(:post, /ec2.(.*).amazonaws.com\/\z/).with(body: /Action=CreateTags&ResourceId.1=ami-4fa54026&Tag.1.Key=Deployed-with&Tag.1.Value=ELBAS/)
|
35
35
|
end
|
36
|
+
|
37
|
+
it 'tags the new AMI with ELBAS-Deploy-group=<autoscale group name>' do
|
38
|
+
expect(WebMock).to have_requested(:post, /ec2.(.*).amazonaws.com\/\z/).with(body: /Action=CreateTags&ResourceId.1=ami-4fa54026&Tag.1.Key=ELBAS-Deploy-group&Tag.1.Value=production/)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
describe 'Launch configuration creation & cleanup' do
|
@@ -48,12 +52,12 @@ describe 'ELBAS' do
|
|
48
52
|
end
|
49
53
|
|
50
54
|
it 'deletes any LCs with name =~ ELBAS-production' do
|
51
|
-
expect(WebMock).to have_requested(:post, /autoscaling.(.*).amazonaws.com\/\z/).with(body: /Action=DeleteLaunchConfiguration&LaunchConfigurationName=ELBAS-production-LC-1234567890/)
|
55
|
+
expect(WebMock).to have_requested(:post, /autoscaling.(.*).amazonaws.com\/\z/).with(body: /Action=DeleteLaunchConfiguration&LaunchConfigurationName=ELBAS-production-production-LC-1234567890/)
|
52
56
|
end
|
53
57
|
|
54
58
|
it 'attaches the LC to the autoscale group' do
|
55
59
|
launch_configuration.attach_to_autoscale_group!
|
56
|
-
expect(WebMock).to have_requested(:post, /autoscaling.(.*).amazonaws.com\/\z/).with(body: /Action=UpdateAutoScalingGroup&AutoScalingGroupName=production&LaunchConfigurationName=ELBAS-production-LC-\d{10,}/)
|
60
|
+
expect(WebMock).to have_requested(:post, /autoscaling.(.*).amazonaws.com\/\z/).with(body: /Action=UpdateAutoScalingGroup&AutoScalingGroupName=production&LaunchConfigurationName=ELBAS-production-production-LC-\d{10,}/)
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<PlacementTenancy>dedicated</PlacementTenancy>
|
8
8
|
<CreatedTime>2013-01-21T23:04:42.200Z</CreatedTime>
|
9
9
|
<KernelId/>
|
10
|
-
<LaunchConfigurationName>ELBAS-production-LC-1234567890</LaunchConfigurationName>
|
10
|
+
<LaunchConfigurationName>ELBAS-production-production-LC-1234567890</LaunchConfigurationName>
|
11
11
|
<UserData/>
|
12
12
|
<InstanceType>m1.small</InstanceType>
|
13
13
|
<LaunchConfigurationARN>arn:aws:autoscaling:us-east-1:803981987763:launchConfiguration:
|
@@ -26,4 +26,4 @@
|
|
26
26
|
<ResponseMetadata>
|
27
27
|
<RequestId>d05a22f8-b690-11e2-bf8e-2113fEXAMPLE</RequestId>
|
28
28
|
</ResponseMetadata>
|
29
|
-
</DescribeLaunchConfigurationsResponse>
|
29
|
+
</DescribeLaunchConfigurationsResponse>
|
@@ -7,5 +7,11 @@
|
|
7
7
|
<key>Deployed-with</key>
|
8
8
|
<value>ELBAS</value>
|
9
9
|
</item>
|
10
|
+
<item>
|
11
|
+
<resourceId>ami-1a2b3c4d</resourceId>
|
12
|
+
<resourceType>image</resourceType>
|
13
|
+
<key>ELBAS-Deploy-group</key>
|
14
|
+
<value>production</value>
|
15
|
+
</item>
|
10
16
|
</tagSet>
|
11
|
-
</DescribeTagsResponse>
|
17
|
+
</DescribeTagsResponse>
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elbas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: aws-sdk
|
70
|
+
name: aws-sdk-v1
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: capistrano
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>'
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 3.0.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ! '>'
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: activesupport
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 4.0.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 4.0.0
|
111
111
|
description: Capistrano plugin for deploying to AWS AutoScale Groups. Deploys to all
|
@@ -113,17 +113,19 @@ description: Capistrano plugin for deploying to AWS AutoScale Groups. Deploys to
|
|
113
113
|
AutoScale Group.
|
114
114
|
email:
|
115
115
|
- logan.serman@metova.com
|
116
|
-
executables:
|
116
|
+
executables:
|
117
|
+
- rspec
|
117
118
|
extensions: []
|
118
119
|
extra_rdoc_files: []
|
119
120
|
files:
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
121
|
+
- .gitignore
|
122
|
+
- .rspec
|
123
|
+
- .travis.yml
|
123
124
|
- Gemfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README.md
|
126
127
|
- Rakefile
|
128
|
+
- bin/rspec
|
127
129
|
- elbas.gemspec
|
128
130
|
- lib/elbas.rb
|
129
131
|
- lib/elbas/ami.rb
|
@@ -162,17 +164,17 @@ require_paths:
|
|
162
164
|
- lib
|
163
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
164
166
|
requirements:
|
165
|
-
- -
|
167
|
+
- - ! '>='
|
166
168
|
- !ruby/object:Gem::Version
|
167
169
|
version: '0'
|
168
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
171
|
requirements:
|
170
|
-
- -
|
172
|
+
- - ! '>='
|
171
173
|
- !ruby/object:Gem::Version
|
172
174
|
version: '0'
|
173
175
|
requirements: []
|
174
176
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.4.5
|
177
|
+
rubygems_version: 2.4.5
|
176
178
|
signing_key:
|
177
179
|
specification_version: 4
|
178
180
|
summary: Capistrano plugin for deploying to AWS AutoScale Groups.
|