all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* unifying mcron and shepherd, service woes, improvements
@ 2021-05-14 22:39 raingloom
  2021-05-15 16:59 ` Ludovic Courtès
  2021-05-16 20:49 ` Xinglu Chen
  0 siblings, 2 replies; 5+ messages in thread
From: raingloom @ 2021-05-14 22:39 UTC (permalink / raw)
  To: guix-devel@gnu.org

Just throwing this out there:
mcron is basically a very simple service manager, so, why not just move
all its timer functionality into shepherd (like systemd's timer units)
and then we can have a unified way to manage and debug services.

But also, shepherd debugging is kind of terrible too, at least on Guix,
so we (and if no one else gets on it that probably means I) should do
something about that.
For example, it's pretty nontrivial to figure out how to run a
service's command in isolation. So far I always had to find it in
/proc, which is not great. stracing a service that fails to start is
also rather tricky. The best I could come up with is to run strace in a
loop and pgrep for the PIDs I'm interested in. Same goes for GDB, which
was still bad in general last time I tried it.

Security could also be improved probably. Can we have an OCAP model?
I feel like I don't know enough to say, so this mail is meant more as a
conversation starter.

So, can we do better? What other issues are there with Shepherd? Are
they fundamental design problems or just plain old bugs?

Or is everyone else happy with the current design and it's just me who
can't use Shepherd properly? 😅


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unifying mcron and shepherd, service woes, improvements
  2021-05-14 22:39 unifying mcron and shepherd, service woes, improvements raingloom
@ 2021-05-15 16:59 ` Ludovic Courtès
  2021-05-16 18:17   ` raingloom
  2021-05-16 20:47   ` Philip McGrath
  2021-05-16 20:49 ` Xinglu Chen
  1 sibling, 2 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-05-15 16:59 UTC (permalink / raw)
  To: raingloom; +Cc: guix-devel@gnu.org

Hi!

raingloom <raingloom@riseup.net> skribis:

> Just throwing this out there:
> mcron is basically a very simple service manager, so, why not just move
> all its timer functionality into shepherd (like systemd's timer units)
> and then we can have a unified way to manage and debug services.

Yes, we could—see below.

> But also, shepherd debugging is kind of terrible too, at least on Guix,
> so we (and if no one else gets on it that probably means I) should do
> something about that.
> For example, it's pretty nontrivial to figure out how to run a
> service's command in isolation. So far I always had to find it in
> /proc, which is not great. stracing a service that fails to start is
> also rather tricky. The best I could come up with is to run strace in a
> loop and pgrep for the PIDs I'm interested in. Same goes for GDB, which
> was still bad in general last time I tried it.

I agree it’s kind of ugly.  We could provide “actions” to display the
service’s command line, for instance, as in:

  herd command openssh

The limitation right now is that the Shepherd’s API is procedural:
there’s ‘make-forkexec-constructor’, which returns a procedure that runs
a command.  That “hides” the command from the <service> object.  That’s
not hard to fix, though we’ll have to think hard about compatibility.

> Security could also be improved probably. Can we have an OCAP model?
> I feel like I don't know enough to say, so this mail is meant more as a
> conversation starter.

I think “having an ocap model” sounds nice but also vague.  :-)

A concrete step we can take is follow the principle of least authority
(POLA) for more services.  That was the spirit of
<https://guix.gnu.org/en/blog/2017/running-system-services-in-containers/>.

> So, can we do better? What other issues are there with Shepherd? Are
> they fundamental design problems or just plain old bugs?
>
> Or is everyone else happy with the current design and it's just me who
> can't use Shepherd properly? 😅

I think it’s fair to say it’s rough on the edges.  :-)

