elastic_beans 0.13.0.alpha1 → 0.13.0.alpha2

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: 104398081411188937dfc9c983fcde0cc98de988
4
- data.tar.gz: ecce5ec7acf41af00e8310f05ba1b47f945e2428
3
+ metadata.gz: 2614bd01e1a8f79393555bb45e3d809bfd9c10a6
4
+ data.tar.gz: 5d6f634839f68a30640499d1ea9a0f0058765819
5
5
  SHA512:
6
- metadata.gz: ece21d2d195d9d0650189a2eef7af0eb2aed66ac0ef05f7392381f9b401dd37588f0dfc6d34e1e42f402cba0d24893027ddecfb1b6492e3fc4d272a1cef76859
7
- data.tar.gz: 70984a0532380942a69d23aca621f9664b3144986e5c21cba1c1777de128fc5bdfebf8885027ce9452dc3906cfe8b81f6804ea8e5dc096daf92bf268dd23c6c0
6
+ metadata.gz: f041edea2aba73fd8a02b3dbc3106c9a416968b2c066c4347ec152aae025b5ef873f9ce61207e2e966e6d711a07373975d073144a8fa9734642cfb4c000f9121
7
+ data.tar.gz: 3033e55d96aadc2fd2b059a9f441d76bbcde77e0fac8fbaf8fec6acded21ec4ea991b3224b22b207225a8c29ad50e7600bd7b4900d72e064d5812263df9db76c
data/README.md CHANGED
@@ -24,8 +24,8 @@ As the SDK documentation suggests, using environment variables is recommended.
24
24
 
25
25
  # Pre-configure the application before creating environments
26
26
  beans configure -n myapp-networking -a myapp \
27
- -p INTERNAL_PUBLIC_KEY -s SSL_CERTIFICATE_ARN -k KEYPAIR \
28
- [-o 'OPTION_SETTING_NAMESPACE/OPTION_NAME=VALUE'...]
27
+ -p INTERNAL_PUBLIC_KEY -s SSL_CERTIFICATE_ARN \
28
+ -k KEYPAIR [-i IMAGE_ID] [-t INSTANCE_TYPE]
29
29
  beans setenv -a myapp \
30
30
  DATABASE_URL=mysql2://db.example.com:3306/myapp \
31
31
  SECRET_KEY_BASE=abc123
@@ -65,8 +65,8 @@ As the SDK documentation suggests, using environment variables is recommended.
65
65
 
66
66
  # Update all existing environments and configuration
67
67
  beans configure -n myapp-networking -a myapp \
68
- [-p INTERNAL_PUBLIC_KEY] [-s SSL_CERTIFICATE_ARN] [-k KEYPAIR] \
69
- [-o 'OPTION_SETTING_NAMESPACE/OPTION_NAME=VALUE'...]
68
+ [-p INTERNAL_PUBLIC_KEY] [-s SSL_CERTIFICATE_ARN] \
69
+ [-k KEYPAIR] [-i IMAGE_ID] [-t INSTANCE_TYPE]
70
70
 
71
71
  ### API
72
72
 
@@ -16,21 +16,21 @@ class ElasticBeans::CLI < Thor
16
16
  long_desc ElasticBeans::Command::Configure::LONG_DESC
17
17
  option :application, aliases: %w(-a), required: true, desc: APPLICATION_DESC
18
18
  option :network, aliases: %w(-n), required: true, desc: "The name of the CloudFormation stack that contains networking settings"
19
+ option :image_id, aliases: %w(-i), desc: "A custom AMI to use instead of the default Ruby Elastic Beanstalk AMI"
20
+ option :instance_type, aliases: %w(-t), desc: "A default instance type to use for all environments instead of c4.large"
19
21
  option :internal, type: :boolean, desc: "Configure the webserver to only be available for internal VPC access"
20
22
  option :keypair, aliases: %w(-k), desc: "Required on first run. The EC2 keypair to use for Elastic Beanstalk instances"
