This implements socket activation for radicle-node by cooperating with systemd. Patch 648d8d0 is an alternative implementation without using libsystemd.
For convenience, the libsystemd crate, which implements utilities (without linking any C code) is used. It boils down to reading a few environment variables and converting them into raw file descriptors in a light wrapper.
A recording of socket activation in action, where execution of rad node status automatically starts the node: https://asciinema.org/a/R7N2N9JPvU8MMQh4LRD2FJQzW.
Note that socket activation is nothing specific to systemd. On OS X, launchd supports the same mechanism with a similar API.
The JavaScript library node-socket-activation implements socket activation for both systemd and launchd.
See also:
man:sd_listen_fds(3)- Crate
libsystemd - Crate
raunch(analogue for launchd) - https://0pointer.net/blog/projects/systemd.html
- https://0pointer.de/blog/projects/socket-activation.html
- https://0pointer.de/blog/projects/socket-activation2.html
- https://github.com/moby/moby/pull/3105
- https://github.com/sorccu/node-socket-activation
- https://mgdm.net/weblog/systemd-socket-activation/
This implements socket activation for radicle-node by cooperating with systemd. Patch 648d8d0 is an alternative implementation without using libsystemd.
For convenience, the libsystemd crate, which implements utilities (without linking any C code) is used. It boils down to reading a few environment variables and converting them into raw file descriptors in a light wrapper.
A recording of socket activation in action, where execution of rad node status automatically starts the node: https://asciinema.org/a/R7N2N9JPvU8MMQh4LRD2FJQzW.
Note that socket activation is nothing specific to systemd. On OS X, launchd supports the same mechanism with a similar API.
The JavaScript library node-socket-activation implements socket activation for both systemd and launchd.
See also:
man:sd_listen_fds(3)- Crate
libsystemd - Crate
raunch(analogue for launchd) - https://0pointer.net/blog/projects/systemd.html
- https://0pointer.de/blog/projects/socket-activation.html
- https://0pointer.de/blog/projects/socket-activation2.html
- https://github.com/moby/moby/pull/3105
- https://github.com/sorccu/node-socket-activation
- https://mgdm.net/weblog/systemd-socket-activation/
Rebase
LGTM :)