Full systemd socket activation support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Fix Released
|
Undecided
|
Chris Patterson | ||
snapd |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
For the LXD snap we'd like to use socket activation, similarly to what
we do in our existing packages.
This is used to save resources on machines until LXD is actually used
and also to allow flexibility as far as the sockets (unix or tcp) that
will point to LXD.
This is all supported by systemd. Ideally we'd like to have a way to use
the following features through snapd and snapcraft:
- Support for multiple sockets triggering the same service
- Support for ListenStream (supports unix sockets, abstract unix sockets and tcp)
- Support for SocketGroup (group owner of the socket created by systemd)
- Support for SocketMode (file mode of the socket created by systemd)
I would probably recommend also adding SocketUser just for consistency.
It's the same logic as Socketgroup but sets the owning user (or uid).
The current implementation in snapd is done with two options on the app:
- socket (boolean, requires listen-stream)
- listen-stream (the systemd listen-stream string)
This should probably be changed to something more like:
sockets:
lxd-unix:
listen-stream: /run/lxd/
socket-group: lxd
socket-mode: 0660
lxd-tcp:
listen-stream: [::]:8443
That would lead to the creation of two systemd socket units, one for
each socket, using the provided options and pointing to the service unit
defined for the app.
When sockets are defined, I would expect snapd NOT to start the service
unit, leaving things up to systemd socket activation.
Systemd provides a lot more options around socket activation, but the
ones above are the most commonly used ones. The others tend to be around
less common socket types, special socket options and pre/post actions.
tags: | added: lxd |
affects: | snappy → snapd |
Changed in snapd: | |
status: | New → Confirmed |
Changed in snapd: | |
status: | Fix Committed → Fix Released |
Changed in snapcraft: | |
assignee: | nobody → Chris Patterson (cjp256) |
Changed in snapcraft: | |
status: | New → Fix Released |
I have taken this to the forums to get more eyes on, post is here https:/ /forum. snapcraft. io/t/socket- activation- support/ 2050