diff --git a/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 b/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 new file mode 100644 index 0000000000000000000000000000000000000000..7d22006393d5ee7e40c9c0f87cf1958264042469 --- /dev/null +++ b/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 @@ -0,0 +1,17 @@ +[Unit] +Description=Website {{ fqdn }} +Requires={{ fqdn }}.socket +After=network.target + +[Service] +User={{ user }} +Group={{ user }} +WorkingDirectory={{ home }}/code +ExecStart={{ home }}/virtualenv/bin/gunicorn --bind unix:/run/wsgi/{{ fqdn }}.sock {% if use_paste %}--paste {{home}}/code/{{ wsgi_application }}{% else %}{{ wsgi_application }}{% endif %} + +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s TERM $MAINPID +PrivateTmp=true + +[Install] +WantedBy=multi-user.target \ No newline at end of file