elastic_beans 0.10.1 → 0.11.0.alpha2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 714445d0f639a4723d4be711674e6f52465c9bdf
4
- data.tar.gz: 35672259e4af742334994844dec0662c5db64844
3
+ metadata.gz: 7cf29882390196563d6e401c86f27aa56099845d
4
+ data.tar.gz: 1ecd6fd9e0f45035e3e3f236946c55f4f50ec17b
5
5
  SHA512:
6
- metadata.gz: 6295eedfb8c06ebbaa3ca129247b1d6fa0e8d5e697f2539e00d09d981712cdeb4a3fb885caee5e2de74451c68fcc64d106f1ecace0495aafbf2da7ded8fb53d3
7
- data.tar.gz: 18bb613c79a435f596a18d336ccc077a1cd5e0bfe758f2a82c503710b3222fbbef84fc05dca0a3d93735a2e980636f1a74365bbd9baaf0fa4fcb5ba7caa6a203
6
+ metadata.gz: 5470ba71fd7685d7d68f6e52770c10f5265189dc6777a53b6c2aaf9e2f01f2fef57f2704aae8693d6f9005ae567461a7ddda656bf144dbb225ec7f9c4860aa21
7
+ data.tar.gz: 14708dd76eeeedda6256cecb732610852e9c4ab15cf5994bcc44c41045bd0a05410bf688c9e27e4408e0243dcd77148fd4dccfea183667c1a159e5d96d9d43f3
@@ -19,6 +19,7 @@ class ElasticBeans::CLI < Thor
19
19
  option :database_url, aliases: %w(-d), desc: "The DATABASE_URL for the Rails application"
20
20
  option :image_id, aliases: %w(-i), desc: "A custom AMI to use instead of the default Ruby Elastic Beanstalk AMI"
21
21
  option :instance_type, aliases: %w(-t), desc: "A default instance type to use for all environments instead of c4.large"
22
+ option :internal, type: :boolean, desc: "Configure the webserver to only be available for internal VPC access"
22
23
  option :keypair, aliases: %w(-k), desc: "Required on first run. The EC2 keypair to use for Elastic Beanstalk instances"
23
24
  option :public_key, aliases: %w(-p), desc: "For end-to-end encryption. The public key of the SSL certificate the ELB will verify to communicate with your Rails app"
24
25
  option :secret_key_base, aliases: %w(-b), desc: "The SECRET_KEY_BASE for the Rails application"
@@ -29,6 +30,7 @@ class ElasticBeans::CLI < Thor
29
30
  database_url: options[:database_url],
30
31
  image_id: options[:image_id],
31
32
  instance_type: options[:instance_type],
33
+ internal: options[:internal],
32
34
  keypair: options[:keypair],
33
35
  public_key: options[:public_key],
34
36
  secret_key_base: options[:secret_key_base],
@@ -19,6 +19,7 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
19
19
  database_url:,
20
20
  image_id:,
21
21
  instance_type:,
22
+ internal:,
22
23
  keypair:,
23
24
  public_key:,
24
25
  secret_key_base:,
@@ -32,6 +33,7 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
32
33
  @database_url = database_url
33
34
  @image_id = image_id
34
35
  @instance_type = instance_type
36
+ @internal = internal
35
37
  @keypair = keypair
36
38
  @public_key = public_key
37
39
  @secret_key_base = secret_key_base
@@ -82,6 +84,7 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
82
84
  secret_key_base: secret_key_base,
83
85
  image_id: image_id,
84
86
  instance_type: instance_type,
87
+ internal: internal,
85
88
  keypair: keypair,
86
89
  iam: iam,
87
90
  public_key: public_key,
@@ -178,6 +181,7 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
178
181
  :database_url,
179
182
  :image_id,
180
183
  :instance_type,
184
+ :internal,
181
185
  :keypair,
182
186
  :network,
183
187
  :public_key,
@@ -13,7 +13,7 @@ module ElasticBeans
13
13
 
14
14
  # Constructs the configuration for the webserver environment.
15
15
  # All arguments are required on first run.
16
- def build_option_settings(network: nil, public_key: nil, ssl_certificate_arn: nil, **_)
16
+ def build_option_settings(network: nil, public_key: nil, ssl_certificate_arn: nil, internal: nil, **_)
17
17
  public_key_policy_names_setting = template_option_setting(namespace: "aws:elb:policies:backendencryption", option_name: "PublicKeyPolicyNames", default: "backendkey")
18
18
  public_key_setting = template_option_setting(namespace: "aws:elb:policies:#{public_key_policy_names_setting[:value]}", option_name: "PublicKey", override: public_key)
