Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

wallgig/chef-puma

Repository files navigation

Puma Build Status

Chef cookbook for the puma server.

Requirements

Chef

Tested on chef 11

Cookbooks

The following cookbooks are required:

Platforms

  • Debian 7+
  • Ubuntu 13.10+

Resources/Providers

puma_config

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.

Actions

  • :create create a named puma configuration, and service.
  • :delete disable a named puma service, and deletes the puma directory.

Examples

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

Attributes

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

Attributes

See the attributes/default.rb for default values.

  • node['puma']['version'] - Version of puma to install
  • node['puma']['bundler_version'] - Version to bundler to install
  • node['puma']['rubygems_location'] - The location to your gem binary.

Issues

Find a bug? Want a feature? Submit an issue here. Patches welcome!

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

LICENSE & AUTHORS

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.