capistrano-asg 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5b36a3b950014b5056f72b8e6203747165cf029
4
- data.tar.gz: d776ac1d3f9c8c000ab39346dbaf2503f6db181a
3
+ metadata.gz: a6445f3862b4f6a3f1696ee063ff9b33a7cd8788
4
+ data.tar.gz: c8ee258495a21de210c5e875c54a1030c8ee846a
5
5
  SHA512:
6
- metadata.gz: 54920d7b80aee2362185620a411bf3a0a8709563681f7c786b1de99d326ac4c4f433ec11b19502bae1eae7333901cfdb834a3a4db2c5c4f36eb045fa5f34eb6b
7
- data.tar.gz: 76294d9cf6439cc407fbcc7b82e7cad5f12796e2acaba37f708a1b11bba1eb087daa1043c00f1180d4c00ce2202de81a8e2f1d82f95ad3e35466f20b73b6a8b4
6
+ metadata.gz: 27d46985467271ba6ac8c056183e5103db62a411ef250d4b4515a32466ab95c12e023b9cbc7103faff76578541a8b82affab6a0adc3930dbe08be91cce886a3b
7
+ data.tar.gz: fa39d32720fa2324ac208fce1ba2b80d9f5d9c98f6d04cc418cecde6880cd7853bc5ae0f32706ace37cf4ed8377d543ff1e09cbc424944fc0276b0f272854f42
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # 0.6.0
2
+
3
+ * Breaking change/bug fix: Region-specific settings were not being preserved. A
4
+ new construct is required to set region specific settings. Do this:
5
+
6
+ ```ruby
7
+ set 'us-east-1'.to_sym, {
8
+ aws_autoscale_instance_size: 't2.medium',
9
+ aws_lc_name_prefix: 'lc-'
10
+ }
11
+ ```
12
+
13
+ See the README for more details.
14
+
1
15
  # 0.5.5
2
16
 
3
17
  * Support setting name prefixes for newly created launch configurations and AMIs
data/README.md CHANGED
@@ -30,11 +30,14 @@ set :aws_access_key_id, ENV['AWS_ACCESS_KEY_ID']
30
30
  set :aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY']
31
31
  set :aws_region, ENV['AWS_REGION']
32
32
 
33
- set :aws_no_reboot_on_create_ami, true
34
- set :aws_autoscale_instance_size, 'm1.small'
33
+ # To set region specific things:
34
+ set ENV['AWS_REGION'].to_sym, {
35
+ aws_no_reboot_on_create_ami: true,
36
+ aws_autoscale_instance_size: 'm1.small',
37
+ aws_launch_configuration_detailed_instance_monitoring: true,
38
+ aws_launch_configuration_associate_public_ip: true
39
+ }
35
40
 
36
- set :aws_launch_configuration_detailed_instance_monitoring, true
37
- set :aws_launch_configuration_associate_public_ip, true
38
41
  ```
39
42
 
40
43
  ## Usage
@@ -61,6 +64,9 @@ regions = %w(us-east-1 eu-west-1)
61
64
 
62
65
  regions.each do |region|
63
66
  set :aws_region, region
67
+ set region.to_sym, {
68
+ aws_autoscale_instance_size: 't2.medium'
69
+ }
64
70
  autoscale 'production', user: 'apps', roles: [:app, :web, :db]
65
71
  end
66
72
  ```
@@ -2,14 +2,20 @@ module Capistrano
2
2
  module Asg
3
3
  # Create launch configuration
4
4
  class LaunchConfiguration < AWSResource
5
- def self.create(ami, &_block)
6
- lc = new
5
+ attr_reader :region_config
6
+
7
+ def self.create(ami, region_config, &_block)
8
+ lc = new(region_config)
7
9
  lc.cleanup do
8
10
  lc.save(ami)
9
11
  yield lc
10
12
  end
11
13
  end
12
14
 
15
+ def initialize(region_config = {})
16
+ @region_config = region_config
17
+ end
18
+
13
19
  def save(ami)
14
20
  info "Creating an EC2 Launch Configuration for AMI: #{ami.aws_counterpart.id}"
15
21
  ec2_instance = ec2_resource.instance(base_ec2_instance.id)
@@ -19,12 +25,11 @@ module Capistrano
19
25
  image_id: ami.aws_counterpart.id,
20
26
  instance_type: instance_size,
21
27
  security_groups: ec2_instance.security_groups.map(&:group_id),
22
- associate_public_ip_address:
23
- fetch(:aws_launch_configuration_associate_public_ip, true),
28
+ associate_public_ip_address: region_config.fetch(:aws_launch_configuration_associate_public_ip, true),
24
29
  instance_monitoring: {
25
30
  enabled: fetch(:aws_launch_configuration_detailed_instance_monitoring, true)
26
31
  },
27
- user_data: fetch(:aws_launch_configuration_user_data, nil)
32
+ user_data: region_config.fetch(:aws_launch_configuration_user_data, nil)
28
33
  )
29
34
  end
30
35
  end
@@ -46,15 +51,15 @@ module Capistrano
46
51
  private
47
52
 
48
53
  def name
49
- timestamp fetch(:aws_lc_name_prefix, "cap-asg-#{environment}-#{autoscaling_group_name}-lc")
54
+ timestamp region_config.fetch(:aws_lc_name_prefix, "cap-asg-#{environment}-#{autoscaling_group_name}-lc")
50
55
  end
51
56
 
52
57
  def instance_size
53
- fetch(:aws_autoscale_instance_size, 'm1.small')
58
+ region_config.fetch(:aws_autoscale_instance_size, 'm1.small')
54
59
  end
55
60
 
56
61
  def deployed_with_asg?(lc)
57
- lc.name.include? "cap-asg-#{environment}-#{autoscaling_group_name}-lc"
62
+ lc.name.include? region_config.fetch(:aws_lc_name_prefix, "cap-asg-#{environment}-#{autoscaling_group_name}-lc")
58
63
  end
59
64
 
60
65
  def trash
@@ -19,7 +19,7 @@ namespace :asg do
19
19
  set :aws_autoscale_group, asg
20
20
  Capistrano::Asg::AMI.create do |ami|
21
21
  puts "Autoscaling: Created AMI: #{ami.aws_counterpart.id} from region #{region} in ASG #{asg}"
22
- Capistrano::Asg::LaunchConfiguration.create(ami) do |lc|
22
+ Capistrano::Asg::LaunchConfiguration.create(ami, fetch(region.to_sym, {})) do |lc|
23
23
  puts "Autoscaling: Created Launch Configuration: #{lc.aws_counterpart.name} from region #{region} in ASG #{asg}"
24
24
  asg_launch_config[region][asg] = lc.aws_counterpart.name
25
25
  asg_ami_id[region][asg] = ami.aws_counterpart.id
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capistrano
4
4
  module Asg
5
- VERSION = '0.5.5'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-asg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-09-27 00:00:00.000000000 Z
13
+ date: 2017-09-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler