diff options
| author | Adam Malczewski <[email protected]> | 2026-05-22 16:19:35 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-22 16:19:35 +0900 |
| commit | 45a4890031192f4e7409443f98e824dad17ba175 (patch) | |
| tree | a28e1b0618f682476b0b57ba70e8ba26a1939a49 /packaging/dispatch-api-wrapper.sh | |
| parent | 9ecaabd87c0e51b8a7408dabb0133a9344586859 (diff) | |
| download | dispatch-45a4890031192f4e7409443f98e824dad17ba175.tar.gz dispatch-45a4890031192f4e7409443f98e824dad17ba175.zip | |
feat: Arch Linux packaging with Electron frontend, systemd backend service, and Windows exe build
- Add Electron wrapper (main.cjs, preload.cjs) for desktop frontend
- Add systemd service unit, env config, and sysusers for backend API
- Add PKGBUILD and .install for Arch package (makepkg -si)
- Add desktop entry, SVG/PNG icon, and wrapper scripts
- Add bin/build-pkg, bin/install-pkg, bin/windows-pkg scripts
- Make API port configurable via PORT env var (default 3000, prod 18390)
- Add electron-builder config for Windows exe cross-compilation
- Set vite base to './' for Electron file:// loading
Diffstat (limited to 'packaging/dispatch-api-wrapper.sh')
| -rwxr-xr-x | packaging/dispatch-api-wrapper.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/packaging/dispatch-api-wrapper.sh b/packaging/dispatch-api-wrapper.sh new file mode 100755 index 0000000..d8c656b --- /dev/null +++ b/packaging/dispatch-api-wrapper.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# dispatch-api-wrapper.sh +# Wrapper script for running the Dispatch API outside of systemd. +# Install to /usr/bin/dispatch-api (chmod 755). +# +# Usage: +# dispatch-api # runs the server, inheriting the current environment +# dispatch-api --help # passes flags through to bun + +set -euo pipefail + +DISPATCH_CONF="/etc/dispatch/dispatch-api.conf" +DISPATCH_DIR="/opt/dispatch" +BUN="/usr/bin/bun" +ENTRY_POINT="packages/api/src/index.ts" + +# Source the environment file if it exists +if [[ -f "$DISPATCH_CONF" ]]; then + # Export every variable defined in the conf file so child processes see them. + # Lines starting with '#' and blank lines are skipped automatically by bash's + # 'source' builtin. + set -o allexport + # shellcheck source=/etc/dispatch/dispatch-api.conf + source "$DISPATCH_CONF" + set +o allexport +fi + +# Change to the application directory +cd "$DISPATCH_DIR" + +# Hand off to bun — exec replaces this process so signals are forwarded correctly +exec "$BUN" "$ENTRY_POINT" "$@" |
