cookbook 'cwb', '= 0.1.1'
cwb (4) Versions 0.1.1 Follow0
Installs/Configures cwb
cookbook 'cwb', '= 0.1.1', :supermarket
knife supermarket install cwb
knife supermarket download cwb
Cloud WorkBench Cookbook (CWB Cookbook)
This cookbook prepares a machine for CWB benchmarks.
Attributes
Logging
default['benchmark']['logging_enabled'] = false
System Specific
# This attribute will overwrite owner and group if present default['benchmark']['ssh_username'] = nil default['benchmark']['owner'] = 'ubuntu' default['benchmark']['group'] = 'ubuntu'
Resource
Use the cwb_benchmark
resource to define a benchmark. Make sure you place the Ruby implementation of the benchmark within files/default/benchmark_name.rb
.
Take care of correct naming! Example:
* Cookbook and benchmark name: http-benchmark
(hyphen)
* Ruby benchmark implementation: http_benchmark
(underscore)
* Ruby benchmark class name: HttpBenchmark
(CamelCase => HTTPBenchmark is wrong!)
cwb_benchmark 'benchmark-name'
Libraries
cwb_defaults(self)
Instead of hardcoding owner
and group
you should use the cwb_defaults(self)
utility method:
file '/tmp/something' do cwb_defaults(self) action :create end
Cwb::BenchmarkUtil
Provides path utilities for your benchmark.
Example usage within your recipe:
my_bench = Cwb::BenchmarkUtil.new('benchmark-name', node) cwb_benchmark my_bench.name # Create a config file from a template that should reside # at the same directory as the Ruby benchmark file. template my_bench.path_for('config.ini') do cwb_defaults(self) source 'config.ini.erb' end
Cwb::Util
Cwb::Util.root_dir(node) cwb_util = Cwb::Util.new(node) cwb_util.root_dir
Usage
cwb::default
You should not explicitly include the cwb::default
recipe within your cookbooks. Instead the CWB Server will take care of adding cwb to the Chef run list.
Internal Structure
The cwb::core
recipe prepares the following structure for benchmarks that are subsequently added by custom benchmark cookbooks.
Do NOT rely in this internal structure as it might change in the future.
.
├── benchmark_suite.txt [single benchmark suite to be executed]
├── benchmarks.txt [ordered list of benchmarks to be executed]
├── node.yml [hash of Chef node attributes]
├── app-bench
│ └── app_bench.rb
├── micro-bench
│ └── micro_bench.rb
├── my-bench
│ └── my_bench.rb
│ └── config.ini
cwb CLI
The command line utility is able to execute single benchmarks in isolation or an entire benchmark suite. The default benchmark suite will execute all benchmarks according to the order in benchmarks.txt
which reflects the recipe order in the Chef run list.
cwb execute micro-bench/micro_bench.rb cwb execute .
Notes
- This cookbook monkypatches the String class by adding the utility methods
camelize
andunderscore
. These methods are for internal use, do NOT depend on them.
Development
Integration Tests
Requirements: VirtualBox , Vagrant, and vagrant plugin install vagrant-omnibus
kitchen list kitchen converge kitchen verify
All together with kitchen test
Publish Cookbook
Publish Chef Cookbook to Chef Supermarket (only for owners)
Bump version in metadata.rb
knife cookbook site share "cwb" "Other" git tag -a cwb/v0.1.X -m 'COMMENT' git push origin --tags
License and Authors
Author:: Joel Scheuner (joel.scheuner.dev@gmail.com)
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
0.1.1 (2015-04-27)
- Introduce the
benchmark.logging_enabled
attribute to replacebenchmark.redirect_io
- Fix internal resource duplication issue that prevented adding multiple benchmarks (internally using attribute now)
- Add integration tests
- Restructure README.md docs
- Add additional code documentation
- Ensure consistent use of quotes preferring single quotes
'
0.1.0 (2015-04-25)
- Initial release of cwb
Foodcritic Metric
0.1.1 failed this metric
FC009: Resource attribute not recognised: /tmp/cook/ad7b8d171aa1ba987d1be944/cwb/recipes/install.rb:2
FC017: LWRP does not notify when updated: /tmp/cook/ad7b8d171aa1ba987d1be944/cwb/providers/benchmark.rb:71
0.1.1 failed this metric
FC017: LWRP does not notify when updated: /tmp/cook/ad7b8d171aa1ba987d1be944/cwb/providers/benchmark.rb:71