[Unit]
Description=ARA Records Ansible API with gunicorn
After=network.target

[Service]
User={{ ansible_user_id }}
RuntimeDirectory=ara-api
WorkingDirectory={{ ara_api_root_dir }}
Environment=ARA_SETTINGS={{ ara_api_settings }}
{% if ara_api_venv %}
ExecStart={{ ara_api_venv_path }}/bin/gunicorn --workers={{ ara_api_wsgi_workers }} --bind {{ ara_api_wsgi_bind }} {{ _ara_api_wsgi_application | default('ara.server.wsgi') }}
{% else %}
ExecStart=gunicorn --workers={{ ara_api_wsgi_workers }} --bind {{ ara_api_wsgi_bind }} {{ _ara_api_wsgi_application | default('ara.server.wsgi') }}
{% endif %}
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
