Set up Gunicorn

Create a config file

cd /srv/server/glitchtip
nano gunicorn.py
pidfile = "/srv/server/glitchtip/runtime/pid"
bind = "unix:/srv/server/glitchtip/runtime/socket"
proc_name = "glitchtip"
worker_tmp_dir = "/dev/shm"
workers = 3

Check the gunicorn docs for more options and recommendations about the amount of workers.

Create a gunicorn service

sudoedit /etc/systemd/system/glitchtip.service
[Unit]
Description=glitchtip daemon
After=network.target

[Service]
PIDFile=/srv/server/glitchtip/runtime/pidfile
EnvironmentFile=/srv/server/glitchtip/env
User=glitchtip
Group=glitchtip
RuntimeDirectory=glitchtip
WorkingDirectory=/srv/server/glitchtip/code
ExecStart=/srv/venv/glitchtip/bin/gunicorn glitchtip.wsgi --config /srv/server/glitchtip/gunicorn.py
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
Restart=always

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start glitchtip
sudo journalctl -u glitchtip
sudo systemctl enable glitchtip