capistrano-asg 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/asg/launch_configuration.rb +2 -4
- data/lib/capistrano/asg/tasks/asg.rake +14 -6
- data/lib/capistrano/asg/version.rb +1 -1
- data/lib/capistrano/asg.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8fee06727da83250152a1719178d144e40bc7a0
|
4
|
+
data.tar.gz: 5c5a4b5a946c92450049dc0ffbc8980f1bdd9781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47a3d0b10852dacef4defe899d13c6109c2093fdad6d6b703014415ecec8e7ecbb981a634b559a66e833df1d5a55b0a6fa3a58d463da576bf51f881bc663f6d9
|
7
|
+
data.tar.gz: d4e1487c935cd83ea6f5b24c66a12e9e40f268f98da5ec47174fe89769b7ffc1b5ed774db2ecaa962bbd6e92a4bdb7ad1847365bcc605e79ca39026b7b5d3413
|
@@ -11,8 +11,7 @@ module Capistrano
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def save(ami)
|
14
|
-
info "Creating an EC2 Launch Configuration for AMI:
|
15
|
-
#{ami.aws_counterpart.id}"
|
14
|
+
info "Creating an EC2 Launch Configuration for AMI: #{ami.aws_counterpart.id}"
|
16
15
|
ec2_instance = ec2_resource.instance(base_ec2_instance.id)
|
17
16
|
with_retry do
|
18
17
|
@aws_counterpart = autoscaling_resource.create_launch_configuration(
|
@@ -31,8 +30,7 @@ module Capistrano
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def attach_to_autoscale_group!
|
34
|
-
info "Attaching Launch Configuration #{aws_counterpart.name}
|
35
|
-
to AutoScaling Group #{autoscaling_group.name}"
|
33
|
+
info "Attaching Launch Configuration #{aws_counterpart.name} to AutoScaling Group #{autoscaling_group.name}"
|
36
34
|
autoscaling_group.update(
|
37
35
|
launch_configuration_name: aws_counterpart.name
|
38
36
|
)
|
@@ -4,13 +4,21 @@ namespace :asg do
|
|
4
4
|
task :scale do
|
5
5
|
set :aws_access_key_id, fetch(:aws_access_key_id, ENV['AWS_ACCESS_KEY_ID'])
|
6
6
|
set :aws_secret_access_key, fetch(:aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY'])
|
7
|
-
set :aws_region, fetch(:aws_region, ENV['AWS_REGION'])
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
# Iterate over relevant regions
|
9
|
+
regions = fetch(:regions)
|
10
|
+
regions.keys.each do |region|
|
11
|
+
set :aws_region, region
|
12
|
+
# Iterate over relevant ASGs
|
13
|
+
regions[region].each do |asg|
|
14
|
+
set :aws_autoscale_group, asg
|
15
|
+
Capistrano::Asg::AMI.create do |ami|
|
16
|
+
puts "Autoscaling: Created AMI: #{ami.aws_counterpart.id} from region #{region} in ASG #{asg}"
|
17
|
+
Capistrano::Asg::LaunchConfiguration.create(ami) do |lc|
|
18
|
+
puts "Autoscaling: Created Launch Configuration: #{lc.aws_counterpart.name} from region #{region} in ASG #{asg}"
|
19
|
+
lc.attach_to_autoscale_group!
|
20
|
+
end
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
16
24
|
end
|
data/lib/capistrano/asg.rb
CHANGED
@@ -32,6 +32,10 @@ def autoscale(groupname, *args)
|
|
32
32
|
asg_instances = autoscaling_group.instances
|
33
33
|
|
34
34
|
set :aws_autoscale_group, groupname
|
35
|
+
region = fetch(:aws_region)
|
36
|
+
regions = fetch(:regions, {})
|
37
|
+
(regions[region] ||= []) << groupname
|
38
|
+
set :regions, regions
|
35
39
|
|
36
40
|
asg_instances.each do |asg_instance|
|
37
41
|
if asg_instance.health_status != 'Healthy'
|