21
- option :option_settings, aliases: %w(-o), type: :array, default: [], desc: "Option settings to configure, format is NAMESPACE/OPTION_NAME=VALUE, e.g. aws:ec2:vpc/ELBScheme=internal"
22
- option :option_settings_to_remove, aliases: %w(-r), type: :array, default: [], desc: "Option settings to remove, format is NAMESPACE/OPTION_NAME, e.g. aws:ec2:vpc/ELBScheme"
23
23
  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
24
  option :ssl_certificate_arn, aliases: %w(-s), desc: "The ARN of the SSL server certificate stored in IAM to attach to the ELB"
25
25
  def configure
26
26
  @verbose = options[:verbose]
27
27
  ElasticBeans::Command::Configure.new(
28
+ image_id: options[:image_id],
29
+ instance_type: options[:instance_type],
28
30
  internal: options[:internal],
29
31
  keypair: options[:keypair],
30
32
  public_key: options[:public_key],
31
33
  ssl_certificate_arn: options[:ssl_certificate_arn],
32
- option_settings: options[:option_settings],
33
- option_settings_to_remove: options[:option_settings_to_remove],
34
34
  application: application(name: options[:application]),
35
35
  network: network(stack_name: options[:network]),
36
36
  elastic_beanstalk: elastic_beanstalk_client,
@@ -16,24 +16,24 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
16
16
  LONG_DESC
17
17
 
18
18
  def initialize(
19
+ image_id:,
20
+ instance_type:,
19
21
  internal:,
20
22
  keypair:,
21
23
  public_key:,
22
24
  ssl_certificate_arn:,
23
- option_settings:,
24
- option_settings_to_remove:,
25
25
  application:,
26
26
  network:,
27
27
  elastic_beanstalk:,
28
28
  iam:,
29
29
  ui:
30
30
  )
31
+ @image_id = image_id
32
+ @instance_type = instance_type
31
33
  @internal = internal
32
34
  @keypair = keypair
33
35
  @public_key = public_key
34
36
  @ssl_certificate_arn = ssl_certificate_arn
35
- @option_setting_strings = option_settings
36
- @option_strings_to_remove = option_settings_to_remove
37
37
  @application = application
38
38
  @network = network
39
39
  @elastic_beanstalk = elastic_beanstalk
@@ -71,9 +71,9 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
71
71
  )
72
72
  base_config.upsert(
73
73
  network: network,
74
+ image_id: image_id,
75
+ instance_type: instance_type,
74
76
  keypair: keypair,
75
- option_settings: option_settings,
76
- options_to_remove: options_to_remove,
77
77
  iam: iam,
78
78
  )
79
79
  progressbar.increment
@@ -85,10 +85,10 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
85
85
  )
86
86
  webserver_config.upsert(
87
87
  network: network,
88
+ image_id: image_id,
89
+ instance_type: instance_type,
88
90
  internal: internal,
89
91
  keypair: keypair,
90
- option_settings: option_settings,
91
- options_to_remove: options_to_remove,
92
92
  iam: iam,
93
93
  public_key: public_key,
94
94
  ssl_certificate_arn: ssl_certificate_arn,
@@ -109,9 +109,9 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
109
109
  )
110
110
  exec_config.upsert(
111
111
  network: network,
112
+ image_id: image_id,
113
+ instance_type: instance_type,
112
114
  keypair: keypair,
113
- option_settings: option_settings,
114
- options_to_remove: options_to_remove,
115
115
  iam: iam,
116
116
  )
117
117
  exec_environment = exec_config.environment
@@ -130,9 +130,9 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
130
130
  )
131
131
  scheduler_config.upsert(
132
132
  network: network,
133
+ image_id: image_id,
134
+ instance_type: instance_type,
133
135
  keypair: keypair,
134
- option_settings: option_settings,
135
- options_to_remove: options_to_remove,
136
136
  iam: iam,
137
137
  )
138
138
  scheduler_environment = scheduler_config.environment
@@ -153,9 +153,9 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
153
153
  )
154
154
  worker_config.upsert(
155
155
  network: network,
156
+ image_id: image_id,
157
+ instance_type: instance_type,
156
158
  keypair: keypair,
157
- option_settings: option_settings,
158
- options_to_remove: options_to_remove,
159
159
  iam: iam,
160
160
  )
