chef_sous_vide 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4dbf479c7c26026bf1c478fed4b9268743c018cc
4
+ data.tar.gz: f903092d21a62916b09d1b03c5b0a6e2e00be2c5
5
+ SHA512:
6
+ metadata.gz: 6cf82abbceeb1d85371f5cda965cf3c27dbbd61bdc220253c9e5ded22149ce6ab6f658f2473cd2a15a050c127d9c525536ee13d5ba62cd7e496e488211a8b1ab
7
+ data.tar.gz: c80e255d8f134869e2e72448c2b30ebdec32044568271175138933129dd5ab643eaa370b5a5af5729f06b33019b208c9afc652bf16622eb1446408af5fb16960
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ .bundle/
2
+ .yardoc
3
+ _yardoc/
4
+ coverage/
5
+ doc/
6
+ pkg/
7
+ spec/reports/
8
+ tmp/
9
+ vendor
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ .kitchen/
14
+ .kitchen.local.yml
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.3
7
+ before_install: gem install bundler -v 1.17.1
data/Berksfile ADDED
@@ -0,0 +1,11 @@
1
+ source "https://supermarket.chef.io"
2
+
3
+ Dir.glob("cookbooks/*").map do |dir|
4
+ cookbook File.basename(dir), path: dir
5
+ end
6
+
7
+ cookbook "java"
8
+ cookbook "elasticsearch"
9
+ cookbook "seven_zip", "< 3.1"
10
+ cookbook "tomcat"
11
+ cookbook "nginx"
data/Berksfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ DEPENDENCIES
2
+ elasticsearch
3
+ java
4
+ nginx
5
+ seven_zip (< 3.1.0)
6
+ sous_vide
7
+ path: cookbooks/sous_vide
8
+ tomcat
9
+
10
+ GRAPH
11
+ apt (7.1.1)
12
+ ark (4.0.0)
13
+ build-essential (>= 0.0.0)
14
+ seven_zip (>= 0.0.0)
15
+ build-essential (8.2.1)
16
+ mingw (>= 1.1)
17
+ seven_zip (>= 0.0.0)
18
+ chef-sugar (5.0.1)
19
+ elasticsearch (4.0.5)
20
+ apt (>= 0.0.0)
21
+ ark (>= 0.0.0)
22
+ chef-sugar (>= 0.0.0)
23
+ yum (>= 0.0.0)
24
+ homebrew (5.0.8)
25
+ java (3.2.1)
26
+ homebrew (>= 0.0.0)
27
+ windows (>= 0.0.0)
28
+ mingw (2.1.0)
29
+ seven_zip (>= 0.0.0)
30
+ nginx (9.0.0)
31
+ build-essential (>= 5.0)
32
+ ohai (>= 4.1.0)
33
+ yum-epel (>= 0.0.0)
34
+ ohai (5.2.5)
35
+ seven_zip (3.0.0)
36
+ windows (>= 0.0.0)
37
+ sous_vide (0.0.1)
38
+ elasticsearch (>= 0.0.0)
39
+ java (>= 0.0.0)
40
+ nginx (>= 0.0.0)
41
+ tomcat (>= 0.0.0)
42
+ tomcat (3.2.0)
43
+ windows (5.3.0)
44
+ yum (5.1.0)
45
+ yum-epel (3.3.0)
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,297 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sous_vide (0.1.0)
5
+ chef (~> 12.17.44)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.5.2)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ backports (3.12.0)
13
+ berkshelf (6.3.4)
14
+ buff-config (~> 2.0)
15
+ buff-extensions (~> 2.0)
16
+ chef (>= 12.7.2, < 14.0)
17
+ cleanroom (~> 1.0)
18
+ concurrent-ruby (~> 1.0)
19
+ faraday (~> 0.9)
20
+ httpclient (~> 2.7)
21
+ minitar (~> 0.5, >= 0.5.4)
22
+ mixlib-archive (~> 0.4)
23
+ mixlib-shellout (~> 2.0)
24
+ octokit (~> 4.0)
25
+ retryable (~> 2.0)
26
+ ridley (~> 5.0)
27
+ solve (~> 4.0)
28
+ thor (~> 0.19, < 0.19.2)
29
+ buff-config (2.0.0)
30
+ buff-extensions (~> 2.0)
31
+ varia_model (~> 0.6)
32
+ buff-extensions (2.0.0)
33
+ buff-ignore (1.2.0)
34
+ buff-ruby_engine (1.0.0)
35
+ buff-shell_out (1.1.0)
36
+ buff-ruby_engine (~> 1.0)
37
+ builder (3.2.3)
38
+ celluloid (0.16.0)
39
+ timers (~> 4.0.0)
40
+ celluloid-io (0.16.2)
41
+ celluloid (>= 0.16.0)
42
+ nio4r (>= 1.1.0)
43
+ chef (12.17.44)
44
+ addressable
45
+ bundler (>= 1.10)
46
+ chef-config (= 12.17.44)
47
+ chef-zero (>= 4.8)
48
+ diff-lcs (~> 1.2, >= 1.2.4)
49
+ erubis (~> 2.7)
50
+ ffi-yajl (~> 2.2)
51
+ highline (~> 1.6, >= 1.6.9)
52
+ iniparse (~> 1.4)
53
+ mixlib-archive (>= 0.2.0)
54
+ mixlib-authentication (~> 1.4)
55
+ mixlib-cli (~> 1.7)
56
+ mixlib-log (~> 1.3)
57
+ mixlib-shellout (~> 2.0)
58
+ net-sftp (~> 2.1, >= 2.1.2)
59
+ net-ssh (>= 2.9, < 4.0)
60
+ net-ssh-multi (~> 1.1)
61
+ ohai (>= 8.6.0.alpha.1, < 9)
62
+ plist (~> 3.2)
63
+ proxifier (~> 1.0)
64
+ rspec-core (~> 3.5)
65
+ rspec-expectations (~> 3.5)
66
+ rspec-mocks (~> 3.5)
67
+ rspec_junit_formatter (~> 0.2.0)
68
+ serverspec (~> 2.7)
69
+ specinfra (~> 2.10)
70
+ syslog-logger (~> 1.6)
71
+ uuidtools (~> 2.1.5)
72
+ chef-config (12.17.44)
73
+ addressable
74
+ fuzzyurl
75
+ mixlib-config (~> 2.0)
76
+ mixlib-shellout (~> 2.0)
77
+ chef-zero (13.1.0)
78
+ ffi-yajl (~> 2.2)
79
+ hashie (>= 2.0, < 4.0)
80
+ mixlib-log (~> 1.3)
81
+ rack (~> 2.0)
82
+ uuidtools (~> 2.1)
83
+ cleanroom (1.0.0)
84
+ coderay (1.1.2)
85
+ concurrent-ruby (1.1.5)
86
+ cucumber (3.1.2)
87
+ builder (>= 2.1.2)
88
+ cucumber-core (~> 3.2.0)
89
+ cucumber-expressions (~> 6.0.1)
90
+ cucumber-wire (~> 0.0.1)
91
+ diff-lcs (~> 1.3)
92
+ gherkin (~> 5.1.0)
93
+ multi_json (>= 1.7.5, < 2.0)
94
+ multi_test (>= 0.1.2)
95
+ cucumber-core (3.2.1)
96
+ backports (>= 3.8.0)
97
+ cucumber-tag_expressions (~> 1.1.0)
98
+ gherkin (~> 5.0)
99
+ cucumber-expressions (6.0.1)
100
+ cucumber-tag_expressions (1.1.1)
101
+ cucumber-wire (0.0.1)
102
+ diff-lcs (1.3)
103
+ erubis (2.7.0)
104
+ faraday (0.15.4)
105
+ multipart-post (>= 1.2, < 3)
106
+ ffi (1.10.0)
107
+ ffi-yajl (2.3.1)
108
+ libyajl2 (~> 1.2)
109
+ fuzzyurl (0.9.0)
110
+ gherkin (5.1.0)
111
+ gssapi (1.2.0)
112
+ ffi (>= 1.0.1)
113
+ gyoku (1.3.1)
114
+ builder (>= 2.1.2)
115
+ hashie (3.6.0)
116
+ highline (1.7.10)
117
+ hitimes (1.3.1)
118
+ httpclient (2.8.3)
119
+ iniparse (1.4.4)
120
+ ipaddress (0.8.3)
121
+ json (2.2.0)
122
+ kitchen-docker (2.9.0)
123
+ test-kitchen (>= 1.0.0)
124
+ kitchen-transport-rsync (0.1.2)
125
+ test-kitchen (~> 1.4)
126
+ libyajl2 (1.2.0)
127
+ little-plugger (1.1.4)
128
+ logging (2.2.2)
129
+ little-plugger (~> 1.1)
130
+ multi_json (~> 1.10)
131
+ method_source (0.9.2)
132
+ minitar (0.8)
133
+ mixlib-archive (0.4.20)
134
+ mixlib-log
135
+ mixlib-authentication (1.4.2)
136
+ mixlib-cli (1.7.0)
137
+ mixlib-config (2.2.18)
138
+ tomlrb
139
+ mixlib-install (3.11.11)
140
+ mixlib-shellout
141
+ mixlib-versioning
142
+ thor
143
+ mixlib-log (1.7.1)
144
+ mixlib-shellout (2.4.4)
145
+ mixlib-versioning (1.2.7)
146
+ molinillo (0.6.6)
147
+ multi_json (1.13.1)
148
+ multi_test (0.1.2)
149
+ multipart-post (2.0.0)
150
+ net-scp (1.2.1)
151
+ net-ssh (>= 2.6.5)
152
+ net-sftp (2.1.2)
153
+ net-ssh (>= 2.6.5)
154
+ net-ssh (3.2.0)
155
+ net-ssh-gateway (1.3.0)
156
+ net-ssh (>= 2.6.5)
157
+ net-ssh-multi (1.2.1)
158
+ net-ssh (>= 2.6.5)
159
+ net-ssh-gateway (>= 1.2.0)
160
+ net-telnet (0.1.1)
161
+ nio4r (2.3.1)
162
+ nori (2.6.0)
163
+ octokit (4.14.0)
164
+ sawyer (~> 0.8.0, >= 0.5.3)
165
+ ohai (8.26.1)
166
+ chef-config (>= 12.5.0.alpha.1, < 14)
167
+ ffi (~> 1.9)
168
+ ffi-yajl (~> 2.2)
169
+ ipaddress
170
+ mixlib-cli
171
+ mixlib-config (~> 2.0)
172
+ mixlib-log (>= 1.7.1, < 2.0)
173
+ mixlib-shellout (~> 2.0)
174
+ plist (~> 3.1)
175
+ systemu (~> 2.6.4)
176
+ wmi-lite (~> 1.0)
177
+ plist (3.5.0)
178
+ proxifier (1.0.3)
179
+ pry (0.12.2)
180
+ coderay (~> 1.1.0)
181
+ method_source (~> 0.9.0)
182
+ public_suffix (3.0.3)
183
+ rack (2.0.6)
184
+ rake (10.5.0)
185
+ retryable (2.0.4)
186
+ ridley (5.1.1)
187
+ addressable
188
+ buff-config (~> 2.0)
189
+ buff-extensions (~> 2.0)
190
+ buff-ignore (~> 1.2)
191
+ buff-shell_out (~> 1.0)
192
+ celluloid (~> 0.16.0)
193
+ celluloid-io (~> 0.16.1)
194
+ chef-config (>= 12.5.0)
195
+ erubis
196
+ faraday (~> 0.9)
197
+ hashie (>= 2.0.2, < 4.0.0)
198
+ httpclient (~> 2.7)
199
+ json (>= 1.7.7)
200
+ mixlib-authentication (>= 1.3.0)
201
+ retryable (~> 2.0)
202
+ semverse (~> 2.0)
203
+ varia_model (~> 0.6)
204
+ rspec (3.8.0)
205
+ rspec-core (~> 3.8.0)
206
+ rspec-expectations (~> 3.8.0)
207
+ rspec-mocks (~> 3.8.0)
208
+ rspec-core (3.8.0)
209
+ rspec-support (~> 3.8.0)
210
+ rspec-expectations (3.8.2)
211
+ diff-lcs (>= 1.2.0, < 2.0)
212
+ rspec-support (~> 3.8.0)
213
+ rspec-its (1.2.0)
214
+ rspec-core (>= 3.0.0)
215
+ rspec-expectations (>= 3.0.0)
216
+ rspec-mocks (3.8.0)
217
+ diff-lcs (>= 1.2.0, < 2.0)
218
+ rspec-support (~> 3.8.0)
219
+ rspec-support (3.8.0)
220
+ rspec_junit_formatter (0.2.3)
221
+ builder (< 4)
222
+ rspec-core (>= 2, < 4, != 2.12.0)
223
+ rubyntlm (0.6.2)
224
+ rubyzip (1.2.2)
225
+ sawyer (0.8.1)
226
+ addressable (>= 2.3.5, < 2.6)
227
+ faraday (~> 0.8, < 1.0)
228
+ semverse (2.0.0)
229
+ serverspec (2.41.3)
230
+ multi_json
231
+ rspec (~> 3.0)
232
+ rspec-its
233
+ specinfra (~> 2.72)
234
+ sfl (2.3)
235
+ solve (4.0.2)
236
+ molinillo (~> 0.6)
237
+ semverse (>= 1.1, < 4.0)
238
+ specinfra (2.77.0)
239
+ net-scp
240
+ net-ssh (>= 2.7)
241
+ net-telnet (= 0.1.1)
242
+ sfl
243
+ syslog-logger (1.6.8)
244
+ systemu (2.6.5)
245
+ test-kitchen (1.24.0)
246
+ mixlib-install (~> 3.6)
247
+ mixlib-shellout (>= 1.2, < 3.0)
248
+ net-scp (~> 1.1)
249
+ net-ssh (>= 2.9, < 5.0)
250
+ net-ssh-gateway (~> 1.2)
251
+ thor (~> 0.19)
252
+ winrm (~> 2.0)
253
+ winrm-elevated (~> 1.0)
254
+ winrm-fs (~> 1.1)
255
+ thor (0.19.1)
256
+ timers (4.0.4)
257
+ hitimes
258
+ tomlrb (1.2.8)
259
+ uuidtools (2.1.5)
260
+ varia_model (0.6.0)
261
+ buff-extensions (~> 2.0)
262
+ hashie (>= 2.0.2, < 4.0.0)
263
+ winrm (2.3.1)
264
+ builder (>= 2.1.2)
265
+ erubis (~> 2.7)
266
+ gssapi (~> 1.2)
267
+ gyoku (~> 1.0)
268
+ httpclient (~> 2.2, >= 2.2.0.2)
269
+ logging (>= 1.6.1, < 3.0)
270
+ nori (~> 2.0)
271
+ rubyntlm (~> 0.6.0, >= 0.6.1)
272
+ winrm-elevated (1.1.1)
273
+ winrm (~> 2.0)
274
+ winrm-fs (~> 1.0)
275
+ winrm-fs (1.3.2)
276
+ erubis (~> 2.7)
277
+ logging (>= 1.6.1, < 3.0)
278
+ rubyzip (~> 1.1)
279
+ winrm (~> 2.0)
280
+ wmi-lite (1.0.2)
281
+
282
+ PLATFORMS
283
+ ruby
284
+
285
+ DEPENDENCIES
286
+ berkshelf
287
+ bundler (~> 1.17)
288
+ cucumber (~> 3.1.2)
289
+ kitchen-docker
290
+ kitchen-transport-rsync
291
+ pry
292
+ rake (~> 10.0)
293
+ sous_vide!
294
+ test-kitchen
295
+
296
+ BUNDLED WITH
297
+ 1.17.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 robuye
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # SousVide for Chef
2
+
3
+ **=======> SousVide is not ready to use. <=======**
4
+
5
+ SousVide is a Chef Handler you can use to collect & visualize `chef-client` converge process. It receives event data from `chef-client` and keeps track of the converge process. It's essentially a stream parser hooked into `Chef::EventDispatch`.
6
+
7
+ At the end you will have an extensive report about events occured during the run.
8
+
9
+ Here's what SousVide will tell you:
10
+
11
+ * time spent on a resource in ms
12
+ * source location of a tracked resource (`cookbook::recipe`)
13
+ * real execution order
14
+ - takes into account notifications and multiple executions
15
+ * better execution status
16
+ - detects why-run used with :before notifications
17
+ - is aware of 'unprocessed' resources
18
+ * better execution phase
19
+ - adds 'delayed' and 'post-converge' custom phases
20
+ * better errors for retriable and ignorable resources
21
+ - last error is always captured, even if the resource succeed on retry
22
+ * guards details (only_if & not_if) when a resource was skipped
23
+ * more data about notifications
24
+ - simple counters for each type
25
+ - notification type & notifying resource when available
26
+
27
+ All this and more will be available in a simple JSON friendly data structure ready to serve anywhere you like.
28
+
29
+ Feed it to Kibana, save to file or print at the end of chef-client run. `SousVide` comes with common outputs (see `SousVide::Outputs`) but you can write your own or even pass it a Proc.
30
+
31
+ ## Installation & Usage
32
+
33
+ Add to your recipe:
34
+
35
+ ```ruby
36
+ chef_gem "sous_vide" do
37
+ action :install
38
+ end
39
+
40
+ require "sous_vide"
41
+ SousVide::Handler.register(node.run_context)
42
+ ```
43
+
44
+ You should add these lines as early as possible. SousVide will not detect compile-time executions before it's registration, but otherwise it will work just fine (or just as one would expect).
45
+
46
+ In default configuration the report will be sent to `Chef::Log` at `INFO` level. `chef-client` will not print it to stdout if executed from a terminal (`log_level :auto`), it will be printed to the log file only.
47
+
48
+ ## Outputs & Configuration
49
+
50
+ Once SousVide is registered, it's for the most part up to you to consume the output. `JsonHTTP` will probably be the most useful, the structure looks like this:
51
+
52
+ ```json
53
+ [
54
+ {
55
+ "chef_resource": "execute[wait-for-logstash]#run",
56
+ "chef_resource_name": "wait-for-logstash",
57
+ "chef_resource_type": "execute",
58
+ "chef_resource_cookbook": "sous_vide",
59
+ "chef_resource_recipe": "default",
60
+ "chef_resource_action": "run",
61
+ "chef_resource_guard": null,
62
+ "chef_resource_duration_ms": 17,
63
+ "chef_resource_error_output": null,
64
+ "chef_resource_error_source": null,
65
+ "chef_resource_retries": 0,
66
+ "chef_resource_notified_by": null,
67
+ "chef_resource_notified_via": null,
68
+ "chef_resource_before_notifications": 0,
69
+ "chef_resource_immediate_notifications": 0,
70
+ "chef_resource_delayed_notifications": 0,
71
+ "chef_resource_order": 47,
72
+ "chef_resource_execution_phase": "converge",
73
+ "chef_resource_started_at": "2019-04-01 11:46:24",
74
+ "chef_resource_completed_at": "2019-04-01 11:46:24",
75
+ "chef_resource_status": "updated",
76
+ "chef_node_ipv4": "172.17.0.2",
77
+ "chef_node_instance_id": "default-ubuntu-1604",
78
+ "chef_node_role": "elasticsearch",
79
+ "chef_run_id": "133e4189",
80
+ "chef_run_name": "2019-04-01 11:46:18 elasticsearch 172.17.0.2 133e4189",
81
+ "chef_run_started_at": "2019-04-01 11:46:18",
82
+ "chef_run_completed_at": "2019-04-01 11:46:24",
83
+ "chef_run_success": true
84
+ },
85
+
86
+ #...
87
+ ]
88
+ ```
89
+
90
+ You can configure SousVide in the recipe:
91
+
92
+ ```ruby
93
+ require "sous_vide"
94
+ json_http = SousVide::Outputs::JsonHTTP.new(url: "http://elasticsearch:3000")
95
+ SousVide::Handler.instance.sous_output = json_http
96
+ SousVide::Handler.register(node.run_context)
97
+ ```
98
+
99
+ Open `cookbooks/sous_vide/recipes/install.rb` to see how to configure other outputs or use more than one.
100
+
101
+ SousVide output can be any object that responds to `call` method (a simple proc is valid too) with the following parameters:
102
+
103
+ ```ruby
104
+ def call(run_data:, node_data:, resources_data:)
105
+ # ... something interesting
106
+ end
107
+ ```
108
+
109
+ ## Demo
110
+
111
+ This repository comes with `kitchen` setup you can use out of the box to see SousVide in action.
112
+
113
+ Run `bundle exec kitchen converge default` to provision a docker container with ELK stack using `chef-client` & SousVide.
114
+
115
+ Once `chef-client` finishes converging you can access a Kibana dashboard and see all the information SousVide collected during the run at `http://localhost:5601/app/kibana#/dashboard/cba01d00-5383-11e9-90a1-a5ec6cbc0c49`.
116
+
117
+ There are more example kitchen configurations you can converge and see the runs in Kibana. You can change the default recipe, converge again and see it in Kibana.
118
+
119
+ ## Contributing
120
+
121
+ Bug reports, suggestions and pull requests are welcome on GitHub.
122
+
123
+ More and better kitchen (longer, more real-world) suites or dashboard improvements will be greatly appreciated.
124
+
125
+ ## License
126
+
127
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).