19
19
  ssl_certificate_setting = template_option_setting(namespace: "aws:elb:listener:443", option_name: "SSLCertificateId", override: ssl_certificate_arn)
@@ -21,7 +21,7 @@ module ElasticBeans
21
21
  raise NoEncryptionSettingsError
22
22
  end
23
23
 
24
- super + [
24
+ option_settings = [
25
25
  template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTPS:443/", allow_blank: false),
26
26
  template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_ASSET_COMPILATION", default: "false"),
27
27
  template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "false"),
@@ -36,6 +36,24 @@ module ElasticBeans
36
36
  public_key_setting,
37
37
  ssl_certificate_setting,
38
38
  ]
39
+ if internal
40
+ internal_setting = template_option_setting(namespace: "aws:ec2:vpc", option_name: "ELBScheme", override: "internal")
41
+ option_settings << internal_setting
42
+ end
43
+
44
+ super + option_settings
45
+ end
46
+
47
+ # Removes the "internal" ELB scheme if explicitly disabled with --no-internal.
48
+ def build_options_to_remove(internal: nil, **_)
49
+ option_settings = []
50
+
51
+ # Only remove this setting if internal has explicitly been disabled
52
+ if internal == false
53
+ option_settings << {namespace: "aws:ec2:vpc", option_name: "ELBScheme"}
54
+ end
55
+
56
+ super + option_settings
39
57
  end
40
58
 
41
59
  def elb_security_groups(network)
@@ -11,7 +11,7 @@ module ElasticBeans
11
11
  # namespace) directly.
12
12
  class ConfigurationTemplate
13
13
  # The solution stack used for a new application. Should not be hardcoded, but here we are.
14
- SOLUTION_STACK_NAME = "64bit Amazon Linux 2016.09 v2.2.0 running Ruby 2.3 (Puma)"
14
+ SOLUTION_STACK_NAME = "64bit Amazon Linux 2016.09 v2.3.3 running Ruby 2.3 (Puma)"
15
15
  # :category: Internal
16
16
  WORKER_TEMPLATE_NAME_PATTERN = /\Aworker-(?<queue>\w+)\z/
17
17
 
@@ -94,16 +94,26 @@ module ElasticBeans
94
94
  @option_settings ||= build_option_settings
95
95
  end
96
96
 
97
+ # Returns options to remove built in #upsert, or returns an empty array.
98
+ # Will only be present if some options have been explicitly removed.
99
+ def options_to_remove
100
+ # If #upsert has not been called, return an empty array.
101
+ # Nothing to remove unless options were explicitly disabled via #upsert.
102
+ @options_to_remove ||= []
103
+ end
104
+
97
105
  # Create or update the configuration template in Elastic Beanstalk.
98
- # Arguments are passed to #build_option_settings.
106
+ # Arguments are passed to #build_option_settings and #build_options_to_remove.
99
107
  # See the appropriate subclass for what the arguments should be.
100
108
  def upsert(**args)
101
109
  @option_settings = build_option_settings(**args)
110
+ @options_to_remove = build_options_to_remove(**args)
102
111
  if configuration_settings_description
103
112
  elastic_beanstalk.update_configuration_template(
104
113
  application_name: application.name,
105
114
  template_name: name,
106
115
  option_settings: option_settings,
116
+ options_to_remove: options_to_remove,
107
117
  )
108
118
  else
109
119
  elastic_beanstalk.create_configuration_template(
@@ -129,6 +139,10 @@ module ElasticBeans
129
139
  []
130
140
  end
131
141
 
142
+ def build_options_to_remove(**_)
143
+ []
144
+ end
145
+
132
146
  def configuration_settings_description(template_name = name)
133
147
  @configuration_templates ||= {}
134
148
  return @configuration_templates[template_name] if @configuration_templates[template_name]
@@ -195,6 +195,7 @@ module ElasticBeans
195
195
  elastic_beanstalk.update_environment(
196
196
  environment_name: name,
197
197
  option_settings: configuration_template.option_settings,
198
+ options_to_remove: configuration_template.options_to_remove,
198
199
  )
199
200
  wait_environment(wait_status: "Updating", wait_health_status: "Info")
200
201
  rescue ::Aws::ElasticBeanstalk::Errors::InvalidParameterValue
@@ -1,3 +1,3 @@
1
1
  module ElasticBeans
2
- VERSION = "0.10.1"
2
+ VERSION = "0.11.0.alpha2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_beans
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Stegman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -250,9 +250,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
250
  version: '0'
251
251
  required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  requirements:
253
- - - ">="
253
+ - - ">"
254
254
  - !ruby/object:Gem::Version
255
- version: '0'
255
+ version: 1.3.1
256
256
  requirements: []
257
257
  rubyforge_project:
258
258
  rubygems_version: 2.6.11