The Gearman cookbook download and compiles the Gearman Job Server onto your server. Definitions to help manage the process of starting and stopping workers and daemons. PHP extension support provided through PECL.
This cookbook has only been tested with Ubuntu 12.04. Please let me know if you tried it on a different platform with success or would like help adding support.
- apt
- build-essential
- php
By default, gearman will be compiled by source onto your machine.
Compiles the Gearman by source onto your machine.
Uses your system's package management tool to install gearman.
Installs the PECL PHP extension. PHP cookbook is required.
Include 'recipe[gearman::server]'
or 'recipe[gearman::ext_php]'
in your run_list.
default['gearman']['version'] = '1.1.5'
default['gearman']['required_packages'] = %w{ ... }
The cookbook provides a few definitions to help manage daemons and workers. At some point in the future these definitions may be refactored into lightweight resources and providers as suggested by foodcritic rule FC015.
This configures a daemon on your system by using an LSB script. The daemon command is required in order for this to work.
name
- The name you want to identify this daemon by. This should be unique.acceptable
- Integer to specify minimum acceptable client duration (seconds). Defaults to 50.output_file
- String specifying path to log to /var/log/gearman-worker.log.command
- String specifying worker command to execute.enabled
- Boolean to specify whether or not is automatically enabled. If set to true then LSB script will automatically run on system boot. Defaults to true.
Configure your system to run the gearman worker on boot:
gearman_daemon 'myapp-gworker1' do
acceptable 50
output_file '/var/log/gearman-worker.log'
command 'php /foo/bar.php'
end
This configures a worker on your system by using an LSB script.
name
- The name you want to identify this worker by. This should be unique.user
- String to specify which user this should be run as. Not typically needed, defaults to root.retries
- Number of attemps to run the job before the job server removes it. Defaults to 5.port
- Integer specifying what port number to run on. Defaults to 4730.enabled
- Boolean to specify whether or not is automatically enabled. If set to true then LSB script will automatically run on system boot. Defaults to true.
- Refactor definitions into lightweight resources and providers one day.
This cookbook is originally based off the installation procedure defined by trieu:
http://nguyentantrieu.info/blog/install-gearman-1-1-5-on-ubuntu/
- Author:: Richard Sumilang (me@richardsumilang.com)
- URL:: http://github.com/rsumilang/chef-gearman
Copyright:: 2014 Richard Sumilang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
kthxbye