summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-06-03 19:18:04 +0200
committerRory& <root@rory.gay>2025-06-03 19:18:04 +0200
commit0a51758df8c74fd65b449230e8ec214b0b58ef8c (patch)
tree6a243d9b89dc9534a3c0a73e47704f52754c53ad
parentClean up pointless error handling, coerce booleans to string in nix (diff)
downloadnodejs-final-assignment-0a51758df8c74fd65b449230e8ec214b0b58ef8c.tar.xz
Add systemd example
-rw-r--r--DEPLOY.md2
-rw-r--r--doc/systemd.service30
2 files changed, 31 insertions, 1 deletions
diff --git a/DEPLOY.md b/DEPLOY.md

index 63f89c5..302edaa 100644 --- a/DEPLOY.md +++ b/DEPLOY.md
@@ -29,7 +29,7 @@ services.safeNSound = { ## Other Linux distros: Please see your service manager: -- systemd (Debian, Arch, Fedora, ...): /etc/systemd/system/SafeNSound.service (see [example]()) +- systemd (Debian, Arch, Fedora, ...): /etc/systemd/system/SafeNSound.service (see [example](https://cgit.rory.gay/school/nodejs-final-assignment.git/tree/doc/systemd.service)) - sysvinit/openrc/... (Alpine, Gentoo, Devuan, ...): /etc/init.d/SafeNSound ## General setup considerations: diff --git a/doc/systemd.service b/doc/systemd.service new file mode 100644
index 0000000..37a98ca --- /dev/null +++ b/doc/systemd.service
@@ -0,0 +1,30 @@ +[Unit] +After=network.target mongodb.service +Description=SafeNSound Service +Requires=mongodb.service + +[Service] +Environment="DATABASE_SECRET_PATH=/run/credentials/safensound.service/mongodb" +Environment="JWT_SECRET_PATH=/var/lib/SafeNSound" +Environment="LOG_AUTH=true" +Environment="LOG_QUERIES=true" +Environment="LOG_REQUESTS=-" +Environment="PORT=7645" +DynamicUser=true +ExecStart=/usr/bin/env node /opt/SafeNSound +LoadCredential=mongodb:/data/secrets/safensound-mongodb +NoNewPrivileges=true +PrivateDevices=true +PrivateTmp=true +ProtectHome=true +ProtectSystem=strict +Restart=always +StartLimitBurst=600 +StartLimitIntervalSec=60 +StateDirectory=SafeNSound +StateDirectoryMode=0700 +Type=simple +WorkingDirectory=/var/lib/SafeNSound + +[Install] +WantedBy=multi-user.target