161
161
  worker_environment = worker_config.environment
@@ -175,6 +175,8 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
175
175
 
176
176
  attr_reader(
177
177
  :application,
178
+ :image_id,
179
+ :instance_type,
178
180
  :internal,
179
181
  :keypair,
180
182
  :network,
@@ -184,66 +186,6 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
184
186
  :iam,
185
187
  :ui,
186
188
  )
187
-
188
- # Coerces +@option_setting_strings+ into object format.
189
- def option_settings
190
- @option_settings ||= @option_setting_strings.map { |option_setting_string|
191
- setting, value = option_setting_string.split('=', 2)
192
- if !setting || setting.empty? || !value || value.empty?
193
- raise InvalidOptionSettingFormatError
194
- end
195
- namespace, option_name = setting.split('/', 2)
196
- if !namespace || namespace.empty? || !option_name || option_name.empty?
197
- raise InvalidOptionSettingFormatError
198
- end
199
- {namespace: namespace, option_name: option_name, value: value}
200
- }
201
- end
202
-
203
- # Coerces +@option_strings_to_remove+ into object format.
204
- def options_to_remove
205
- @options_to_remove ||= @option_strings_to_remove.map { |option_setting_string|
206
- namespace, option_name = option_setting_string.split('/', 2)
207
- if !namespace || namespace.empty? || !option_name || option_name.empty? || option_name.include?('=')
208
- raise InvalidOptionSettingFormatError
209
- end
210
- {namespace: namespace, option_name: option_name}
211
- }
212
- end
213
-
214
- # :nodoc: all
215
- # @!visibility private
216
- class InvalidOptionSettingFormatError < ElasticBeans::Error
217
- def message
218
- require "elastic_beans/cli"
219
- require "elastic_beans/cli/string_shell"
220
- <<-MESSAGE
221
- Invalid format for --option-settings.
222
- Option settings should in the format 'NAMESPACE/OPTION_NAME=VALUE', e.g. 'aws:autoscaling:asg/Cooldown=180'.
223
- If you'd like to *remove* option settings, use --option-settings-to-remove 'NAMESPACE/OPTION_NAME'.
224
- Please re-run `#{command_as_string "configure"}` with updated syntax.
225
-
226
- #{command_help "configure"}
227
- MESSAGE
228
- end
229
- end
230
-
231
- # :nodoc: all
232
- # @!visibility private
233
- class InvalidOptionSettingsToRemoveFormatError < ElasticBeans::Error
234
- def message
235
- require "elastic_beans/cli"
236
- require "elastic_beans/cli/string_shell"
237
- <<-MESSAGE
238
- Invalid format for --option-settings-to-remove.
239
- Option settings to remove should in the format 'NAMESPACE/OPTION_NAME', e.g. 'aws:autoscaling:asg/Cooldown'.
240
- If you'd like to *set* option settings, use --option-settings 'NAMESPACE/OPTION_NAME=VALUE'.
241
- Please re-run `#{command_as_string "configure"}` with updated syntax.
242
-
243
- #{command_help "configure"}
244
- MESSAGE
245
- end
246
- end
247
189
  end
248
190
  end
249
191
  end
@@ -90,7 +90,8 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
90
90
  def message
91
91
  "Missing value for key '#{@key}'. " \
92
92
  "Should it be part of the previous value? " \
93
- "You may need to quote the key/value pair (e.g. 'MYVAR=myvalue, myvalue2') or escape a space (e.g. 'MYVAR=myvalue,\\ myvalue2')."
93
+ "You may need to quote the key/value pair (e.g. `#{command_as_string("setenv 'MYVAR=myvalue, myvalue2'")}`) " \
94
+ "or escape a space (e.g. `#{command_as_string("setenv MYVAR=myvalue,\\ myvalue2")}`)."
94
95
  end
95
96
  end
96
97
  end
@@ -12,9 +12,6 @@ module ElasticBeans
12
12
  class ConfigurationTemplate
13
13
  # The solution stack used for a new application. Should not be hardcoded, but here we are.
