From 0b89b6eb8a0d8d7d69d00ce66a87c9e1de66915a Mon Sep 17 00:00:00 2001 From: "Christopher R. Nelson" Date: Sun, 1 Nov 2026 01:17:43 -0400 Subject: Build a relx release for running as a systemd service Running the daemon via `rebar3 shell` under systemd exits immediately: stdin is /dev/null, so the interactive shell reads EOF and terminates the VM. Add a relx release (with a prod profile that bundles ERTS) and document running it with `bin/xdg_pipe_menu foreground` instead. Ship a custom vm.args rather than relx's default, which sets a fixed, publicly-known cookie while distribution listens on all interfaces. The node now uses ~/.erlang.cookie, binds distribution to 127.0.0.1, and is named xdg_pipe_menu@localhost so the release script's ping / remote_console / stop can reach it even where the hostname resolves to 127.0.1.1. Co-Authored-By: Claude Opus 5.5 --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index c39385d..933c988 100644 --- a/README.md +++ b/README.md @@ -28,15 +28,21 @@ For a quick manual run (e.g. while developing): $ rebar3 shell --eval "application:ensure_all_started(xdg_pipe_menu)." -To have it start automatically with your session, add a systemd -user unit, e.g. `~/.config/systemd/user/xdg-pipe-menu.service`: +To run it as a service, build a production release (a self-contained +directory with its own copy of the Erlang runtime): + + $ rebar3 as prod release + +This produces `_build/prod/rel/xdg_pipe_menu`. Re-run the command +after pulling changes, then restart the service. To start it with +your session, add a systemd user unit, e.g. +`~/.config/systemd/user/xdg-pipe-menu.service`: [Unit] Description=XDG pipe menu daemon [Service] - WorkingDirectory=/path/to/xdg-pipe-menu - ExecStart=/usr/bin/rebar3 shell --eval "application:ensure_all_started(xdg_pipe_menu)." + ExecStart=/path/to/xdg-pipe-menu/_build/prod/rel/xdg_pipe_menu/bin/xdg_pipe_menu foreground Restart=on-failure [Install] @@ -44,6 +50,14 @@ user unit, e.g. `~/.config/systemd/user/xdg-pipe-menu.service`: then enable it with `systemctl --user enable --now xdg-pipe-menu`. +The running node is named `xdg_pipe_menu@localhost` and only accepts +Erlang distribution connections from localhost, using the cookie in +`~/.erlang.cookie` (see `config/vm.args`). That lets you manage it with +the release script: + + $ _build/prod/rel/xdg_pipe_menu/bin/xdg_pipe_menu ping + $ _build/prod/rel/xdg_pipe_menu/bin/xdg_pipe_menu remote_console + Openbox itself doesn't talk to the socket directly -- it invokes `bin/xdg_pipe_menu_menu` as the pipe menu command, which connects to the daemon's socket and prints whatever comes back (or, if the -- cgit v1.2.3