| 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 | # RuntimeDirectory= below ensures /run/borgstore/ exists before the socket |
| 8 | # is created (required because the socket unit starts before the service unit). |
| 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 | # Create /run/borgstore/ before binding the socket. |
| 26 | # This must be here (not only in the service unit) because the socket |
| 27 | # unit starts before the service unit activates. |
| 28 | RuntimeDirectory=borgstore |
| 29 | RuntimeDirectoryMode=0755 |
| 30 | |
| 31 | [Install] |
| 32 | WantedBy=sockets.target |