capistrano3-autoscaling-deploy 1.4 → 1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTNhMDI4MjliZjNlYWI3ZWQ3MTQxODE2ZTdiOTM0MmIyMGM0MDgxZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f87af3626f5137512f2622a61c6af16474b486c0
|
4
|
+
data.tar.gz: 3af50b11040713f646b126a13094a8f4a5ff4a7b
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWIwMDI3NjU1OWExZTIzZWM1OTVmMDdkMjdiODI2OTZkYjA4YTE4NjBmOTk1
|
11
|
-
MjY0MWVhMzI2ZTRkMGNiYjllMGIzNDc0ZWEyNjc5NDQ0YzVjZmI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MjBkNjlkNjIxYjZjNDBiY2UxMTVlM2E4MzQ0MTg2NmQ2YjM4NWYyNmY5MDcw
|
14
|
-
MmM3MGYzMGU5Y2MxYmY5ZDdiNWMzOTM5OTRiM2U5Yzg3ZDkyNzY0NmNiODJl
|
15
|
-
OWIyZmVmMDhhZTcyMzBhNzNhOTUzODZlMGQ3YTA4YWJhMzhhY2I=
|
6
|
+
metadata.gz: e509d0c05b01bdcc4fd751d130dbbc965aaaa7f637ccae83afab008fccdb7ad88e3a6290cf56dcc966647be8b50bee2c0b7efe5ae95317adeafbd034aa336751
|
7
|
+
data.tar.gz: 84223df370b1e5ab3f16f8685e4077e8890c4bfd90915ad8a64633eb4d148ae79bc01430109191f31d00ad0641dd66567f4beee5329134699af8718b0fd3925c
|
data/README.md
CHANGED
@@ -46,6 +46,10 @@ set :aws_secret_access_key, 'YOUR AWS SECRET KEY'
|
|
46
46
|
set :aws_autoscaling_group_name, 'YOUR NAME OF AUTO SCALING GROUP NAME'
|
47
47
|
set :aws_deploy_roles, [:app, :web, :db]
|
48
48
|
set :aws_deploy_user, 'USER FOR SSH CONNECTION'
|
49
|
+
|
50
|
+
# optional: defaults to 'public_dns_name'
|
51
|
+
# select from ['public_ip', 'public_dns_name', 'private_ip_address', 'private_dns_name']
|
52
|
+
set :aws_ip_type, 'public_dns_name'
|
49
53
|
```
|
50
54
|
|
51
55
|
you can add more auto scaling configs to deploy to multiple auto scaling groups like a cluster
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency 'aws-sdk', '~> 2'
|
22
22
|
spec.add_dependency 'capistrano', '~> 3'
|
23
|
-
spec.add_dependency 'capistrano-bundler', '~> 1.
|
23
|
+
spec.add_dependency 'capistrano-bundler', '~> 1.2.0'
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
25
25
|
spec.add_development_dependency 'rake'
|
26
|
-
end
|
26
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'aws-sdk'
|
2
2
|
|
3
3
|
module AwsHelper
|
4
|
-
|
4
|
+
IP_TYPES = %w(public_ip public_dns_name private_ip_address private_dns_name)
|
5
|
+
|
6
|
+
def get_instances(aws_region, aws_access_key_id, aws_secret_access_key, aws_autoscaling_group_name, aws_ip_type)
|
5
7
|
aws_credentials = Aws::Credentials.new(aws_access_key_id, aws_secret_access_key)
|
6
|
-
retrieve_ec2_instances(aws_region, aws_autoscaling_group_name, aws_credentials)
|
8
|
+
retrieve_ec2_instances(aws_region, aws_autoscaling_group_name, aws_credentials, aws_ip_type)
|
7
9
|
end
|
8
10
|
|
9
11
|
private
|
10
12
|
|
11
|
-
def retrieve_ec2_instances(aws_region, autoscaling_group_name, aws_credentials)
|
13
|
+
def retrieve_ec2_instances(aws_region, autoscaling_group_name, aws_credentials, aws_ip_type)
|
12
14
|
instances = fetch_autoscaling_group_instances(aws_region, autoscaling_group_name, aws_credentials)
|
13
15
|
|
14
16
|
if instances.empty?
|
@@ -17,8 +19,10 @@ module AwsHelper
|
|
17
19
|
instance_ids = instances.map(&:instance_id)
|
18
20
|
ec2 = Aws::EC2::Resource.new(region: aws_region, credentials: aws_credentials)
|
19
21
|
# info("Auto Scaling Group instances ids: #{instance_ids}")
|
22
|
+
aws_ip_type = 'public_dns_name' unless IP_TYPES.include? aws_ip_type
|
23
|
+
|
20
24
|
autoscaling_dns = instance_ids.map do |instance_id|
|
21
|
-
ec2.instance(instance_id).
|
25
|
+
ec2.instance(instance_id).send(aws_ip_type.to_sym)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -41,4 +45,4 @@ module AwsHelper
|
|
41
45
|
as_group.instances
|
42
46
|
end
|
43
47
|
|
44
|
-
end
|
48
|
+
end
|
@@ -6,6 +6,7 @@ namespace :load do
|
|
6
6
|
set :aws_autoscaling, true
|
7
7
|
set :aws_region, 'us-west-2'
|
8
8
|
set :aws_deploy_roles, %w{web app db}
|
9
|
+
set :aws_ip_type, 'public_dns_name'
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
@@ -42,8 +43,9 @@ namespace :autoscaling_deploy do
|
|
42
43
|
key = fetch(:aws_access_key_id)
|
43
44
|
secret = fetch(:aws_secret_access_key)
|
44
45
|
group_name = fetch(:aws_autoscaling_group_name)
|
46
|
+
ip_type = fetch(:aws_ip_type)
|
45
47
|
|
46
|
-
instances = get_instances(region, key, secret, group_name)
|
48
|
+
instances = get_instances(region, key, secret, group_name, ip_type)
|
47
49
|
|
48
50
|
puts("Found #{instances.count} servers (#{instances.join(',')}) for Auto Scaling Group: #{group_name} ")
|
49
51
|
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano3-autoscaling-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Chicote
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2'
|
20
20
|
type: :runtime
|
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: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3'
|
34
34
|
type: :runtime
|
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: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: capistrano-bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.5'
|
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: '1.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
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: '0'
|
83
83
|
description: Get all instances in an AutoScaling group by AutoScaling EC2 Tag and
|
@@ -88,8 +88,8 @@ executables: []
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .gitignore
|
92
|
-
- .travis.yml
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
93
|
- Gemfile
|
94
94
|
- Gemfile.lock
|
95
95
|
- LICENSE
|
@@ -114,12 +114,12 @@ require_paths:
|
|
114
114
|
- lib
|
115
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|