admiral-cloudformation 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Admiral for AWS CloudFormation
2
2
 
3
- An Admiral module that implements tasks for wielding AWS CloudFormation templates. Use it to manage CloudFormation templates and their parameters.
3
+ An Admiral module that implements tasks for wielding AWS CloudFormation templates and configuration.
4
+
5
+ For additional modules, see the [Admiral base project](https://github.com/flippyhead/admiral).
6
+
7
+ Developed in Seattle at [Fetching](http://fetching.io).
4
8
 
5
9
  ## Installation
6
10
 
@@ -18,11 +22,11 @@ Or install it yourself as:
18
22
 
19
23
  ## Usage
20
24
 
21
- On your command line type:
25
+ To see a list of available commands, on the command line enter:
22
26
 
23
27
  $ admiral cf help
24
28
 
25
- To see a list of available commands. Make sure your bundle bin is in your PATH.
29
+ Make sure your bundle bin is in your PATH.
26
30
 
27
31
  The following commands are available:
28
32
 
@@ -31,6 +35,7 @@ Commands:
31
35
  admiral cf create # Create new CloudFormation stack for environment.
32
36
  admiral cf destroy # Destroy the existing CloudFormation stack.
33
37
  admiral cf help [COMMAND] # Describe subcommands or one specific subcommand
38
+ admiral cf init TYPE # Create CloudFormation template and configuration files for TYPE. TYPE is one of "mongo", "meteor", or "elasticsearch"
34
39
  admiral cf update # Update the existing CloudFormation stack
35
40
 
36
41
  Options:
@@ -43,17 +48,33 @@ Options:
43
48
 
44
49
  Some commands have additional options you can discover with:
45
50
 
46
- # admiral cf help [COMMAND]
51
+ $ admiral cf help [COMMAND]
52
+
53
+ ## Setup
54
+
55
+ It is recommended that you create a distinct repository for each cluster type. For example you might have: `server-elasticsearch`, `server-mongodb`, and `server-meteor` repositories each which specific cluster configurations.
56
+
57
+ Within each repo simply run the `init` command to get started (see below).
58
+
59
+ ## Easy Setup
47
60
 
48
- # Configuration
61
+ Admiral CloudFormation provides complete CloudFormation templates for some common server configurations. To initialize your project you can use:
49
62
 
50
- Admiral CloudFormation is designed around the concept of deployment environments. You parameterize your CloudFormation templates, then encode specific parameter values in JSON files for each distinct environment.
63
+ $ admiral cf init <type>
64
+
65
+ Where type is one of `mongo`, `elasticsearch` or `meteor`. In the current working directory, this will create a `CloudFormation.template` and `staging.json` and `production.json` files. These are complete configurations using best practices for each server type. You'll need to customize a few things including SSL certificate and security group names.
66
+
67
+ More example templates will be added in the future.
68
+
69
+ ## Configuration
70
+
71
+ Admiral CloudFormation is designed around the concept of the deployment `environment`. You parameterize your CloudFormation templates, then encode specific parameter values in JSON files for each distinct environment.
51
72
 
52
73
  For example you may have CloudFormation templates for your database servers and your web application servers, and distinct configurations for production, staging and test environments.
53
74
 
54
75
  CloudFormation provides a facility to parameterize templates via the [`Parameters`](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html) section. For example:
55
76
 
56
- ```javascript
77
+ ```json
57
78
  ...
58
79
  "InstanceType": {
59
80
  "Description": "The type of instance to launch.",
@@ -63,9 +84,9 @@ CloudFormation provides a facility to parameterize templates via the [`Parameter
63
84
  ...
64
85
  ```
65
86
 
66
- You then specify specific values for each environment. For example:
87
+ You then specify specific values for each environment. For example, in the `production.json` file:
67
88
 
68
- ```javascript
89
+ ```json
69
90
  {
70
91
  "InstanceCount":"2",
71
92
  "InstanceType": "t2.medium",
@@ -84,10 +105,16 @@ Create a stack using the default template (./CloudFormation.template) using a cu
84
105
 
85
106
  $ admiral cf create --params /usr/local/config/custom.json
86
107
 
87
- Update the default stack using the default environment (./production.json):
108
+ Update using the default template (./CloudFormation.template) and the default environment config (./production.json):
88
109
 
89
110
  $ admiral cf update
90
111
 
91
- # CloudFormation Templates
112
+ ## Contributing
113
+
114
+ 1. Fork it
115
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
116
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
117
+ 4. Push to the branch (`git push origin my-new-feature`)
118
+ 5. Create new Pull Request
92
119
 
93
- Example CloudFormation templates for ElasticSearch, Meteor and MongoDB are included in the `examples` directory.
120
+ This project was heavily inspired by [this blog post](http://www.thoughtworks.com/mingle/news/scaling/2015/01/06/How-Mingle-Built-ElasticSearch-Cluster.html) -- thanks ThoughtWorks!
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "admiral-cloudformation"
7
- spec.version = '0.0.3'
7
+ spec.version = '0.0.4'
8
8
  spec.authors = ["Peter T. Brown"]
9
9
  spec.email = ["p@ptb.io"]
10
10
  spec.description = %q{An Admiral module that implements tasks for wielding AWS CloudFormation templates. Use it to manage CloudFormation templates and their parameters.}
@@ -4,13 +4,13 @@
4
4
  "SSLCertificateName": "search.example.io",
5
5
  "SshKeyName": "production",
6
6
  "InstanceCount":"2",
7
- "InstanceType": "t2.medium",
7
+ "InstanceType": "c3.large",
8
8
  "ElasticSearchVersion": "1.4.4",
9
9
  "ElasticSearchAWSCloudPluginVersion": "2.4.1",
10
10
  "SearchUser":"admin",
11
11
  "SearchPassword":"example-password",
12
- "ClusterName": "staging-cluster",
12
+ "ClusterName": "production-cluster",
13
13
  "MinMasterNodes": "1",
14
- "SecurityGroupLoadBalancer": "sg-8aab365ef",
15
- "SecurityGroupSearchLayer": "sg-9e9d35f8"
14
+ "SecurityGroupLoadBalancer": "sg-8aab365abc",
15
+ "SecurityGroupSearchLayer": "sg-9e9d3abc"
16
16
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "Route53ZoneName": "staging.example.io.",
3
+ "SearchDomainName": "search.staging.example.io",
4
+ "SSLCertificateName": "search.staging.example.io",
5
+ "SshKeyName": "staging",
6
+ "InstanceCount":"2",
7
+ "InstanceType": "t2.medium",
8
+ "ElasticSearchVersion": "1.4.4",
9
+ "ElasticSearchAWSCloudPluginVersion": "2.4.1",
10
+ "SearchUser":"admin",
11
+ "SearchPassword":"example-password",
12
+ "ClusterName": "staging-cluster",
13
+ "MinMasterNodes": "1",
14
+ "SecurityGroupLoadBalancer": "sg-8aa123",
15
+ "SecurityGroupSearchLayer": "sg-9e9123"
16
+ }
@@ -69,13 +69,13 @@
69
69
  },
70
70
 
71
71
  "PrimaryAppId": {
72
- "Description": "fetching app id ",
73
- "Value": { "Ref": "FetchingApp"}
72
+ "Description": "primary app id ",
73
+ "Value": { "Ref": "PrimaryApp"}
74
74
  },
75
75
 
76
76
  "SecondaryAppId": {
77
77
  "Description": "exporter app id ",
78
- "Value": { "Ref": "FetchingExporter"}
78
+ "Value": { "Ref": "SecondaryApp"}
79
79
  }
80
80
 
81
81
  },
@@ -213,8 +213,8 @@
213
213
  "Type":"AWS::OpsWorks::App",
214
214
  "Properties": {
215
215
  "Type": "nodejs",
216
- "Name": "Fetching Application",
217
- "Shortname": "fetching-app",
216
+ "Name": "Primary Application",
217
+ "Shortname": "primary-app",
218
218
  "StackId": {
219
219
  "Ref": "MeteorStack"
220
220
  },
@@ -231,8 +231,8 @@
231
231
  "Type":"AWS::OpsWorks::App",
232
232
  "Properties": {
233
233
  "Type": "nodejs",
234
- "Name": "Fetching Exporter",
235
- "Shortname": "fetching-exporter",
234
+ "Name": "Secondary App",
235
+ "Shortname": "secondary-app",
236
236
  "StackId": {
237
237
  "Ref": "MeteorStack"
238
238
  },
@@ -4,7 +4,7 @@
4
4
  "SSLCertificateName": "app.example.io",
5
5
  "SshKeyName": "production",
6
6
  "InstanceCount":"1",
7
- "InstanceType": "t2.small",
7
+ "InstanceType": "c3.large",
8
8
  "SecurityGroupLoadBalancer": "sg-8ad62234ef",
9
9
  "SecurityGroupMeteorLayer": "sg-2265dsd7"
10
10
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "Route53ZoneName": "staging.example.io.",
3
+ "AppDomainName": "app.staging.example.io",
4
+ "SSLCertificateName": "app.staging.example.io",
5
+ "SshKeyName": "staging",
6
+ "InstanceCount":"1",
7
+ "InstanceType": "t2.small",
8
+ "SecurityGroupLoadBalancer": "sg-8ad62234ef",
9
+ "SecurityGroupMeteorLayer": "sg-2265dsd7"
10
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "SshKeyName": "production",
3
3
  "InstanceCount":"1",
4
- "InstanceType": "t2.small",
4
+ "InstanceType": "c3.large",
5
5
  "MongoVersion": "2.6.1",
6
6
  "SecurityGroupMongoLayer": "sg-334rt5fc"
7
7
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "SshKeyName": "staging",
3
+ "InstanceCount":"1",
4
+ "InstanceType": "t2.small",
5
+ "MongoVersion": "2.6.1",
6
+ "SecurityGroupMongoLayer": "sg-334rtxyz"
7
+ }
@@ -9,6 +9,7 @@ module Admiral
9
9
  extend Admiral::Base
10
10
  include Util::CloudFormation
11
11
 
12
+ EXAMPLES = ['elasticsearch', 'meteor', 'mongo']
12
13
  NAME = 'cf'
13
14
  USAGE = 'cf <command> <options>'
14
15
  DESCRIPTION = 'Commands for wielding AWS CloudFormation templates.'
@@ -45,6 +46,16 @@ module Admiral
45
46
  super stack_name options[:environment]
46
47
  end
47
48
 
49
+ desc 'init TYPE', 'Create CloudFormation template and configuration files for TYPE. TYPE is one of "mongo", "meteor", or "elasticsearch"'
50
+
51
+ def init(type)
52
+ raise ArgumentError, "#{type} must be one of #{EXAMPLES.join(',')}" unless EXAMPLES.include?(type)
53
+
54
+ path = File.expand_path("../../../examples/#{type}", __FILE__)
55
+ FileUtils.cp Dir.glob("#{path}/*"), Dir.getwd
56
+ puts "[admiral] #{type} CloudFormation setup initialized."
57
+ end
58
+
48
59
  end
49
60
  end
50
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admiral-cloudformation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-04 00:00:00.000000000 Z
12
+ date: 2015-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -108,10 +108,13 @@ files:
108
108
  - admiral.gemspec
109
109
  - examples/elasticsearch/CloudFormation.template
110
110
  - examples/elasticsearch/production.json
111
+ - examples/elasticsearch/staging.json
111
112
  - examples/meteor/CloudFormation.template
112
113
  - examples/meteor/production.json
114
+ - examples/meteor/staging.json
113
115
  - examples/mongo/CloudFormation.template
114
116
  - examples/mongo/production.json
117
+ - examples/mongo/staging.json
115
118
  - lib/admiral-cloudformation.rb
116
119
  - lib/admiral-cloudformation/tasks.rb
117
120
  - lib/admiral-cloudformation/util.rb