aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md22
-rw-r--r--config/vm.args10
-rw-r--r--rebar.config12
3 files changed, 40 insertions, 4 deletions
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
diff --git a/config/vm.args b/config/vm.args
new file mode 100644
index 0000000..24183d6
--- /dev/null
+++ b/config/vm.args
@@ -0,0 +1,10 @@
+## Short node name, so `bin/xdg_pipe_menu remote_console` / `stop` work.
+-sname xdg_pipe_menu@localhost
+
+## No -setcookie: fall back to the per-user random ~/.erlang.cookie
+## rather than a fixed, publicly-known cookie.
+
+## Only accept distribution connections from this machine.
+-kernel inet_dist_use_interface {127,0,0,1}
+
++C multi_time_warp
diff --git a/rebar.config b/rebar.config
index 9071343..fa60f19 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,6 +1,18 @@
{erl_opts, [debug_info]}.
{deps, [{fs, "11.4.1"}]}.
+{relx, [
+ {release, {xdg_pipe_menu, "0.1.0"}, [xdg_pipe_menu, sasl]},
+ {vm_args, "config/vm.args"},
+ {mode, dev}
+]}.
+
+{profiles, [
+ {prod, [
+ {relx, [{mode, prod}]}
+ ]}
+]}.
+
{shell, [
%% {config, "config/sys.config"},
{apps, [xdg_pipe_menu]}