summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-08-21 17:02:08 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-08-21 17:06:14 +0200
commitf146f24c652b130451e2e06ad10b84c2a7c704f2 (patch)
treeea3f7c56552f20c511cd5aded83af4f8462e65fb /templates
parent1d286bd2dce540fca7957ff7c9c7bbda20f5dca1 (diff)
CGI: Propagate stops from PostgreSQL.
Diffstat (limited to 'templates')
-rw-r--r--templates/etc/systemd/system/webmap-cgi.service37
1 files changed, 37 insertions, 0 deletions
diff --git a/templates/etc/systemd/system/webmap-cgi.service b/templates/etc/systemd/system/webmap-cgi.service
new file mode 100644
index 0000000..146a5ed
--- /dev/null
+++ b/templates/etc/systemd/system/webmap-cgi.service
@@ -0,0 +1,37 @@
+[Unit]
+Description=Webmap CGI (Common Gateway Interface)
+After=syslog.target network.target postgresql.service
+StopPropagatedFrom=postgresql.service postgresql@{{ postgresql.version }}-{{ postgresql.cluster }}.service
+
+[Service]
+DynamicUser=yes
+User=_webmap-cgi
+# Note: the "WARNING: you have enabled harakiri without post buffering" can
+# be ignored because body requests are in fact buffered on the nginx side
+ExecStart=/usr/bin/uwsgi -M -p2 \
+ --single-interpreter --die-on-term \
+ --close-on-exec --close-on-exec2 \
+ --max-requests 1000 \
+ --max-worker-lifetime 86400 \
+ --max-worker-lifetime-delta 11 \
+ --harakiri 60 \
+ --lazy-apps \
+ --plugins python3 \
+ --pythonpath /usr/local/share/webmap \
+ --wsgi-file /usr/libexec/webmap-cgi
+Nice=10
+RestartSec=15s
+Restart=always
+
+# Hardening
+NoNewPrivileges=yes
+ProtectHome=yes
+ProtectSystem=strict
+PrivateDevices=yes
+ProtectControlGroups=yes
+ProtectKernelModules=yes
+ProtectKernelTunables=yes
+RestrictAddressFamilies=AF_UNIX
+
+[Install]
+WantedBy=multi-user.target