cookbook 'serf', '= 1.1.0'
serf (16) Versions 1.1.0 Follow5
Installs/Configures serf
cookbook 'serf', '= 1.1.0', :supermarket
knife supermarket install serf
knife supermarket download serf
Serf Cookbook
Installs and configures Serf.
View the Change Log to see what has changed.
Supports
- Serf >= 0.3 (uses config reloading via SIGHUP)
- Linux OS'es
Usage
Using the default attributes will setup a single Serf agent in its own cluster.
If you already have a Serf agent (or cluster) running specify the array of address(es) with the
node["serf"]["agent"]["start_join"]
attribute so the agent will join the cluster(s).
What does the installation look like
By default the installation will look like,
serf | /usr/bin/serf - The serf binary command
/opt/serf/* - All of serf's files (config, binaries, event handlers, logs...)
/etc/serf/* - Link to all of serf's config files
/var/log/serf/* - Link to all of serf's log files
/etc/init.d/serf - An init.d script to start/stop the agent. You can use service
serf [start|stop|restart|status] instead
Event Handlers
An event handler is a script that is run when the Serf agent
recieves an event (member-join, member-leave, member-failed, or user).
You can configure an event handler via the attribute node["serf"]["event_handlers"]
. The format of the event_handlers
attribute is the following,
[
{
"url" : "URL", # REQUIRED
"event_type" : "EVENT_TYPE" #OPTIONAL
},
...
]
Chef will download the event handler and ensure it stays up to date. It will also add it to the serf agent's list of event handlers.
Each event handler must have a unique name.
The event_type
value filters the event handler for certain events. Use this doc
to figure out the event_type
you need.
It is also possible to add event handlers via the attribute node["serf"]["agent"]["event_handlers"]
. The node["serf"]["event_handlers"]
helps with the deployment of the event handler file itself and will add the event handler to the node["serf"]["agent"]["event_handlers"]
attribute.
Resources and Providers
serf_event
The serf_event
LWRP resource dispatches a custom user event into a Serf cluster by executing serf CLI.
Actions
- :create: Executes serf cli with parameters required to send an event.
Attribute Parameters
- event_name: name attribute. The name of the event to send
- payload: Optional event's payload. Any string you want.
- coalesce: Coalesce option.
true
by default - rpc_addr: Address of serf node to connect for event dispatching. Local node by default.
- rpc_auth: RPC auth token. If not set,
node['serf']['agent']['rpc_auth']
will be used.
Example
Send custom user event
serf_event 'deploy' do payload '1234567890' rpc_auth 'secret' end
It would look like this in serf log:
2014/07/08 22:53:07 [INFO] agent: Received event: user-event: deploy
Event Info:
Coalesce: true
Event: "user"
LTime: 7
Name: "deploy"
Payload: []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30}
Attributes
-
node["serf"]["user"]
: The user that owns the serf installation (default="serf") -
node["serf"]["group"]
: The group that owns the serf installation (default="serf") -
node["serf"]["agent"][*]
: A hash of key/values that will be added to the agent's config file (default={}). Use this doc to configure the agent. -
node["serf"]["event_handlers"]
: An array of hashes that represent event handlers. See 'Event Handlers' above for more details (default=[]) -
node["serf"]["base_binary_url"]
: The base url used to download the binary zip (default="https://dl.bintray.com/mitchellh/serf/") -
node["serf"]["version"]
: The version of the Serf agent to install (default="0.3.0") -
node["serf"]["arch"]
: The architecture of the Serf agent to install (default=kernel['machine'] =~ /x86_64/ ? "amd64" : "386"
) -
node["serf"]["binary_url"]
: The full binary url of the Serf agent. If you override this value make sure to provide a valid and up to date value fornode["serf"]["version"]
(default=File.join node["serf"]["base_binary_url"], "#{node["serf"]["version"]}_linux_#{node["serf"]["arch"]}.zip"
) -
node["serf"]["base_directory"]
: The base directory Serf should be installed into (default="/opt/serf") -
node["serf"]["log_directory"]
: The directory of the Serf agent logs (default="/var/log/serf") -
node["serf"]["conf_directory"]
: The directory of the Serf agent config (default="/etc/serf") -
node["serf"]["on_config_change"]
: An action to be performed if config is changed (default=:reload) -
node["serf"]["init_info"]
: A hash of init information used by the init service script (see attributes file for defaults)
Dependent cookbooks
logrotate >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Change Log
1.1.0 - 04-06-2016
- [Enhancement] Issue-33 : Initialize SerfHelper Differently to Avoid compat_resource Cookbook Conflict
1.0.0 - 02-09-2016
- [Enhancement] Issue-32 : Updates serf download url to official repo
0.9.0 - 04-23-2015
- [Enhancement] Issue-31 : Refactoring
0.8.0 - 02-10-2015
- [Enhancement] Issue-30 : serf doesn't start on CentOS 7 with dhcp
- [Enhancement] Issue-10 : Add tests
0.7.1 - 08-21-2014
- [Bug] Issue-29 : PaxHeader folder in 0.7.0 release
0.7.0 - 07-30-2014
- [Enhancement] Issue-28 : Get action to perform on config change from attributes
0.6.0 - 07-08-2014
- [Feature] Issue-27 : Feature/event
0.5.0 - 03-30-2014
- [Enhancement] Issue-23 : Adding support for chkconfig.
- [Enhancement] Issue-22 : Version normalization
- [Enhancement] Issue-19 : Prettify serf agent json (humans too read configuration files).
0.4.2 - 02-15-2014
0.4.1 - 01-22-2014
- [Bug] Issue-18 : Reload serf agent with "kill -HUP" instead of broken "kill -SIGHUP".
- [Bug] Issue-17 : Fixed logging of serf agent messages when /bin/sh is not a symlinked bash.
0.4.0 - 01-22-2014
- [Feature] Issue-12 : Provide ability to reload configuration without restart
0.3.0 - 01-22-2014
- [Bug] Issue-14 : Init script broken on ubuntu (regression)
- [Enhancement] Issue-11 : Create serf user that owns installation
0.2.1 - 01-22-2014
- [Bug] Issue-15 : /var/log/serf and /etc/serf link to files
0.2.0 - 01-22-2014
- [Bug] Issue-7 : Repair working init script on ubuntu :)
- [Bug] Issue-6 : fix init script to allow multiple join addresses
- [Enhancement] Issue-5 : Use kill -INT [PID] to gracefully shutdown agent
- [Enhancement] Issue-4 : Update README with information about where things live, services, logs
- [Enhancement] Issue-1 : Move configuration out of init.d to file
0.1.0 - 01-22-2014
- [Feature] Issue-16 : Initial cookbook
Collaborator Number Metric
1.1.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.1.0 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.1.0 passed this metric
License Metric
1.1.0 failed this metric
serf does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
1.1.0 passed this metric
Testing File Metric
1.1.0 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.1.0 passed this metric
1.1.0 failed this metric
1.1.0 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.1.0 passed this metric
License Metric
1.1.0 failed this metric
serf does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
1.1.0 passed this metric
Testing File Metric
1.1.0 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.1.0 passed this metric
1.1.0 passed this metric
1.1.0 failed this metric
serf does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
1.1.0 passed this metric
Testing File Metric
1.1.0 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.1.0 passed this metric
1.1.0 passed this metric
1.1.0 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.1.0 passed this metric
1.1.0 passed this metric