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0
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- 0.11.1
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.1
- 0.9.0
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.1
- 0.7.0
- 0.6.0
- 0.5.1
- 0.4.3
- 0.4.2
- 0.4.1
- 0.3.0
- 0.2.3
- 0.2.0
- 0.1.0
Application cookbook which installs and configures Consul.
cookbook 'consul', '= 1.3.0', :supermarket
knife supermarket install consul
knife supermarket download consul
consul-cookbook
Application cookbook which installs and configures Consul.
Consul is a tool for discovering and configuring services within your
infrastructure. This is an application cookbook which takes a
simplified approach to configuring and installing
Consul. Additionally, it provides Chef primitives for more advanced
configuration.
Basic Usage
For most infrastructure we suggest first starting with the default
recipe. This installs and configures Consul from the latest supported
release. It is also what is used to certify platform support through
the use of our integration tests.
This cookbook provides node attributes which are used to fine tune
the default recipe which installs and configures Consul. These values
are passed directly into the Chef resource/providers which are exposed
for more advanced configuration.
Out of the box the following platforms are certified to work and are
tested using our Test Kitchen configuration. Additional platforms
may work, but your mileage may vary.
- CentOS (RHEL) 6.6, 7.1
- Ubuntu 12.04, 14.04
- Windows
Client
Out of the box the default recipe installs and configures the Consul
agent to run as a service in client mode. The intent here is that
your infrastructure already has a [quorum of servers][13]. In order
to configure Consul to connect to your cluster you would supply an
array of addresses for the Consul agent to join. This would be done
in your wrapper cookbook:
ruby
node.default['consul']['config']['start_join'] = %w{c1.internal.corporate.com c2.internal.corporate.com c3.internal.corporate.com}
Server
This cookbook is designed to allow for the flexibility to bootstrap a
new cluster. The best way to do this is through the use of a
wrapper cookbook which tunes specific node attributes for a
production server deployment.
The Consul cluster cookbook is provided as an example.
Advanced Usage
As explained above this cookbook provides Chef primitives in the form
of resource/provider to further manage the install and configuration
of Consul. These primitives are what is used in the default recipe,
and should be used in your own wrapper cookbooks for more
advanced configurations.
Configuration
It is very important to understand that each resource/provider has
defaults for some properties. Any changes to a resource's default
properties may need to be also changed in other resources. The best
example is the Consul configuration directory.
In the example below we're going to change the configuration file from
the default (/etc/consul.json) to one that may be on a special volume.
It is obvious that we need to change the path where consul_config
writes its file to, but it is less obvious that this needs to be
passed into consul_service
.
Inside of a recipe in your wrapper cookbook you'll want to do
something like the following block of code. It uses the validated
input from the configuration resource and passes it into the service
resource. This ensures that we're using the same data.
ruby
config = consul_config '/data/consul/default.json'
consul_service 'consul' do
config_file config.path
end
Watches/Definitions
In order to provide an idempotent implementation of Consul
watches and definitions. We write these out as
a separate configuration file in the JSON file format. The provider
for both of these resources are identical in functionality.
Below is an example of writing a Consul service definition for
the master instance of Redis. We pass in several parameters and tell
the resource to notify the proper instance of the Consul service to
reload.
ruby
consul_definition 'redis' do
type 'service'
parameters(tags: %w{master}, address: '127.0.0.1', port: 6379, interval: '30s')
notifies :reload, 'consul_service[consul]', :delayed
end
A check definition can easily be added as well. You simply have
to change the type and pass in the correct parameters. The definition
below checks memory utilization using a script on a ten second interval.
ruby
consul_definition 'mem-util' do
type 'check'
parameters(script: '/usr/local/bin/check_mem.py', interval: '10s')
notifies :reload, 'consul_service[consul]', :delayed
end
Finally, a watch is created below to tell the agent to monitor to
see if an application has been deployed. Once that application is
deployed a script is run locally. This can be used, for example, as a
lazy way to clear a HTTP disk cache.
ruby
consul_watch 'app-deploy' do
type 'event'
parameters(handler: '/usr/local/bin/clear-disk-cache.sh')
notifies :reload, 'consul_service[consul]', :delayed
end
A keen eye would notice that we are delaying the reload of the Consul
service instance. The reason we do this is to minimize the number of
times we need to tell Consul to actually reload configurations. If
there are several definitions this may save a little time off your
Chef run.
Execute
The command-line agent provides a mechanism to facilitate remote
execution. For example, this can be used to run the uptime
command
across your fleet of nodes which are hosting a particular API service.
ruby
consul_execute 'uptime' do
options(service: 'api')
end
All of the options available on the command-line can be passed
into the resource. This could potentially be a very dangerous
operation. You should absolutely understand what you are doing. By the
nature of this command it is impossible for it to be idempotent.
UI
consul_ui
resource can be used to download and extract the
consul web UI.
It can be done with a block like this:
consul_ui 'consul-ui' do owner node['consul']['service_user'] group node['consul']['service_group'] version node['consul']['version'] end
Assuming consul version 0.5.2
above block would create /srv/consul-ui/0.5.2
and symlink /srv/consul-ui/current
.
It does not change agent's configuration by itself.
consul_config
resource should be modified explicitly in order to host the web page.
consul_config 'consul' do ... ui_dir '/srv/consul-ui/current/dist' end
This is optional, because consul UI can be hosted by any web server.
[13]:
Dependent cookbooks
chef-vault >= 0.0.0 |
chocolatey >= 0.0.0 |
golang >= 0.0.0 |
firewall ~> 2.0.3 |
libartifact ~> 1.3 |
poise ~> 2.2 |
poise-service ~> 1.0 |
selinux ~> 0.9 |
Contingent cookbooks
Change Log
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
Unreleased
1.3.0
Enhancements
- Travis builds now use new container infrastructure.
- #215: Adds new resource for managing Consul UI service.
- #219: Adds support to configuration for recursor. [@fumimaron9](https://github.com/fumimaron9)
- #224: Adds support to configuration resource for Join WAN. [@justintime](https://github.com/justintime)
- #228: Default recipe now opens up UDP firewall rules. [@twmb](https://github.com/twmb)
Bug Fixes
- #210: Adds all types of Consul watches. [@scalp42](https://github.com/scalp42)
- #211: Service resource disable action deletes configuration. [@scalp42](https://github.com/scalp42)
- #212: Fixes issues while defining multiple service checks. [@scalp42](https://github.com/scalp42)
- #213: Service Resource - Disable action doesn't delete directory. [@scalp42](https://github.com/scalp42)
- #221: Updates firewall cookbook dependency version. [@lmickh](https://github.com/lmickh)
- #222: Fixes syntax for Consul watch resource configuration. [@wk8](https://github.com/wk8)
- #223: Skips SELinux recipe on non-Linux platforms. [@kamaradclimber](https://github.com/kamaradclimber)
- #227: Fixes definition resource to be able to override name. [@tomzo](https://github.com/tomzo)
0.10.0
Enhancements
- Node attribute for specifying Consul log file. [@darron](https://github.com/darron)
- Recipe no longer tries to create directories twice. [@tiwilliam](https://github.com/tiwilliam)
- Add packagecloud install method. [@darron](https://github.com/darron)
- Add 'rejoin_after_leave' option. [@arodd](https://github.com/arodd)
- Add LWRP for services watch. [@hirocaster](https://github.com/hirocaster)
Bug Fixes
- #152 Remove +x permissions on upstart/systemd configs. [@dpkp](https://github.com/dpkp)
- #158 Fix sysvinit script by not quoting commands. [@hatchetation](https://github.com/hatchetation)
- #172 Adds missing bracket to restart subscription. [@YuukiARIA](https://github.com/YuukiARIA)
- #178 Ensures GOMAXPROCS is at least 2. [@tgwizard](https://github.com/tgwizard)
0.9.1
Bug Fixes
- Locks to Chef 11 compatible version of libarchive cookbook.
0.9.0
Enhancements
- Adds support for publishing to statsd URL. [@akerekes](https://github.com/akerekes)
- Adds support for Arch Linux. ([@logankoester](https://github.com/logankoester))
- Adds systemd init style. [@logankoester](https://github.com/logankoester)
- Adds support for Consul HTTP checks. [@gavinheavyside](https://github.com/gavinheavyside)
- Bump default Consul installed version to 0.5.0
Bug Fixes
- Remove hard dependency on chef-provisioning cookbook.
- Sets correct ownership to Consul run user/group on service directories. [@thedebugger](https://github.com/thedebugger)
- Removes support for EL5 (CentOS 5) and Ubuntu 10.04.
0.8.3
Bug Fixes
- Export GOMAXPROCS when using runit service style.
0.8.2
Bug Fixes
- Sets GOMAXPROCS when using runit service style.
0.8.1
Bug Fixes
- Vanilla init script now points to the proper Consul binary and data dir.
0.8.0
Enhancements
- Upgrading from one version to another of Consul is now supported.
- Restarts after upgrade.
Bug Fixes
- Partial convergeances will now gracefully recover on the next chef run.
- Upstart will now respawn Consul on crash.
- It is no longer possible to set an invalid install method.
0.7.0
Enhancements
- Adds cluster recipe for easily provisioning new Consul clusters.
- Adds support for additional options for service_config.
- Adds support for Ubuntu 10.04.
- Allows custom data bags for Consul encrypt.
- Bumps support for golang cookbook to 1.4.
- Adds `consul/retry_on_join` attribute.
- Adds consul_service_watch LWRP.
Bug Fixes
- Reloading the Consul service when using runit init style.
Foodcritic Metric
1.3.0 passed this metric
1.3.0 passed this metric