bbc-cosmos-tools 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -50
- data/lib/bbc/cosmos/tools/types/base_type.rb +4 -2
- data/lib/bbc/cosmos/tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7db221b6b93010b239a0c32fb906e97eb165cdb0
|
4
|
+
data.tar.gz: 8aa274b2211987d1d2070e666eb6955c3e889239
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d85f66bff947dc33d40b6c117b82af8b330808255214f2783b65920d0c74c20d4ec8bbb4c8ae390b5f1bf720903d97b5d4311afbca812b21f0248accbd2bd34
|
7
|
+
data.tar.gz: a855c71c806fe1662700ac3d8f2cae877f7006cc10db62096208b51c70bc0e4d38b2815de5a602a4c8b2ddca387461f19b9d15f87d3041494ad3398f8426b0cd
|
data/README.md
CHANGED
@@ -13,10 +13,11 @@ The [BBC Cosmos Tool](https://github.com/BBC-News/bbc-cosmos-tools) is a Ruby ge
|
|
13
13
|
The gem supports the following features:
|
14
14
|
|
15
15
|
- Pushing component config to the cosmos API
|
16
|
-
-
|
17
|
-
-
|
16
|
+
- Create/update and delete stacks for a component in cosmos
|
17
|
+
- Do release and snapshot deployments to any environment
|
18
|
+
- List instances running for a component and filter by tag
|
18
19
|
|
19
|
-
The gem
|
20
|
+
The gem supports the following formats:
|
20
21
|
|
21
22
|
- [CFNDSL](https://github.com/stevenjack/cfndsl)
|
22
23
|
- YAML
|
@@ -82,7 +83,7 @@ But be aware you can have multiple "stacks" for a component (it's just a structu
|
|
82
83
|
This could be (for example) a Scaling Group, IAM policy, SQS, or DynamoDB (any AWS service)
|
83
84
|
|
84
85
|
- `{type}`
|
85
|
-
This is a
|
86
|
+
This is a subsection of the resource
|
86
87
|
e.g. if the resource was `AWS::SQS::Queue` then this file would be named `queue.rb`
|
87
88
|
|
88
89
|
> Note: if you're using the YAML or JSON formats then the following structure is used (notice it's *almost* identical)
|
@@ -157,11 +158,12 @@ bbc:
|
|
157
158
|
stack_events: '/cosmos/env/%s/component/%s/stack/%s/events'
|
158
159
|
stacks: '/cosmos/env/%s/component/%s/stacks'
|
159
160
|
stack_delete: '/cosmos/env/%s/component/%s/stack/%s/delete'
|
161
|
+
stack_details: '/cosmos/env/%s/component/%s/stack/%s'
|
160
162
|
```
|
161
163
|
|
162
164
|
Where as the contents of `{component}.yaml.erb` can look like the following:
|
163
165
|
|
164
|
-
```
|
166
|
+
```yaml
|
165
167
|
components:
|
166
168
|
'{component}':
|
167
169
|
s3_bucket_id: "foo"
|
@@ -170,7 +172,7 @@ components:
|
|
170
172
|
|
171
173
|
In YAML you can get fancy and make certain properties more re-usable by using `&` to create an "anchor" which you can then reference with `*`, along with `<<:` to inject content. See the following file for an example (although it’s not a very good example as there would be no need to use any of those features for such a small file, but hopefully it gives you an idea on how they are used)…
|
172
174
|
|
173
|
-
```
|
175
|
+
```yaml
|
174
176
|
base: &shared
|
175
177
|
s3_bucket_id: "foo"
|
176
178
|
s3_object_path: "bar"
|
@@ -202,7 +204,7 @@ base: &shared
|
|
202
204
|
components:
|
203
205
|
'test_component':
|
204
206
|
<<: *shared
|
205
|
-
|
207
|
+
some_specific_value: 'foo, bar'
|
206
208
|
```
|
207
209
|
|
208
210
|
The config has a number of components under a project, and the shared key allows you to
|
@@ -218,8 +220,8 @@ is only the API endpoints.
|
|
218
220
|
bbc:
|
219
221
|
cosmos:
|
220
222
|
api: "https://www.my.api.com"
|
221
|
-
|
222
|
-
|
223
|
+
create_endpoint: "/some/restful/endpoint"
|
224
|
+
update_endpoint: "/some/restful/endpoint"
|
223
225
|
```
|
224
226
|
|
225
227
|
### Resources
|
@@ -251,7 +253,7 @@ cloudformation:
|
|
251
253
|
|
252
254
|
The project resources yaml file is used to describe the resources used within the project. The reason for having a single file is that you can define resources that are used in the cloudformation templates and config, so when for example an ARN changes this will be picked up across the CF templates and the config.
|
253
255
|
|
254
|
-
The file is
|
256
|
+
The file is split up into two section:
|
255
257
|
|
256
258
|
* The standard resource list, this is generally the ARNS for all the resources your component uses.
|
257
259
|
* Cloudformation parameters (These are usually referenced from the aforementioned)
|
@@ -261,30 +263,29 @@ Below is an annotated example of a resource config:
|
|
261
263
|
```yaml
|
262
264
|
|
263
265
|
sequencer:
|
264
|
-
|
265
|
-
|
266
|
+
name: 'example_name'
|
267
|
+
arn: 'example_arn'
|
266
268
|
|
267
269
|
roles:
|
268
|
-
|
269
|
-
|
270
|
+
broker:
|
271
|
+
name: &roles_broker_name 'some_iam_role_name'
|
270
272
|
|
271
273
|
cloudformation:
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
274
|
+
shared: &component_shared #<- This node is ignored, it's used as a base for other config templates
|
275
|
+
ACFParameter: 'Value'
|
276
|
+
AnotherCFParameter: 'Another value'
|
277
|
+
|
278
|
+
components:
|
279
|
+
'my-example-component': #<- The name of the component in cosmos
|
280
|
+
main: <- This is the name of the stack in cosmos
|
281
|
+
variants: <- This is so you can have a different variant of the same config, i.e for int/test one for during the day and one for evening/weekends.
|
282
|
+
default: &my-example-component_default #<- We set this anchor so we can use this defaults in other variants
|
283
|
+
<<: *component_shared #<- We import the shared component params into these so we're not duplicating
|
284
|
+
ARoleParamForDefault: *roles_broker_name #<- We use the anchor for the roles set above to add them here, again stopping repetition
|
285
|
+
scheduled:
|
286
|
+
<<: *my-example-component_default
|
287
|
+
MinSize: 0
|
288
|
+
MaxSize: 0
|
288
289
|
```
|
289
290
|
|
290
291
|
### Stacks
|
@@ -364,26 +365,6 @@ There are a few example projects using this tool now:
|
|
364
365
|
|
365
366
|
> The reason some of the projects choose to locate their configuration in a separate repo is because they're made up of a number of different components.
|
366
367
|
|
367
|
-
## API reference
|
368
|
-
|
369
|
-
The gem is a cli application, and so the commands are self documenting; but below is a list of the commands for each set of sub commands
|
370
|
-
|
371
|
-
### Cosmos Config
|
372
|
-
|
373
|
-
```bash
|
374
|
-
bbc-cosmos-tools config generate
|
375
|
-
bbc-cosmos-tools config push
|
376
|
-
bbc-cosmos-tools config list
|
377
|
-
```
|
378
|
-
|
379
|
-
### Cloudformation
|
380
|
-
|
381
|
-
```bash
|
382
|
-
bbc-cosmos-tools cf generate
|
383
|
-
bbc-cosmos-tools cf create
|
384
|
-
bbc-cosmos-tools cf update
|
385
|
-
```
|
386
|
-
|
387
368
|
### Help?
|
388
369
|
|
389
370
|
You can use the built-in `help` command to see a list of parameters and options that need to be passed into the command you wish to execute. For example, if we were unsure of the options for the `stack` command then we would execute `bbc-cosmos-tools help stack` and this would display the following output:
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bbc/cosmos/tools/cloudformation/generator"
|
2
|
+
require "json"
|
2
3
|
|
3
4
|
module BBC
|
4
5
|
module Cosmos
|
@@ -11,12 +12,12 @@ module BBC
|
|
11
12
|
@config = config
|
12
13
|
end
|
13
14
|
|
14
|
-
def generate_data
|
15
|
+
def generate_data(to_json = false)
|
15
16
|
if valid_component_and_stack
|
16
17
|
get_parameters.each do |key, value|
|
17
18
|
data['Parameters'][key]['Default'] = value if data['Parameters'][key]
|
18
19
|
end
|
19
|
-
data
|
20
|
+
to_json ? JSON.pretty_generate(data) : data
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -45,3 +46,4 @@ module BBC
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
49
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc-cosmos-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|