jsbronder / meta-openrc

OpenEmbedded layer adding support for OpenRC
MIT License
14 stars 5 forks source link

RFC: updating scripts to use supervise-daemon #28

Open mqqc opened 1 year ago

mqqc commented 1 year ago

A lot of current initscripts either run without supervision entirely or run under start-stop-daemon, using pidfiles which are inherently subject to race conditions and don't provide proper supervision.

While supervise-daemon also has its flaws, in the context of OpenRC it may be the easiest method to provide proper supervision for services, making sure we get notified when services die and they can be automatically restarted, in a configurable way.

Would you be open to updating (or having me update, of course) the initscripts in meta-openrc to use supervise-daemon as a guiding principle (that is, wherever appropriate and possible)?

jsbronder commented 1 year ago

I'm a bit hesitant as neither Gentoo nor Alpine have fully committed to supervise-daemon yet [1][2]. There aren't too many users of this layer whereas there's a lot of Gentoo and Alpine users who are providing a lot of "testing" every day. Is there a possibility to support both but default to start-stop-daemon? Ideally we'd be able to enable supervision on a per-recipe basis.

The layer is already mostly using the declarative style for init scripts; would it be as simple as making sure that we set command appropriately in each init script and define command_args/command_args_foreground where appropriate? I haven't looked closely, but your work in #26 makes me think this might be possible.

  1. https://wiki.gentoo.org/wiki/OpenRC/supervise-daemon
  2. https://lists.alpinelinux.org/~alpine/devel/%3C3LLUI2KOULSYM.359WA6HATX45B%408pit.net%3E (most recent discussion I could easily find, perhaps there's something newer).
mqqc commented 1 year ago

Yes, to clarify, I mean on a per-recipe basis instead of as a global default; that the initscripts in this repo by and large (where possible and appropriate) use supervision as a guideline, but not as a globally enforced default in rc.conf or something like that.

The layer is already mostly using the declarative style for init scripts; would it be as simple as making sure that we set command appropriately in each init script and define command_args/command_args_foreground where appropriate? I haven't looked closely, but your work in https://github.com/jsbronder/meta-openrc/pull/26 makes me think this might be possible.

That is entirely correct, yep.

jsbronder commented 1 year ago

Sounds like a great direction in that case.