kumo_keisei 5.0.0 → 5.1.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: 98d31fb2d5e7dea5e297475a4580f02038ec74ce
4
- data.tar.gz: f5d7e8d9ab455adab43ae717ebbd4343056b4db6
3
+ metadata.gz: 7cd6cb846e9cbaad89a734ed34dd90123fc0c4b5
4
+ data.tar.gz: f3f9617c67b0d4161ccb7c80c1bab2a7e5d093fc
5
5
  SHA512:
6
- metadata.gz: 288aedeb13b80df6a1728c5729ca9cefc02524b8507ece03669fd6e2115eb113e3d1ab3c168e775cd35164aae03e0240ec75f0efb5112a1807f0f2ecc311f03c
7
- data.tar.gz: 89848dab939d87145bce5f9cae4997752edc57ff954338cba24faa2922b6f90a876745c2da50da1b3399eca29319f04a577f511d9c7a078fbf41d7e1ea9eecbb
6
+ metadata.gz: c759fbfdf680d1116d917704570013ba0b5480be4fc721c8a3d0dae82bba19a26b8fcc8cef6ad344c1e3c764a69356b7ee06dc538de04b220e3ea7ff125f8a2c
7
+ data.tar.gz: aef536766cff0008bd1141bae4b798905387f7b76ec4810680cdcc1d452157edd278f511cf7d80e01949f27fd80c405be3585fc65025d6682c20640f76b9d0bf
data/README.md CHANGED
@@ -4,8 +4,6 @@ A collection of utilities wrapping the libraries for dealing with AWS Cloud Form
4
4
 
5
5
  ## Installation
6
6
 
7
- This gem is automatically installed in the rbdevtools container, so any `apply-env` or `deploy` scripts have access to it.
8
-
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
@@ -24,7 +22,7 @@ Or install it yourself as:
24
22
 
25
23
  ### Basic Usage
26
24
 
27
- The basic usage will give you a CloudFormation stack named `{application}-{environment}`. The default type is `nodes`
25
+ The basic usage will give you a CloudFormation stack named `{application}-{environment}`.
28
26
 
29
27
  ```ruby
30
28
  application_name = "myapp"
@@ -41,11 +39,7 @@ my_stack.apply! stack_config
41
39
 
42
40
  ### Stack Naming
43
41
 
44
- We are using APPNAME-ENVNAME (e.g `redbubble-staging`) as our naming convention. There are some legacy stacks in AWS which have the old naming convention which is APPNAME-TYPE-ENVNAME (e.g `redbubble-nodes-staging`). If you want to ensure that you keep your existing stack (so you don't accidently build an extra stack):
45
-
46
- 0. Login into the AWS console and find out what your stack is named.
47
- 0. Update your app name (see Basic Usage above) in the apply-env script to match your existing stack name's app name part (which is everything before the environment name, e.g `redbubble-nodes` in `redbubble-nodes-staging`)
48
-
42
+ We are using APPNAME-ENVNAME (e.g `redbubble-staging`) as our naming convention for cloudformation stacks.
49
43
 
50
44
  ### Timeouts
51
45
 
@@ -96,93 +90,31 @@ stack_config = {
96
90
  stack.apply!(stack_config)
97
91
  ```
98
92
 
99
- ### Getting the configuration and secrets without an `apply!`
100
-
101
- If you need to inspect the configuration without applying a stack, call `config`:
102
- ```ruby
103
- stack_config = {
104
- config_path: File.join('/app', 'env', 'config'),
105
- template_path: File.join('/app', 'env', 'cloudformation', 'myapp.json'),
106
- injected_config: {
107
- 'Seed' => random_seed,
108
- }
109
- }
110
- marshalled_config = stack.config(stack_config)
111
- marshalled_secrets = stack.plain_text_secrets(stack_config)
112
-
113
- if marshalled_config['DB_HOST'].start_with? '192.' then
114
- passwd = marshalled_secrets['DB_PASS']
115
- ...
116
- end
117
- ```
118
-
119
93
  ## Upgrading from `KumoKeisei::CloudFormationStack` to `KumoKeisei::Stack`
120
94
 
121
- `KumoKeisei::CloudFormationStack` is deprecated and should be replaced with a `KumoKeisei::Stack` which encompasses an environment object (`KumoConfig::EnvironmentConfig`).
95
+ `KumoKeisei::CloudFormationStack` is deprecated and should be replaced with a `KumoKeisei::Stack` which has an environment object (`KumoConfig::EnvironmentConfig`).
122
96
 
123
- Previously you would have to construct your own `EnvironmentConfig` which would marshal its configuration, then instantiate a `CloudFormationStack` and conduct operations on it.
97
+ Previously you would pass through cloudformation template and json parameter files directly.
124
98
 