14
14
  SOLUTION_STACK_NAME = "64bit Amazon Linux 2016.09 v2.2.0 running Ruby 2.3 (Puma)"
15
- # The source configuration for new configuration templates.
16
- # Set to ElasticBeans::ConfigurationTemplate::Base to include all custom configuration that has already been performed.
17
- SOURCE_CONFIGURATION = {template_name: "base"}
18
15
  # :category: Internal
19
16
  WORKER_TEMPLATE_NAME_PATTERN = /\Aworker-(?<queue>\w+)\z/
20
17
 
@@ -123,7 +120,6 @@ module ElasticBeans
123
120
  application_name: application.name,
124
121
  template_name: name,
125
122
  solution_stack_name: SOLUTION_STACK_NAME,
126
- source_configuration: source_configuration,
127
123
  option_settings: option_settings,
128
124
  )
129
125
  end
@@ -139,17 +135,12 @@ module ElasticBeans
139
135
  # :category: Internal
140
136
  attr_reader :elastic_beanstalk
141
137
 
142
- # Returns option settings that should be set on the template.
143
- def build_option_settings(option_settings: [], **_)
144
- option_settings
138
+ def build_option_settings(**_)
139
+ []
145
140
  end
146
141
 
147
- # Returns option settings that should be removed from the template.
148
- # Will not remove settings that beans has defaults for, even if they aren't being changed right now.
149
- def build_options_to_remove(options_to_remove: [], **_)
150
- options_to_remove.reject { |setting|
151
- option_settings.any? { |new_setting| new_setting[:namespace] == setting[:namespace] && new_setting[:option_name] == setting[:option_name] }
152
- }
142
+ def build_options_to_remove(**_)
143
+ []
153
144
  end
154
145
 
155
146
  def configuration_settings_description(template_name = name)
@@ -190,10 +181,6 @@ module ElasticBeans
190
181
  retry
191
182
  end
192
183
 
193
- def source_configuration
194
- SOURCE_CONFIGURATION
195
- end
196
-
197
184
  def template_option_setting(
198
185
  template: configuration_settings_description,
199
186
  environment: environment_configuration_settings_description,
@@ -201,21 +188,13 @@ module ElasticBeans
201
188
  option_name:,
202
189
  default: nil,
203
190
  override: nil,
204
- allow_blank: true,
205
- new_settings:
191
+ allow_blank: true
206
192
  )
207
193
  option_setting = {namespace: namespace, option_name: option_name, value: default}
208
194
  if override
209
195
  return option_setting.merge!(value: override)
210
196
  end
211
197
 
212
- new_setting = new_settings.find { |setting|
213
- setting[:namespace] == namespace && setting[:option_name] == option_name
214
- }
215
- if new_setting
216
- return new_setting
217
- end
218
-
219
198
  existing_settings = []
220
199
  if environment
221
200
  # Persist changes made directly to the environment from the AWS console UI
@@ -18,19 +18,20 @@ module ElasticBeans
18
18
  network: nil,
19
19
  keypair: nil,
20
20
  iam: nil,
21
+ image_id: nil,
22
+ instance_type: nil,
21
23
  min_size: nil,
22
24
  max_size: nil,
23
- option_settings: [],
24
25
  **_
25
26
  )
26
27
  template = configuration_settings_description("base")
27
28
 
28
- instance_profile_setting = template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "IamInstanceProfile", override: instance_profile(iam), new_settings: option_settings)
29
+ instance_profile_setting = template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "IamInstanceProfile", override: instance_profile(iam))
29
30
  if instance_profile_setting[:value].nil?
30
31
  raise MissingInstanceProfileError
31
32
  end
32
33
 
33
- keypair_setting = template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "EC2KeyName", override: keypair, new_settings: option_settings)
34
+ keypair_setting = template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "EC2KeyName", override: keypair)
34
35
  if keypair_setting[:value].nil?
