Skip to content

Instantly share code, notes, and snippets.

@lbehm
Created June 7, 2022 20:26
Show Gist options
  • Save lbehm/79075e023700fbf0f51604fab8f6c684 to your computer and use it in GitHub Desktop.
Save lbehm/79075e023700fbf0f51604fab8f6c684 to your computer and use it in GitHub Desktop.
postgrest systemd scripts
[Unit]
Description=REST API for any Postgres database
After=postgresql.target network.target
Documentation=https://postgrest.org/en/stable/
[Service]
Type=exec
ExecStart=/usr/bin/postgrest /etc/postgrest/%i.conf
ExecStop=/bin/kill -s HUP $MAINPID
ExecReload=/bin/kill -s SIGUSR2 $MAINPID
TimeoutStopSec=0
Restart=always
UMask=007
PrivateTmp=yes
LimitNOFILE=65535
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
NoNewPrivileges=true
CapabilityBoundingSet=
MemoryDenyWriteExecute=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
ProtectSystem=full
DynamicUser=yes
ConfigurationDirectory=postgrest
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment