# {{ ansible_managed }}

description "Analytics gunicorn"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
respawn limit 3 30

env SERVICE_VARIANT={{ analytics_service_variant }}
env PID=/var/tmp/analytics.pid
env WORKERS={{ ANALYTICS_WORKERS }}
env PORT={{ ANALYTICS_SERVER_PORT }}
env LANG={{ ANALYTICS_ENV_LANG }}
env DJANGO_SETTINGS_MODULE={{ analytics_django_settings }}

chdir {{ analytics_code_dir }}
setuid {{ analytics_web_user }}

exec {{ analytics_venv_dir }}/bin/gunicorn -b 0.0.0.0:$PORT -w $WORKERS --pythonpath={{ analytics_code_dir }}/anserv anserv.wsgi