35
36
  raise MissingOptionsError.new(
36
37
  keypair: keypair_setting[:value],
@@ -38,31 +39,32 @@ module ElasticBeans
38
39
  end
39
40
 
40
41
  config_path = "#{application.bucket_name}/#{application.env_vars.s3_key}"
41
- super + [
42
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "BatchSize", default: "1", new_settings: option_settings),
43
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "BatchSizeType", default: "Fixed", new_settings: option_settings),
44
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "DeploymentPolicy", default: "Rolling", new_settings: option_settings),
45
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", default: "true", new_settings: option_settings),
46
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "ELASTIC_BEANS_ENV_VARS", default: config_path, new_settings: option_settings),
47
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:environment", option_name: "ServiceRole", default: "aws-elasticbeanstalk-service-role", new_settings: option_settings),
48
- template_option_setting(template: template, namespace: "aws:elasticbeanstalk:healthreporting:system", option_name: "SystemType", default: "enhanced", new_settings: option_settings),
49
- template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "AssociatePublicIpAddress", default: "false", new_settings: option_settings),
50
- template_option_setting(template: template, namespace: "aws:autoscaling:asg", option_name: "MinSize", default: "1", override: min_size, new_settings: option_settings),
51
- template_option_setting(template: template, namespace: "aws:autoscaling:asg", option_name: "MaxSize", default: "4", override: max_size, new_settings: option_settings),
52
- template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "SSHSourceRestriction", default: "tcp, 22, 22, 0.0.0.0/32", new_settings: option_settings),
53
- template_option_setting(template: template, namespace: "aws:autoscaling:updatepolicy:rollingupdate", option_name: "RollingUpdateType", default: "Health", new_settings: option_settings),
54
- template_option_setting(template: template, namespace: "aws:autoscaling:updatepolicy:rollingupdate", option_name: "RollingUpdateEnabled", default: "true", new_settings: option_settings),
55
- template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "SecurityGroups", override: security_groups(network), new_settings: option_settings),
56
- template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "ELBSubnets", override: elb_subnets(network), new_settings: option_settings),
57
- template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "Subnets", override: subnets(network), new_settings: option_settings),
58
- template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "VPCId", override: vpc_id(network), new_settings: option_settings),
42
+ settings = [
43
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "BatchSize", default: "1"),
44
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "BatchSizeType", default: "Fixed"),
45
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "DeploymentPolicy", default: "Rolling"),
46
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", default: "true"),
47
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "ELASTIC_BEANS_ENV_VARS", default: config_path),
48
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:environment", option_name: "ServiceRole", default: "aws-elasticbeanstalk-service-role"),
49
+ template_option_setting(template: template, namespace: "aws:elasticbeanstalk:healthreporting:system", option_name: "SystemType", default: "enhanced"),
50
+ template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "AssociatePublicIpAddress", default: "false"),
51
+ template_option_setting(template: template, namespace: "aws:autoscaling:asg", option_name: "MinSize", default: "1", override: min_size),
52
+ template_option_setting(template: template, namespace: "aws:autoscaling:asg", option_name: "MaxSize", default: "4", override: max_size),
53
+ template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "InstanceType", default: "c4.large", override: instance_type),
54
+ template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "SSHSourceRestriction", default: "tcp, 22, 22, 0.0.0.0/32"),
55
+ template_option_setting(template: template, namespace: "aws:autoscaling:updatepolicy:rollingupdate", option_name: "RollingUpdateType", default: "Health"),
56
+ template_option_setting(template: template, namespace: "aws:autoscaling:updatepolicy:rollingupdate", option_name: "RollingUpdateEnabled", default: "true"),
57
+ template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "SecurityGroups", override: security_groups(network)),
58
+ template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "ELBSubnets", override: elb_subnets(network)),
59
+ template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "Subnets", override: subnets(network)),
60
+ template_option_setting(template: template, namespace: "aws:ec2:vpc", option_name: "VPCId", override: vpc_id(network)),
59
61
  instance_profile_setting,
60
62
  keypair_setting,
61
63
  ]
62
- end
63
-
64
- def source_configuration
65
- nil
64
+ if image_id
65
+ settings << template_option_setting(template: template, namespace: "aws:autoscaling:launchconfiguration", option_name: "ImageId", override: image_id)
66
+ end
67
+ settings
66
68
  end
67
69
 
68
70
  private