One thing that’s on the to-do list is switching to a real event loop in
lieu of the current ad-hoc blocking design (this was discussed recently
on this mailing list).  The switch to ‘signalfd’ in the last release in
a step in that direction.  This will unlock “socket activation” and
possibly timers as you mentioned.

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unifying mcron and shepherd, service woes, improvements
  2021-05-15 16:59 ` Ludovic Courtès
@ 2021-05-16 18:17   ` raingloom
  2021-05-16 20:47   ` Philip McGrath
  1 sibling, 0 replies; 5+ messages in thread
From: raingloom @ 2021-05-16 18:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel@gnu.org

On Sat, 15 May 2021 18:59:52 +0200
Ludovic Courtès <ludo@gnu.org> wrote:

> > Security could also be improved probably. Can we have an OCAP model?
> > I feel like I don't know enough to say, so this mail is meant more
> > as a conversation starter.  
> 
> I think “having an ocap model” sounds nice but also vague.  :-)
> 
> A concrete step we can take is follow the principle of least authority
> (POLA) for more services.  That was the spirit of
> <https://guix.gnu.org/en/blog/2017/running-system-services-in-containers/>.

By OCAP I was thinking of things like not having global state, or at
least not having it implicitly. Something more functional. The lambda
calculus supports the OCAP model, and Guix is all about being
functional, so service management should not be any different.

Would also be nice if replacing running components was supported, a la
Erlang. Maybe steal the supervisor tree idea as well.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unifying mcron and shepherd, service woes, improvements
  2021-05-15 16:59 ` Ludovic Courtès
  2021-05-16 18:17   ` raingloom
@ 2021-05-16 20:47   ` Philip McGrath
  1 sibling, 0 replies; 5+ messages in thread
From: Philip McGrath @ 2021-05-16 20:47 UTC (permalink / raw)
  To: Ludovic Courtès, raingloom; +Cc: guix-devel@gnu.org

On 5/15/21 12:59 PM, Ludovic Courtès wrote:
> raingloom <raingloom@riseup.net> skribis:
>> Or is everyone else happy with the current design and it's just me who
>> can't use Shepherd properly? 😅
> 
> I think it’s fair to say it’s rough on the edges.  :-)
> 
> One thing that’s on the to-do list is switching to a real event loop in
> lieu of the current ad-hoc blocking design (this was discussed recently
> on this mailing list).  The switch to ‘signalfd’ in the last release in
> a step in that direction.  This will unlock “socket activation” and
> possibly timers as you mentioned.

 From a newcomer's perspective---I haven't used shepherd at all yet---I 
was surprised by the discussion leading up to 
<https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00396.html>:

On 3/19/21 10:42 PM, raid5atemyhomework wrote:
 > Perhaps the point is not so much to be *multi-threaded* but to be 
*concurrent*

 From very occasionally reading Andy Wingo's blog, I understand that 
Guile has a Concurrent ML implementation: 
<https://wingolog.org/archives/2017/06/29/a-new-concurrent-ml>.

I haven't programmed with it in Guile at all, but, from my experience 
using Racket's Concurrent ML system, I think it is the right foundation 
for a supervisor daemon. CML provides a consistent, extensible way to 
express, "when something happens, do some action", where "something 
happens" might be:

   * a timer fires;
   * a service, or a set of them, come up;
   * a subprocess exits (successfully or not);
   * a file descriptor is ready for reading and/or writing;
   * a "green thread" (IIUC, a Guile "fiber") has an uncaught exception;
   * a signal is received from the OS kernel;
   * a user sends a command from the client program;

... etc, etc, etc. The CML implementation handles many low-level details 
that are easy to get wrong.

-Philip


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unifying mcron and shepherd, service woes, improvements
  2021-05-14 22:39 unifying mcron and shepherd, service woes, improvements raingloom
  2021-05-15 16:59 ` Ludovic Courtès
@ 2021-05-16 20:49 ` Xinglu Chen
  1 sibling, 0 replies; 5+ messages in thread
From: Xinglu Chen @ 2021-05-16 20:49 UTC (permalink / raw)
  To: raingloom, guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

On Sat, May 15 2021, raingloom wrote:

> Just throwing this out there:
> mcron is basically a very simple service manager, so, why not just move
> all its timer functionality into shepherd (like systemd's timer units)
> and then we can have a unified way to manage and debug services.

Yes please!

Not really related to Shepherd or Mcron, but having something like
Syslogd/Journald at the user level to browse and rotate logs would be
nice.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-16 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-14 22:39 unifying mcron and shepherd, service woes, improvements raingloom
2021-05-15 16:59 ` Ludovic Courtès
2021-05-16 18:17   ` raingloom
2021-05-16 20:47   ` Philip McGrath
2021-05-16 20:49 ` Xinglu Chen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.