forked from voxpupuli/puppet-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgunicorn.conf.erb
More file actions
43 lines (37 loc) · 1.92 KB
/
gunicorn.conf.erb
File metadata and controls
43 lines (37 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# gunicorn
description "gunicorn server"
author "Calen Pennington <cpennington@mitx.mit.edu>"
<% if scope.lookupvar('stacked') == false -%>
start on runlevel [2345]
stop on runlevel [!2345]
<% else -%>
start on started edxapp
stop on stopped edxapp
<% end -%>
respawn
<% if scope.lookupvar('respawn_limit') != false -%>
respawn limit 3 30
<% end -%>
env PID=/var/tmp/<%= name %>.pid
env NEW_RELIC_CONFIG_FILE=<%= scope.lookupvar('base') %>/newrelic.ini
env NEWRELIC=<%= scope.lookupvar('virtualenv') %>/bin/newrelic-admin
<% if scope.lookupvar('workers') -%>
env WORKERS=<%= scope.lookupvar('workers') %>
<% else -%>
env WORKERS=<%= 4 * scope.lookupvar('::processorcount').to_i %>
<% end -%>
env PORT=<%= scope.lookupvar('port') %>
env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=<%= scope.lookupvar('settings_module') %>
env SERVICE_VARIANT="<%= scope.lookupvar('title') %>"
chdir <%= scope.lookupvar('package_root') %>
<% if scope.lookupvar('app_interface') != 'python' -%>
setuid <%= scope.lookupvar('user') %>
<% end -%>
<% case scope.lookupvar('app_interface') when 'django' -%>
exec <% if scope.lookupvar('edx::newrelic::reporting') == true -%>$NEWRELIC run-program <% end -%><%= scope.lookupvar('virtualenv') %>/bin/gunicorn_django -b 127.0.0.1:$PORT -w $WORKERS --timeout=<%= scope.lookupvar('timeout') %> --pythonpath=<%= scope.lookupvar('package_root') %> --settings=<%= scope.lookupvar('settings_module') %>
<% when 'wsgi' -%>
exec <% if scope.lookupvar('edx::newrelic::reporting') == true -%>$NEWRELIC run-program <% end -%><%= scope.lookupvar('virtualenv') %>/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=<%= scope.lookupvar('timeout') %> --pythonpath=<%= scope.lookupvar('package_root') %> <%= scope.lookupvar('wsgi_app') %>
<% when 'python' -%>
exec su - www-data -c '<%= scope.lookupvar('virtualenv') %>/bin/python <%= scope.lookupvar('package_root') %>/<%= scope.lookupvar('script_name') %> >/dev/null 1>&1'
<% end -%>