@@ -12,18 +12,14 @@ module ElasticBeans
12
12
  protected
13
13
 
14
14
  # Constructs the configuration for the exec environment.
15
- def build_option_settings(option_settings: [], **_)
15
+ def build_option_settings(**_)
16
16
  super + [
17
- template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/", new_settings: option_settings),
18
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", override: "false", new_settings: option_settings),
19
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "ELASTIC_BEANS_EXEC_QUEUE_URL", override: application.exec_queue_url, new_settings: option_settings),
20
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true", new_settings: option_settings),
17
+ template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/"),
18
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", override: "false"),
19
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "ELASTIC_BEANS_EXEC_QUEUE_URL", override: application.exec_queue_url),
20
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true"),
21
21
  ]
22
22
  end
23
-
24
- def source_configuration
25
- SOURCE_CONFIGURATION
26
- end
27
23
  end
28
24
  end
29
25
  end
@@ -11,17 +11,13 @@ module ElasticBeans
11
11
 
12
12
  # Constructs the configuration for the scheduler environment.
13
13
  # No special options here!
14
- def build_option_settings(option_settings: [], **_)
14
+ def build_option_settings(**_)
15
15
  super + [
16
- template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/", new_settings: option_settings),
17
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", override: "false", new_settings: option_settings),
18
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true", new_settings: option_settings),
16
+ template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/"),
17
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", override: "false"),
18
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true"),
19
19
  ]
20
20
  end
21
-
22
- def source_configuration
23
- SOURCE_CONFIGURATION
24
- end
25
21
  end
26
22
  end
27
23
  end
@@ -13,35 +13,35 @@ 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, internal: nil, option_settings: [], **_)
17
- public_key_policy_names_setting = template_option_setting(namespace: "aws:elb:policies:backendencryption", option_name: "PublicKeyPolicyNames", default: "backendkey", new_settings: option_settings)
18
- public_key_setting = template_option_setting(namespace: "aws:elb:policies:#{public_key_policy_names_setting[:value]}", option_name: "PublicKey", override: public_key, new_settings: option_settings)
19
- ssl_certificate_setting = template_option_setting(namespace: "aws:elb:listener:443", option_name: "SSLCertificateId", override: ssl_certificate_arn, new_settings: option_settings)
16
+ def build_option_settings(network: nil, public_key: nil, ssl_certificate_arn: nil, internal: nil, **_)
17
+ public_key_policy_names_setting = template_option_setting(namespace: "aws:elb:policies:backendencryption", option_name: "PublicKeyPolicyNames", default: "backendkey")
18
+ public_key_setting = template_option_setting(namespace: "aws:elb:policies:#{public_key_policy_names_setting[:value]}", option_name: "PublicKey", override: public_key)
19
+ ssl_certificate_setting = template_option_setting(namespace: "aws:elb:listener:443", option_name: "SSLCertificateId", override: ssl_certificate_arn)
20
20
  if public_key_setting[:value].nil? || ssl_certificate_setting[:value].nil?
21
21
  raise NoEncryptionSettingsError
22
22
  end
23
23
 
