opzworks 0.3.9 → 0.3.10

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: d4f9fc4073191ff39ff98f0e525668ab3cdecccb
4
- data.tar.gz: 130b0426c4087386d0cb8b8fc37c5ab555097f4b
3
+ metadata.gz: 5267c45661f0c2c65ddcf850d56716763009d426
4
+ data.tar.gz: 68d82248bbf8a14ac9b29dabf1de5ad8a4f77b34
5
5
  SHA512:
6
- metadata.gz: 9d2110e5ff2526da66d10b66f7f04ace5bab5cd6d18111d67d6918ab99c314ed7cf7b6b8ff21b8afc474cf29fadb74be72a1d308f8ba65474b9680751225cfa4
7
- data.tar.gz: b87107774be58150423647d3af288cb6548eb6fc744b62a630bdf2370c47b08e65af06f7c87ed632e949b171005c15ec5da05a1adaadc94cd8abc1237668f6bf
6
+ metadata.gz: 860703816532d659d4f981d124f4e6e160f7ca79b134d78b98962921d971ec00de6009100de2ae693b6c2e904b6802267096c88d5c79b39261506cd60e353fab
7
+ data.tar.gz: 92314206dfae0cb6c0c4fe2c3e1c1cb14833297c7db3414ce276446f8a64c6e5a872d05fac60c1948b61ac6798c9bb7974366e05f03bba18bf9c7f41bfb80852
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Adam Lindberg
1
+ Copyright (c) 2016 Grant Heffernan, Mapzen
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -3,6 +3,10 @@
3
3
  Command line interface for managing AWS OpsWorks chef cookbooks and stack json, as well
4
4
  as other OpsWorks centric tasks such as generating ssh configs for OpsWorks instances.
5
5
 
