This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add systemd service unit example
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[Unit] | ||
Description=MailWhale | ||
StartLimitIntervalSec=400 | ||
StartLimitBurst=3 | ||
|
||
[Service] | ||
Type=simple | ||
|
||
# Assuming MailWhale executable is under /opt/mailwhale and config file at /etc | ||
# Feel free to change this | ||
WorkingDirectory=/opt/mailwhale | ||
ExecStart=/opt/mailwhale/mailwhale -config /etc/mailwhale.yml | ||
|
||
# Optionally override some config options using additional environment variables, see README for more | ||
Environment=MW_ENV=prod | ||
|
||
# sudo groupadd mailwhale | ||
# sudo useradd -g mailwhale mailwhale | ||
User=mailwhale | ||
Group=mailwhale | ||
RuntimeDirectory=mailwhale # creates /run/mailwhale | ||
|
||
Restart=on-failure | ||
RestartSec=90 | ||
|
||
# Security hardening (all optional) | ||
PrivateTmp=true | ||
PrivateUsers=true | ||
NoNewPrivileges=true | ||
ProtectSystem=full | ||
ProtectHome=true | ||
ProtectKernelTunables=true | ||
ProtectKernelModules=true | ||
ProtectKernelLogs=true | ||
ProtectControlGroups=true | ||
PrivateDevices=true | ||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE | ||
ProtectClock=true | ||
RestrictSUIDSGID=true | ||
ProtectHostname=true | ||
ProtectProc=invisible | ||
|
||
[Install] | ||
WantedBy=multi-user.target |