From 0954c6520878e073c7822fc4a8f4a752474f5d7a Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 29 May 2026 12:23:30 +0900 Subject: fix(packaging): convert dispatch-systemd from user units to system template units (User=%i) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-user systemd manager (user@UID.service) fails to start on WSL (kernel 6.6.87.2, microsoft/WSL#13186 — 'Failed to spawn executor: Device or resource busy'), which breaks pacman's 30-systemd-daemon-reload-user.hook on install. Changes: - New dispatch-api@.service + dispatch-frontend@.service system template units with User=%i (run as the named instance user) - Remove old user-scope dispatch-api.service / dispatch-frontend.service - Install to /usr/lib/systemd/system/ instead of .../systemd/user/ - Update PKGBUILD, .install hints, and bin/service to use sudo systemctl dispatch-api@ --- packaging/dispatch-api@.service | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packaging/dispatch-api@.service (limited to 'packaging/dispatch-api@.service') diff --git a/packaging/dispatch-api@.service b/packaging/dispatch-api@.service new file mode 100644 index 0000000..3449fcb --- /dev/null +++ b/packaging/dispatch-api@.service @@ -0,0 +1,21 @@ +# Dispatch API — system service template. +# Runs under the system manager (PID 1) but drops privileges to the user named +# in the instance: `dispatch-api@tradam` runs as the `tradam` user. +# +# Enable/start: +# sudo systemctl enable --now dispatch-api@ +[Unit] +Description=Dispatch API Backend (running as %i) +After=network.target + +[Service] +Type=simple +User=%i +WorkingDirectory=/opt/dispatch +ExecStart=/usr/bin/bun packages/api/src/index.ts +EnvironmentFile=-/etc/dispatch/dispatch-api.conf +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3