24
- settings = [
25
- template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTPS:443/", allow_blank: false, new_settings: option_settings),
26
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_ASSET_COMPILATION", default: "false", new_settings: option_settings),
27
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "false", new_settings: option_settings),
28
- template_option_setting(namespace: "aws:elb:listener:443", option_name: "InstancePort", default: "443", new_settings: option_settings),
29
- template_option_setting(namespace: "aws:elb:listener:443", option_name: "InstanceProtocol", default: "HTTPS", new_settings: option_settings),
30
- template_option_setting(namespace: "aws:elb:listener:443", option_name: "ListenerProtocol", default: "HTTPS", new_settings: option_settings),
31
- template_option_setting(namespace: "aws:elb:loadbalancer", option_name: "ManagedSecurityGroup", override: managed_security_group(network), new_settings: option_settings),
32
- template_option_setting(namespace: "aws:elb:loadbalancer", option_name: "SecurityGroups", override: elb_security_groups(network), new_settings: option_settings),
33
- template_option_setting(namespace: "aws:elb:policies", option_name: "ConnectionDrainingEnabled", default: "true", new_settings: option_settings),
34
- template_option_setting(namespace: "aws:elb:policies:backendencryption", option_name: "InstancePorts", default: "443", new_settings: option_settings),
24
+ option_settings = [
25
+ template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTPS:443/", allow_blank: false),
26
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_ASSET_COMPILATION", default: "false"),
27
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "false"),
28
+ template_option_setting(namespace: "aws:elb:listener:443", option_name: "InstancePort", default: "443"),
29
+ template_option_setting(namespace: "aws:elb:listener:443", option_name: "InstanceProtocol", default: "HTTPS"),
30
+ template_option_setting(namespace: "aws:elb:listener:443", option_name: "ListenerProtocol", default: "HTTPS"),
31
+ template_option_setting(namespace: "aws:elb:loadbalancer", option_name: "ManagedSecurityGroup", override: managed_security_group(network)),
32
+ template_option_setting(namespace: "aws:elb:loadbalancer", option_name: "SecurityGroups", override: elb_security_groups(network)),
33
+ template_option_setting(namespace: "aws:elb:policies", option_name: "ConnectionDrainingEnabled", default: "true"),
34
+ template_option_setting(namespace: "aws:elb:policies:backendencryption", option_name: "InstancePorts", default: "443"),
35
35
  public_key_policy_names_setting,
36
36
  public_key_setting,
37
37
  ssl_certificate_setting,
38
38
  ]
39
39
  if internal
40
- internal_setting = template_option_setting(namespace: "aws:ec2:vpc", option_name: "ELBScheme", override: "internal", new_settings: option_settings)
41
- settings << internal_setting
40
+ internal_setting = template_option_setting(namespace: "aws:ec2:vpc", option_name: "ELBScheme", override: "internal")
41
+ option_settings << internal_setting
42
42
  end
43
43
 
44
- super + settings
44
+ super + option_settings
45
45
  end
46
46
 
47
47
  # Removes the "internal" ELB scheme if explicitly disabled with --no-internal.
@@ -64,10 +64,6 @@ module ElasticBeans
64
64
  network.elb_security_groups[0] if network
65
65
  end
66
66
 
67
- def source_configuration
68
- SOURCE_CONFIGURATION
69
- end
70
-
71
67
  # :nodoc: all
72
68
  # @!visibility private
73
69
  class NoEncryptionSettingsError < ElasticBeans::Error
@@ -24,21 +24,17 @@ module ElasticBeans
24
24
  # Constructs the configuration for the worker environments.
25
25
  # No special arguments, the +queue+ name is stored from the initializer and is used to look up the appropriate
26
26
  # URL.
27
- def build_option_settings(option_settings: [], **_)
27
+ def build_option_settings(**_)
28
28
  super + [
29
- template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/", new_settings: option_settings),
30
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", override: "false", new_settings: option_settings),
31
- template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true", new_settings: option_settings),
32
- template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "InactivityTimeout", default: "1800", new_settings: option_settings),
33
- template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "MaxRetries", default: "10", new_settings: option_settings),
34
- template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "VisibilityTimeout", default: "1800", new_settings: option_settings),
35
- template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "WorkerQueueURL", override: application.worker_queue_url(queue), new_settings: option_settings),
29
+ template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/"),
30
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "DISABLE_SQS_CONSUMER", override: "false"),
31
+ template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true"),
32
+ template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "InactivityTimeout", default: "1800"),
33
+ template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "MaxRetries", default: "10"),
34
+ template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "VisibilityTimeout", default: "1800"),
35
+ template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "WorkerQueueURL", override: application.worker_queue_url(queue)),
36
36
  ]
37
37
  end
38
-
39
- def source_configuration
40
- SOURCE_CONFIGURATION
41
- end
42
38
  end
43
39
  end
44
40
  end
@@ -1,3 +1,3 @@
1
1
  module ElasticBeans
2
- VERSION = "0.13.0.alpha1"
2
+ VERSION = "0.13.0.alpha2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_beans
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0.alpha1
4
+ version: 0.13.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Stegman