cookbook 'gunicorn', '~> 2.0.0'
The gunicorn cookbook has been deprecated
Author provided reason for deprecation:
The gunicorn cookbook has been deprecated and is no longer being maintained by its authors. Use of the gunicorn cookbook is no longer recommended.
gunicorn (9) Versions 2.0.0 Follow18
Installs/Configures Gunicorn
cookbook 'gunicorn', '~> 2.0.0', :supermarket
knife supermarket install gunicorn
knife supermarket download gunicorn
gunicorn Cookbook
Installs and configures the latest version of Gunicorn (via pip), aka Green Unicorn
, a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model ported from Ruby's Unicorn project. Includes an LWRP for managing Gunicorn config files. By default Gunicorn is installed system-wide but you can target a particular virtualenv
by overriding the node["gunicorn"]["virtualenv"]
attribute.
Requirements
Platforms
- Debian/Ubuntu
- RHEL/CentOS/Scientific/Amazon/Oracle
Chef
- Chef 12.1+
Cookbooks
- python
Attributes
-
node["gunicorn"]["virtualenv"]
- the virtualenv you want to target Gunicorn installation into. The virtualenv will be created if it doesn't exist.
Resource/Provider
This cookbook includes LWRPs for managing gunicorn config files.
gunicorn_config
Creates a Gunicorn configuration file at the path specified. Meant to be deployed with a service init scheme/supervisor such as runit. Please see the appliation::gunicorn
recipe for a complete working example. In depth information about Gunicorn's configuration values can be found in the Gunicorn documentation.
Actions
- :create: create a Gunicorn configuration file.
- :delete: delete an existing Gunicorn configuration file.
Attribute Parameters
- path: name attribute. The path where the configuration file will be created
- template: template to use when rendering the configuration file. default is
gunicorn.py.erb
(part of this cookbook) - cookbook: cookbook to look for template file in. default is this cookbook
gunicorn
- listen: the socket to bind to. A string of the form: 'HOST', 'HOST:PORT', 'unix:PATH'. default is
0.0.0.0:8000
or listen on port 8000 on all interfaces - backlog: The maximum number of pending connections. default is
2048
- preload_app: Whether application code should be loaded before the worker processes are forked. default is
false
- worker_processes: The number of worker process for handling requests. default is
4
- worker_class: The type of workers to use. default is
sync
- worker_timeout: The number of seconds to wait before a worker is killed and restarted. default is
60
- worker_keepalive: The number of seconds to wait for requests on a Keep-Alive connection. default is
2
- worker_max_requests: The maximum number of requests a worker will process before restarting. default is
0
or restarts disabled - server_hooks: A hash with whose values will be rendered as a Gunicorn server hook callables (functions) named after the hash item's key name. default is
{}
or no serves hooks - owner: The owner for the configuration file.
- group: The group owner of the configuration file (string or id).
- pid: A filename to use for the PID file. default is no pidfile
- accesslog: The access log file to write to.
- access_log_format: The access log format.
- errorlog: The error log file to write to.
- loglevel: The granularity of error log outputs.
- logger_class: The logger you want to use to log events in gunicorn.
- logconfig: The log config file to use.
- secure_scheme_headers: A hash containing headers and values that the front-end proxy uses to indicate HTTPS requests.
- forwarded_allow_ips: Front-end's IPs from which allowed to handle set secure headers. (comma separate).
- proc_name: A base to use with setproctitle for process naming.
Example
# create a config with the default values
gunicorn_config "/etc/gunicorn/myapp.py" do
action :create
end
# tweak some worker related values...we're web scale baby
gunicorn_config "/etc/gunicorn/myapp.py" do
worker_processes 8
backlog 4096
action :create
end
# use the 'pre_fork' server hook to
# sleep for a second before forking
gunicorn_config "/etc/gunicorn/myapp.py" do
server_hooks({:pre_fork => 'import time;time.sleep(1)'})
action :create
end
Usage
Simply include the recipe where you want Gunicorn installed.
License & Authors
Author: Cookbook Engineering Team (cookbooks@chef.io)
Copyright: 2011-2016, Chef Software, Inc.
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.
gunicorn Cookbook CHANGELOG
This file is used to list changes made in each version of the gunicorn cookbook.
2.0.0 (2016-09-16)
- Fix doc link in the readme
- Resolve rubocop and foodcritic warnings
- Testing updates
- Require Chef 12.1+
v1.2.1 (2015-10-20)
- Added source_url and issues_url to the metadata
- Updated gitignore file
- Add Test Kitchen config
- Added chefignore file
- Added Chef standard rubocop config
- Added Travis CI testing
- Updated Gemfile with the latest testing deps
- Updated testing and contributing docs
- Added maintainers.md and maintainers.toml files
- Added travis and cookbook version badges to the readme
- Resolved Rubocop and Foodcritic warnings
- Updated Opscode -> Chef Software
- Added supported platforms to the metadata
- Updated Chefspec to 4.X format
v1.2.0 (2014-09-18)
- [#11] Added ChefSpec matchers, Berksfile and Gemfile for testing dependencies
v1.1.6 (2014-06-24)
- Removes smart quotes to prevent Encoding::InvalidByteSequenceError errors.
v1.1.4 (2014-05-28)
- [COOK-4530] in gunicorn config lwrp enable options for secure headers and proc-name
v1.1.2
Improvement
- COOK-3313** - Add attributes for Gunicorn's log settings
Bug
-
COOK-3019** - Fix server hook name (
start_server
->when_ready
)
v1.1.0
- [COOK-1188] - add LWRP for reusability
- [COOK-1207] - add missing service hooks
- [COOK-1431] - resolve foodcritic warnings
- [COOK-1486] - add missing call to super
v1.0.0
- Current/initial release
Collaborator Number Metric
2.0.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
2.0.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
2.0.0 failed this metric
FC074: LWRP should use DSL to define resource's default action: gunicorn/resources/config.rb:1
FC074: LWRP should use DSL to define resource's default action: gunicorn/resources/install.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/config.rb:49
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/config.rb:57
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/install.rb:33
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
2.0.0 passed this metric
Testing File Metric
2.0.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
2.0.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 include a tag that matches this cookbook version number
2.0.0 failed this metric
2.0.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
2.0.0 failed this metric
FC074: LWRP should use DSL to define resource's default action: gunicorn/resources/config.rb:1
FC074: LWRP should use DSL to define resource's default action: gunicorn/resources/install.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/config.rb:49
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/config.rb:57
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/install.rb:33
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
2.0.0 passed this metric
Testing File Metric
2.0.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
2.0.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 include a tag that matches this cookbook version number
2.0.0 failed this metric
FC074: LWRP should use DSL to define resource's default action: gunicorn/resources/install.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/config.rb:49
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/config.rb:57
FC085: Resource using new_resource.updated_by_last_action to converge resource: gunicorn/providers/install.rb:33
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
2.0.0 passed this metric
Testing File Metric
2.0.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
2.0.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 include a tag that matches this cookbook version number
2.0.0 failed this metric
2.0.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 include a tag that matches this cookbook version number