# Template socket unit for borgstore REST server with Unix domain sockets. # # Using a Unix socket per repo avoids all port management: the socket path # encodes the repo name, and nginx proxies to it directly. # # Socket path: /run/borgstore/%i.sock # systemd creates the missing parent directory /run/borgstore/ (root-owned, # mode 0755, see DirectoryMode=) when it binds the socket. # # Enable for a repo: # systemctl enable --now borgstore@repo1.socket [Unit] Description=BorgStore REST socket (%i) Documentation=https://github.com/borgbackup/borgstore [Socket] ListenStream=/run/borgstore/%i.sock SocketUser=borgstore # Use the web server's group so nginx (www-data) can connect without extra # group membership changes. Adjust if your web server runs as a different user. SocketGroup=www-data SocketMode=0660 Accept=false # No RuntimeDirectory=borgstore here: /run/borgstore/ is shared by the sockets # of all instances, and systemd removes a runtime directory (with all the # sockets in it) as soon as the one instance declaring it stops. [Install] WantedBy=sockets.target