| 1 |
# Template socket unit for borgstore REST server with Unix domain sockets. |
| 2 |
# |
| 3 |
# Using a Unix socket per repo avoids all port management: the socket path |
| 4 |
# encodes the repo name, and nginx proxies to it directly. |
| 5 |
# |
| 6 |
# Socket path: /run/borgstore/%i.sock |
| 7 |
# systemd creates the missing parent directory /run/borgstore/ (root-owned, |
| 8 |
# mode 0755, see DirectoryMode=) when it binds the socket. |
| 9 |
# |
| 10 |
# Enable for a repo: |
| 11 |
# systemctl enable --now [email protected] |
| 12 |
|
| 13 |
[Unit] |
| 14 |
Description=BorgStore REST socket (%i) |
| 15 |
Documentation=https://github.com/borgbackup/borgstore |
| 16 |
|
| 17 |
[Socket] |
| 18 |
ListenStream=/run/borgstore/%i.sock |
| 19 |
SocketUser=borgstore |
| 20 |
# Use the web server's group so nginx (www-data) can connect without extra |
| 21 |
# group membership changes. Adjust if your web server runs as a different user. |
| 22 |
SocketGroup=www-data |
| 23 |
SocketMode=0660 |
| 24 |
Accept=false |
| 25 |
# No RuntimeDirectory=borgstore here: /run/borgstore/ is shared by the sockets |
| 26 |
# of all instances, and systemd removes a runtime directory (with all the |
| 27 |
# sockets in it) as soon as the one instance declaring it stops. |
| 28 |
|
| 29 |
[Install] |
| 30 |
WantedBy=sockets.target |