From 77f5b533a69ec8c5e31acb81c897e5c6cc89b985 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 25 Feb 2022 18:25:53 -0700 Subject: [PATCH] Add gunicorn/Django service --- systemd-service-files/gunicorn.service | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 systemd-service-files/gunicorn.service diff --git a/systemd-service-files/gunicorn.service b/systemd-service-files/gunicorn.service new file mode 100644 index 0000000..3042e3a --- /dev/null +++ b/systemd-service-files/gunicorn.service @@ -0,0 +1,23 @@ +[Unit] +# basic description of service; replace with legit description +Description=A gUnicorn service for XYZ + +[Service] +# change lowercase "user" to the user which will be running the program: this is usually the one whoes home directory the project is in +User=user +# change to where the directory of the project is +WorkingDirectory=/my/directory +# leave Type= and RemainAfterExit= alone; these specify the type of program that is being run +Type=simple +RemainAfterExit=yes +# replace "gunicorn" with output of `which uwsgi`; this command will not work the way it is +# also, replace myapp.sock with whatever your socket should be +ExecStart=gunicorn django.wsgi:application -w 2 -k uvicorn.workers.UvicornWorker +# instructions on how to kill the process +ExecStop=/bin/kill -HUP $MAINPID +# if process dies, should you restart it? leave it as always to auto restart +Restart=always + +[Install] +# WantedBy=multi-user.target allows it to be enabled with systemctl to start on boot +WantedBy=multi-user.target