Chef cookbook for the puma server.
Tested on chef 11
The following cookbooks are required:
- Debian 7+
- Ubuntu 13.10+
This generates a puma configuration and creates a runit service. This cookbooks expects that you are deploying with capistrano, but should be flexible enough to tune for whatever you need.
- :create create a named puma configuration, and service.
- :delete disable a named puma service, and deletes the puma directory.
puma_config "app" do
puma_config "app" do
directory "/srv/www"
environment 'staging'
thread_min 0
thread_max 16
workers 2
end
puma_config 'app' do
action :delete
end
Attribute | Description | Default Value |
---|---|---|
name | Name attribute: The name of the puma instance. | nil |
rackup | Rack file | config.ru |
environment | Rails environment | production |
daemonize | Wether or not to daemonize puma. Setting this to true will break runit. | false |
output_append | Append log output | false |
quiet | Verbosity level of the puma daemon | false |
thread_min | Minimum start threads | 0 |
thread_max | Maximum number of threads | 16 |
activate_control_app | Enables the puma control socket | true |
workers | The number of puma workers | 0 |
worker_timeout | Timeout for puma workers in seconds | 30 |
preload_app | Should puma preload your application | true |
prune_bundler | Allow workers to reload bundler context when master process is issued a USR1 signal. Needs preload_app to be false. | false |
on_worker_boot | Ruby code to run when a worker boots | nil |
tag | Additional text to display in the process list | nil |
bundle_exec | Should bundle exec be used to start puma | true |
logrotate | Enables log rotation with logrotate | true |
phased_restarts | Enables phased restarts. This requires you to disable preload_app. | false |
restart_interval | The minimum delay in second between automatic restarts | 30 |
restart_count | The maximum number of automatic restarts allowed | 3 |
clear_interval | Reset the restart count if `clear_interval` seconds have elapsed since the last automatic restart | 300 |
owner | The user puma is run as | www-data |
group | The group puma is run as | www-data |
See the attributes/default.rb
for default values.
node['puma']['version']
- Version of puma to installnode['puma']['bundler_version']
- Version to bundler to installnode['puma']['rubygems_location']
- The location to yourgem
binary.
Find a bug? Want a feature? Submit an issue here. Patches welcome!
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
- Authors:: Greg Fitzgerald (greg@gregf.org)
- Authors:: Yousef Ourabi
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.