Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

etcd-v2 Cookbook

This cookbook manages etcd version 2. It provides resources for installation from both binaries and source, and for management of one or more etcd service instances.

What even is all of this for?!

This cookbook aims to provide a feature complete utility to install and configure one or more instances of etcd for both production and development/testing proposes.

The etcd_service resource allows multiple etcd processes to run on the same system to:
* Test client libraries with actual clusters. Not just the one node you brew installd and started in another terminal.
* Test discovery configurations and failovers before doing it live.
* Figure out how to actually add/remove nodes to/from your cluster safely before you do this.

Similarly, the etcd_binary and etcd_source resources ensure that their respective installations are vendored so as to allow multiple versions/builds of etcd to coexist on a single system. etcd_service resources each map to an installation, allowing you to test arbitrary compatibility scenarios both within a cluster and with client libraries.

Recipes

etcd-v2::aws Create a simple cluster using the :aws discovery method

etcd-v2::default Install base dependencies. Must be included before using resources.

etcd-v2::node Create a standalone node

etcd-v2::testing Create a cluster of three nodes on the same host for testing

Resources

etcd_binary

Install etcd from a compiled release, by default from coreos/etcd on GitHub.

etcd_binary 'default' will install etcd in /opt and link to etcd and etcdctl from /usr/local/bin.

etcd_binary 'name' do
version 'v2.0.10' # Default set in node['etcd_v2']['version'], currently 'v2.0.10'
platform 'linux-amd64' # Default set in node['etcd_v2']['platform']
path '/opt' # Install root. Unpacked into <path>/etcd-<version>-<platform>
srv_bin 'etcd' # Name of etcd binary in package
ctl_bin 'etcdctl' # Name of etcd control binary in package
bin_path '/usr/local/bin' # Path to link to binaries from. Set to nil or false to disable linking
from :github # Package source. Currently only :github is supported
repository '/coreos/etcd' # GitHub repo to fetch release from. Default node['etcd_v2']['bin_repository']
end

etcd_source

Fetch and build etcd from a git repository. This resource does not install golang. The golang cookbook should do the needful for you.

etcd_service

Configure and run an installation (etcd_binary or etcd_source) as a service. The only required attributes in the following are name_node (name attribute) and instance. Other values have sane defaults for running a single node cluster.

While most configuration parameters are exposed directly, several abstractions are provided to capture some of the more confusing or repetitive parts of the etcd v2 configuration spec:

client_port, peer_port, client_listen, peer_listen, client_host, and peer_host attributes are used to simplify the composition of various *-url arguments. Arrays passed to these attributes will result in geometric compositions, including the protocol attribute in the respective argument:

Static peers are added using the peer(name, protocol, host, client_port, peer_port) method. The node's -initial-cluster argument will be composed from a merge of protocol, host, and peer_port parameters as well as the nodes own 'peer_host:peer_port' set.

The discovery attribute enables different configuration arguments specific to the respective clustering method. :static, :etcd, and :dns are features of etcd. The :aws discovery method is implemented by this cookbook. It uses the EC2 tags API to find peers for cluster bootstrapping.

Using the :aws discovery method

The :aws discovery method uses AWS tags and etcd APIs to bootstrap a new cluster, join an existing cluster, or fail back to a proxy node if a cluster of the desired size exists.

The :aws discovery method requires the aws cookbook. You must add it to your downstream dependencies and include the aws::default recipe before defining resources that use the :aws discovery method! The aws::ec2_hints recipe may be necessary to coerce ohai into populating node['ec2']

node_name will be set to node['ec2']['instance_id']. The same transport protocol and peer_port must be used across the cluster.

Due to the serial nature of Chef, multiple etcd_service resources should not be defined in the same run_list for the same cluster when using the :aws discovery method. One resource will block the Chef run until the desired quorum of peers is discovered. Note that the :aws method uses the same underlying configuration as the :static method. For simple testing scenarios, they should be functionally equivalent.

The instance will need the following authorizations. They should be configured in an IAM role and applied with an instance profile:

ec2:CreateTags

ec2:DeleteTags

ec2:DescribeTags

ec2:DescribeInstances

Vagrant

The included Vagrant file uses the vagrant-secret and vagrant-aws plugins. If you would like to provision EC2 nodes, install both plugins and create a .vagrant/secret.yaml file. Run vagrant secret-init and edit the resulting file:

Collaborator Number Metric

1.0.6 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

1.0.6 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric

1.0.6 passed this metric

No Binaries Metric

1.0.6 passed this metric

Publish Metric

1.0.6 passed this metric

Supported Platforms Metric

1.0.6 passed this metric

Testing File Metric

1.0.6 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric

1.0.6 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number