From 8582daf4c0eeec30b23768d1cf57ba2a002aeb82 Mon Sep 17 00:00:00 2001 From: Piotr Dec Date: Tue, 7 Apr 2026 22:51:51 +0200 Subject: [PATCH] feat: systemd service file --- systemd/karl.service | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 systemd/karl.service diff --git a/systemd/karl.service b/systemd/karl.service new file mode 100644 index 0000000..9767b65 --- /dev/null +++ b/systemd/karl.service @@ -0,0 +1,34 @@ +[Unit] +Description=Karl +After=network.target +Wants=network.target +StartLimitBurst=3 +StartLimitIntervalSec=60 + +[Service] +User=karl +WorkingDirectory=/home/karl/app +ExecStart=/home/karl/app/venv/bin/gunicorn \ + -c /home/karl/app/gunicorn.conf.py \ + app.main:app + +# Graceful reload (sends SIGHUP) +ExecReload=/bin/kill -s HUP $MAINPID + +# Restart on failure +Restart=on-failure +RestartSec=5s + +# Security hardening +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ReadWritePaths=/var/log/karl /tmp + +# Logging +StandardOutput=journal +StandardError=journal +SyslogIdentifier=karl + +[Install] +WantedBy=multi-user.target