From 9a02099be1b16d81ae3a63f294868992869ebb0c Mon Sep 17 00:00:00 2001 From: Derek Tamsen Date: Thu, 30 Oct 2014 13:39:47 -0700 Subject: [PATCH] adding python::gunicorn template timeout var with default of 30 sec --- README.md | 3 +++ manifests/gunicorn.pp | 7 +++++++ templates/gunicorn.erb | 2 +- tests/gunicorn.pp | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8324c54a..1a793478 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,8 @@ Manages Gunicorn virtual hosts. **osenv** - Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. Default: false +**timeout** - Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. Default: 30 + **template** - Which ERB template to use. Default: python/gunicorn.erb ```puppet @@ -188,6 +190,7 @@ Manages Gunicorn virtual hosts. environment => 'prod', appmodule => 'app:app', osenv => { 'DBHOST' => 'dbserver.example.com' }, + timeout => 30, template => 'python/gunicorn.erb', } ``` diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 1cfdc015..19f5c7ae 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -34,6 +34,11 @@ # hash of 'key': 'value' pairs. # Default: false # +# [*timeout*] +# Allows setting the gunicorn idle worker process time before being killed. +# The unit of time is seconds. +# Default: 30 +# # [*template*] # Which ERB template to use. Default: python/gunicorn.erb # @@ -50,6 +55,7 @@ # group => 'www-data', # appmodule => 'app:app', # osenv => { 'DBHOST' => 'dbserver.example.com' }, +# timeout => 30, # template => 'python/gunicorn.erb', # } # @@ -70,6 +76,7 @@ $group = 'www-data', $appmodule = 'app:app', $osenv = false, + $timeout = 30, $template = 'python/gunicorn.erb', ) { diff --git a/templates/gunicorn.erb b/templates/gunicorn.erb index 5e565c8d..a8a60f65 100644 --- a/templates/gunicorn.erb +++ b/templates/gunicorn.erb @@ -32,7 +32,7 @@ CONFIG = { '--bind=<%= @bind %>', <% end -%> '--workers=<%= @processorcount.to_i*2 %>', - '--timeout=30', + '--timeout=<%= @timeout %>', <% if @mode != 'django' -%> '<%= @appmodule %>', <% end -%> diff --git a/tests/gunicorn.pp b/tests/gunicorn.pp index 4951c386..8880b54c 100644 --- a/tests/gunicorn.pp +++ b/tests/gunicorn.pp @@ -13,5 +13,6 @@ environment => 'prod', appmodule => 'app:app', osenv => { 'DBHOST' => 'dbserver.example.com' }, + timeout => 30, template => 'python/gunicorn.erb', }