125
- E.g. `apply-env`:
99
+ E.g.:
126
100
  ```ruby
127
- require_relative '../env/cloudformation_stack'
128
-
129
- environment_name = ARGV.fetch(0) rescue raise("Error! No environment name given!")
130
-
131
- stack = CloudFormationStack.new(environment_name)
132
- stack.apply
133
- ```
134
- and `cloudformation_stack.rb`:
135
- ```ruby
136
- require 'kumo_keisei'
137
-
138
- class CloudFormationStack
139
-
140
- APP_NAME = "fooapp"
141
-
142
- attr_reader :env_name
143
-
144
- def initialize(env_name)
145
- @stacks = {}
146
- @env_name = env_name
147
- end
148
-
149
- def env_vars
150
- {}
151
- end
152
-
153
- def apply
154
- # Inject the VPC and Subnets into the application's environment config
155
- foo_config = KumoKeisei::EnvironmentConfig.new(
156
- env_name: env_name,
157
- config_dir_path: File.expand_path(File.join("..", "..", "env", "config"), __FILE__)
158
- )
159
-
160
- foo_stack = create_stack(:foo, foo_config)
161
- foo_stack.apply!
162
- end
163
- ...
164
- def create_stack(stack_name, environment_config)
165
- raise "Stack '#{ stack_name }' already exists!" if @stacks[stack_name]
166
- params_template_erb = params_template(stack_name)
167
- stack_values = cf_params_json(get_stack_params(params_template_erb, environment_config))
168
- write_stack_params_file(stack_values, stack_name)
169
- @stacks[stack_name] = KumoKeisei::CloudFormationStack.new(stack_names[stack_name], "./env/cloudformation/#{stack_name}.json", stack_file_params_file_path(stack_name))
170
- end
171
- ...
101
+ app_name = "foo"
102
+ environment_name = "staging"
103
+ stack = KumoKeisei::CloudFormationStack.new("#{app_name}-#{environment_name}", "./cloudformation/#{app_name}.json", "./cloudformation/#{environment_name}.json")
104
+ stack.apply!
172
105
  ```
173
106
 
174
- With the new `Stack` object, all you need to do is pass in the location of the template and config as in the above section. New `apply-env`:
107
+ With the new `Stack` object, you need to pass in the location of the template and config:
175
108
  ```ruby
176
- require 'kumo_keisei'
177
-
178
- environment_name = ARGV.fetch(0) rescue raise("Error! No environment name given!")
109
+ app_name = "foo"
110
+ environment_name = "staging"
179
111
 
180
112
  stack_config = {
181
113
  config_path: File.join('/app', 'env', 'config'),
182
- template_path: File.join('/app', 'env', 'cloudformation', 'fooapp.json'),
114
+ template_path: File.join('/app', 'env', 'cloudformation', '#{app_name}.json'),
183
115
  }
184
116
 
185
- stack = KumoKeisei::Stack.new('fooapp', environment_name)
117
+ stack = KumoKeisei::Stack.new(app_name, environment_name)
186
118
  stack.apply!(stack_config)
187
119
  ```
188
120
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.0
1
+ 5.1.0
@@ -115,8 +115,6 @@ module KumoKeisei
115
115
  end
116
116
 
117
117
  def create!(dynamic_params)
118
- raise StackValidationError.new("The stack name needs to be 32 characters or shorter") if @stack_name.length > 32
119
-
120
118
  cloudformation_params = ParameterBuilder.new(dynamic_params, @stack_params_filepath).params
121
119
  cloudformation.create_stack(
122
120
  stack_name: @stack_name,
@@ -152,7 +152,6 @@ module KumoKeisei
152
152
  end
153
153
 
154
154
  def create!(stack_config)
155
- raise StackValidationError.new("The stack name needs to be 32 characters or shorter") if @stack_name.length > 32
156
155
 
157
156
  cloudformation.create_stack(
158
157
  stack_name: @stack_name,
@@ -195,18 +195,6 @@ describe KumoKeisei::CloudFormationStack do
195
195
 
196
196
  subject.apply!
197
197
  end
198
-
199
- context "a stack name that is too long" do
200
- let(:stack_name) { "long-stack-name-that-will-make-aws-barf" }
201
-
202
- it "blows up since the ELB names have to be 32 or shorter" do
203
- allow(cloudformation).to receive(:wait_until).with(:stack_update_complete, stack_name: stack_name)
204
- allow(cloudformation).to receive(:update_stack)
205
- allow(subject).to receive(:updatable?).and_return(false)
206
-
207
- expect { subject.apply! }.to raise_error(KumoKeisei::StackValidationError, "The stack name needs to be 32 characters or shorter")
208
- end
209
- end
210
198
  end
211
199
 
212
200
  describe "#outputs" do
@@ -232,17 +232,6 @@ describe KumoKeisei::Stack do
232
232
  subject.apply!(stack_config)
233
233
  end
234
234
 
235
- context "a stack name that is too long" do
236
- let(:app_name) { "this-will-create-a-very-long-stack-name-that-will-break-aws" }
237
-
238
- it "blows up since the ELB names have to be 32 or shorter" do
239
- allow(cloudformation).to receive(:wait_until).with(:stack_update_complete, stack_name: stack_name)
240
- allow(cloudformation).to receive(:update_stack)
241
- allow(subject).to receive(:updatable?).and_return(false)
242
-
243
- expect { subject.apply!(stack_config) }.to raise_error(KumoKeisei::StackValidationError, "The stack name needs to be 32 characters or shorter")
244
- end
245
- end
246
235
  end
247
236
 
248
237
  describe "#outputs" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumo_keisei
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Redbubble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk