diff --git a/deploy/crushdb.service b/deploy/crushdb.service new file mode 100644 index 0000000..c6f28a4 --- /dev/null +++ b/deploy/crushdb.service @@ -0,0 +1,41 @@ +# crushdb systemd unit +# +# Installieren (als root): +# cp deploy/crushdb.service /etc/systemd/system/ +# systemctl daemon-reload +# systemctl enable --now crushdb +# +# Die App lauscht auf http://127.0.0.1:PORT (siehe Environment unten) +# und lebt für einen vertrauenswürdigen Reverse Proxy (nginx/caddy). + +[Unit] +Description=crushdb – encrypted record database (Flask) +After=network.target + +[Service] +Type=simple +# Pfade anpassen, wo dieses Repo liegt: +User=jonas +Group=jonas +WorkingDirectory=/srv/crushdb +ExecStart=/srv/crushdb/venv/bin/python /srv/crushdb/run.py +Environment=HOST=127.0.0.1 +Environment=PORT=5000 + +Restart=on-failure +RestartSec=3 + +# Hardening: nur das nötigste erlauben +NoNewPrivileges=yes +PrivateTmp=yes +ProtectSystem=strict +ReadWritePaths=/srv/crushdb/instance +ProtectHome=yes +ProtectKernelTunables=yes +ProtectControlGroups=yes +RestrictSUIDSGID=yes +CapabilityBoundingSet= +RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX + +[Install] +WantedBy=multi-user.target