Skip to content

dpetzel/consul_alerts-cookbook

Repository files navigation

Consul-Alerts Cookbook

This cookbook provides an LWRP as well as a sample recipe for managing consul-alerts

Build Status

Requirements

  • Chef 11+
  • A working Consul installation

Supported Platforms

The following is a list of platforms that the cookbook is regularly tested on. It is likely it runs on other platform combinations as well, but only those that are regularly tested on will be declared supported:

  • EL6 (tested using Centos)
  • EL5 (tested using Centos)

Usage

The simplest way to get started is to add recipe[consul-alerts] to a node's run_list that already has consul installed. This will invoke the default recipe which simply calls the LWRP with a very minimal set of options. Odd's are that you environment is a little more complex, and you'll likely want to write a wrapper cookbook/recipe that invokes the LWRP with settings appropriate for your environment

LWRP

The cookbook provides a consul_alert LWRP which is used to install and manage the consul-alerts daemon

Actions

  • :create - This will install the necessary components to run the daemon.
  • :remove - This will remove any components that were installed by the LWRP.
  • :start - This will start the daemon on the host. It will also be configured to start on boot.
  • :stop - This will stop the daemon on the host. It will also disable start on boot.

Attributes

Key Type Description Default
version String Which version of `consul-alerts` to install 0.1.1
install_dir String The directory into which `consul-alerts` will be installed /usr/local/consul-alerts
user String The user account under which the daemon will be run consul-alerts
group String The group under which the daemon will be run consul-alerts
service_name String The name of the service to give the daemon consul-alerts
consul_addr String The address of the consul HTTP API 127.0.0.1:8500
consul_dc String The consul datacenter to use dc1
port Fixnum The TCP port on which the daemon will listen 9000
base_url String The base URL from which `consul-alerts` can be downloaded http://dl.bintray.com/darkcrux/generic
checksums Hash A Hash of known Checksums for the various downloadable files. It is unlikely you need (or want) to adjust this, however if for some reason you need to override, or add additional checksums, you can do so here. Refer to the `resource/default.rb`
config Hash A Hash of configuration key/value pairs that will be inserted into the Consul Key/Value store. 'checks/enabled' => 'true',
'checks/change-threshold' => '60',
'events/enabled' => 'true',
'notifiers/log/enabled' => 'true',
'notifiers/log/path' => '/var/log/consul-notifications.log'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Testing

This cookbook currently uses test-kitchen along with ChefSpec.

Test Kitchen: kitchen test

ChefSpec: bundle exec rspec

Releasing

This cookbook uses an 'even number' release strategy. The version number in master will always be an odd number indicating development, and an even number will be used when an official build is released.

Come release time here is the checklist:

  • Ensure the metadata.rb reflects the proper even numbered release
  • Ensure there is a dated change log entry in CHANGELOG.md
  • Commit all the changes
  • Use stove to release (bundle exec stove)
  • Bump the version in metadata.rb to the next patch level odd number

Authors