6
+ ## Wiki
7
+
8
+ See the [wiki](https://github.com/mapzen/opzworks/wiki) for more detailed information on getting started, walkthroughs, etc.
9
+
6
10
  ## Build Status
7
11
 
8
12
  [![Circle CI](https://circleci.com/gh/mapzen/opzworks.svg?style=svg)](https://circleci.com/gh/mapzen/opzworks)
@@ -26,50 +30,10 @@ To build locally from this repository: `rake install`
26
30
 
27
31
  ## Commands
28
32
 
29
- Run `opzworks` with one of the following commands:
30
-
31
33
  #### ssh
32
34
 
33
35
  Generate and update SSH configuration files, or alternatively return a list of IPs for matching stacks.
34
36
 
35
- Host names are based off the stack naming convention, `project_name::env::region`. The default
36
- is to use public instance IPs (or elastic ip if one is assigned). Passing the `--private` option
37
- will instead use instance private IPs.
38
-
39
- For example, if we have a host 'api1' in the stack apiaxle::prod::us-east, the
40
- resultant hostname will be `api1-apiaxle-prod-us-east`
41
-
42
- By default, `opsworks ssh` will iterate over all stacks. If you wish to restrict the stacks
43
- it searches, simply pass the stack name (or a partial match) as an argument:
44
-
45
- `opzworks ssh myproject::prod`
46
-
47
- If you wanted to automatically scrape all your stacks to populate your ssh config, and
48
- you don't want to use the `--update` flag (which will overwrite the entire file contents),
49
- you could do something like:
50
-
51
- * add a crontab entry similar to: `0 * * * * /bin/bash -l -c /path/to/opzworks-ssh.sh`
52
- * create `/path/to/opzworks-ssh.sh`:
53
-
54
- ```bash
55
- # this script reads .ssh/config, drops anything after the matched line,
56
- # then generates a list of opsworks hosts and appends them to the file.
57
- gsed -i '/OPSWORKS_CRON_LINE_MATCH/q' ~/.ssh/config
58
- opzworks ssh >>~/.ssh/config
59
- ```
60
-
61
- Note this example assumes the use of a gnu sed-like utility, which on OSX means
62
- installing gnu sed (`brew install gsed` if you're using homebrew). On Linux, simply
63
- change `gsed` to `sed`.
64
-
65
- Add the following line to the bottom of your existing ~/.ssh/config:
66
-
67
- `# OPSWORKS_CRON_LINE_MATCH`
68
-
69
- To return only a list of IPs, pass the `--raw` flag:
70
-
71
- `opzworks ssh -r mystack1 mystack2` or `opzworks ssh -r -p mystack`, etc.
72
-
73
37
  #### elastic
74
38
 
75
39
  Perform [start|stop|bounce|rolling] operations on an Elastic cluster.
@@ -85,127 +49,7 @@ Update stack custom JSON.
85
49
 
86
50
  #### berks
87
51
 
88
- Build the berkshelf for a stack, upload the tarball to S3, trigger `update_custom_cookbooks` on the stack.
89
-
90
- ## Configuration
91
-
92
- The gem reads information from `~/.aws/config`, or from the file referenced by
93
- the `AWS_CONFIG_FILE` environment variable. It should already look something like this:
94
-
95
- [default]
96
- aws_access_key_id = ilmiochiaveID
97
- aws_secret_access_key = ilmiochiavesegreto
98
- region = us-east-1
99
- output = json
100
-
101
- If you want the gem to read from an environment other than 'default', you can do so
102
- by exporting the `AWS_PROFILE` environment variable. It should be set to whatever profile
103
- name you have defined that you want to use in the config file.
104
-
105
- Add the following section to `~/.aws/config`:
106
-
107
- [opzworks]
108
- ssh-user-name = <MY SSH USER NAME>
109
- berks-repository-path = <PATH TO OPSWORKS BERKSHELF REPOSITORIES>
110
- berks-github-org = <GITHUB ORG THAT YOUR OPSWORKS REPOSITORIES EXIST UNDER>
111
- berks-s3-bucket = <AN EXISTING S3 BUCKET>
112
-
113
- The `ssh-user-name` value should be set to the username you want to use when
114
- logging in remotely, most probably the user name from your _My Settings_ page
115
- in OpsWorks.
116
-
117
- The `berks-repository-path` should point to a base directory in which your opsworks
118
- git repositories for each stack will live.
119
-
120
- The `berks-s3-bucket` will default to 'opzworks' if not set. You need to create the
121
- the bucket manually (e.g. `aws s3 mb s3://opsworks-cookbook-bucket`).
122
-
123
- The `berks-github-org` setting is used if you try to run `berks` or `json` on a stack, and
124
- the local opsworks-${project} repo isn't found. In this event, the code will attempt to clone
125
- the repo into `berks-repository-path` and continue.
126
-
127
- Additional option are:
128
-
129
- `berks-base-path`, which is the temporary base directory where the berkshelf will be
130
- built. Defaults to /tmp.
131
-
132
- `berks-tarball-name`, which is the name of the tarball that will be uploaded to S3. Defaults to cookbooks.tgz.
133
-
134
- ## Setup Conventions/Workflow for Berks/JSON Commands
135
-
136
- ![workflow](img/flow.png)
137
-
138
- This gem makes a number of assumptions in order to enforce a specific workflow. First among them is
139
- the Opsworks stack naming convection. This will need to adhere to the following format:
140
-
141
- PROJECT::ENV::REGION
142
-
143
- If PROJECT will be comprised of multiple words, they should be joined with underscores, e.g.
144
-
145
- my_awesome_rails_app::prod::us-east
146
-
147
- So for example, if you have an Elastic cluster in dev and prod in us-east, and dev in us-west:
148
-
149
- elastic::dev::us-east
150
- elastic::dev::us-west
151
- elastic::prod::us-east
152
-
153
- The next workflow that must be conformed to is berkshelf management. In this context, that means a git
154
- repository that conforms to the following setup:
155
-
156
- opsworks-project
157
-
158
- Inside that repository, you will have branches that match each of your environments and regions.
159
-
160
- So in our Elastic example, you would have the following setup:
161
-
162
- * a git repository called opsworks-elastic
163
- * branches in that repository called dev-us-east, dev-us-west and prod-us-east
164
-
165
- In each of those branches, you should have the following:
166
-
167
- * Berksfile
168
- * stack.json (if you want to maintain the stack json using the `opzworks json` utility)
169
-
170
- The Berksfile will look similar to the following. If you're familiar with Berkshelf, there's nothing
171
- new here:
172
-
173
- ```ruby
174
- source 'https://api.berkshelf.com'
175
-
176
- # opsworks
177
- cookbook 'apache2' , github: 'aws/opsworks-cookbooks' , branch: 'release-chef-11.10' , rel: 'apache2'
178
-
179
- # external
180
- #
181
- cookbook 'lvm', '= 1.0.8'
182
- cookbook 'sensu', '= 2.10.0'
183
- cookbook 'runit', '= 1.5.10'
184
- cookbook 'java', '= 1.29.0'
185
- cookbook 'nodejs', '= 2.1.0'
186
- cookbook 'elasticsearch', '= 0.3.13'
187
- cookbook 'chef_handler', '= 1.1.6'
188
-
189
- # mapzen wrappers
190
- #
191
- cookbook 'mapzen_sensu_clients', git: 'git@github.com:mapzen/chef-mapzen_sensu_clients', tag: '0.12.0'
192
- cookbook 'mapzen_elasticsearch', git: 'git@github.com:mapzen/chef-mapzen_elasticsearch', tag: '0.16.3'
193
- cookbook 'mapzen_logstash', git: 'git@github.com:mapzen/chef-mapzen_logstash', tag: '0.13.1'
194
- cookbook 'mapzen_graphite', git: 'git@github.com:mapzen/chef-mapzen_graphite', tag: '0.6.0'
195
- cookbook 'mapzen_pelias', git: 'git@github.com:mapzen/chef-mapzen_pelias', tag: '0.34.2'
196
- ```
197
-
198
- If we placed that Berkshelf file in opsworks-elastic, in the prod-us-east branch, we would run `opzworks berks elastic::prod::us-east`, which would do the following:
199
-
200
- * build the berkshelf locally
201
- * push the resultant cookbook tarball to: s3://opzworks/elastic-prod-us-east/cookbooks.tgz
202
- * run `update_custom_cookbook` on the stack (unless you pass the `--no-update` flag)
203
-
204
- Your stack should be configured to use a berkshelf from an S3 archive. The url will look as below:
205
-
206
- https://s3.amazonaws.com/opzworks/elastic-prod-us-east/cookbooks.tgz
207
-
208
- You'll need to set up an IAM user or users with permission to access the location.
52
+ Build the berkshelf for a stack, or only upload the Berksfile to allow remote berkshelf management on the host, upload the tarball to S3, trigger `update_custom_cookbooks` on the stack.
209
53
 
210
54
  ## Contributing
211
55
 
@@ -136,7 +136,12 @@ module OpzWorks
136
136
  hash[:stack_id] = @stack_id
137
137
  hash[:command] = { name: 'update_custom_cookbooks' }
138
138
 
139
- opsworks.create_deployment(hash)
139
+ begin
140
+ opsworks.create_deployment(hash)
141
+ rescue Aws::OpsWorks::Errors::ServiceError => e
142
+ puts "Caught error while attempting to trigger deployment: ".foreground(:red)
143
+ puts e
144
+ end
140
145
  else
141
146
  puts 'Update custom cookbooks skipped via --no-update switch.'.foreground(:blue)
142
147
  end
data/lib/opzworks/meta.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module OpzWorks
2
- VERSION = '0.3.9'
2
+ VERSION = '0.3.10'
3
3
  AUTHORS = ['Grant Heffernan', 'Mapzen']
4
4
  EMAIL = ['grant@mapzen.com']
5
5
  DESCRIPTION = 'OpzWorks Utilities'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opzworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Heffernan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-08 00:00:00.000000000 Z
12
+ date: 2016-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -195,7 +195,6 @@ files:
195
195
  - Rakefile
196
196
  - bin/opzworks
197
197
  - circle.yml
198
- - img/flow.png
199
198
  - lib/opzworks.rb
200
199
  - lib/opzworks/cli.rb
201
200
  - lib/opzworks/commands/berks.rb
data/img/flow.png DELETED
Binary file