snapframework/snap

Socket activation

hsenag opened this issue · 5 comments

I'd like to use socket activation with snap. This basically amounts to exposing an API from snap that accepts a socket directly rather than creating its own.

Would a patch to do this be accepted? If so, any hints on the preferred approach? My initial idea is to add a new case to the ListenPort type.

Hi Ganesh,

This is already on the radar (it's a feature I want as well) and will definitely be possible in snap 1.0, as we are changing how the server is started and I'm going to make sure that you can pass already-bound sockets into the server accept loop. I don't really want to backport a change like this to the snap 0.9 stable branch because we are very close to launching 1.0 and I don't want to waste the effort.

There are two possibilities for integrating this, what do you think?

  • a separate snap-systemd project that would provide config hooks for starting up a server with socket activation
  • support systemd out of the box when arch(linux) --- this has the downside of assuming the presence of systemd libraries, which can only be safely assumed ~18mos from now. Unless it's easy to support socket activation without linking to the systemd C api?

Great, thanks! Any idea on timescales for 1.0?

I was planning on using https://hackage.haskell.org/package/socket-activation for handling the C api.

For myself, I'd prefer the "pass a socket in" API so that I can keep the application (darcsden) in control of dealing with the received sockets and potentially parcelling them out to different embedded servers in the same process.

Hi, sorry for the delay -- re: timescales for 1.0, code wise we are pretty close to being able to release it right now but we have a bunch of scrub work to do before we can formally release 1.0. Some of the core devs are having a small get together in SF next weekend and we'll see how close we can get then.

Closing for cleanup here. If this is still something you want, open another issue on snap-server.

I didn't get this out the door properly for 1.0 and still really want it myself. :-(