Subject: Re: [bug#33508] [PATCH] gnu: Add ability to restart services on system reconfigure

From: Ludovic Courtès <[email-masked]>
Date: Sun, 09 Dec 2018 17:59:29 +0100

Hi Carlo,

Sorry for not commenting earlier!

Carlo Zancanaro <[email-masked]> skribis:

> The broad idea is to add a new field to our guix shepherd services:
> restart-strategy. There are three valid values:
>
> - always: this service is always safe to restart when running
> reconfigure
>
> - manual: this service may not be safe to restart when running
> reconfigure - a message will be printed telling the user to restart
> the service manually, or they can provide the --restart-services flag
> to reconfigure to automatically restart them
>
> - never: this service is never safe to restart when running
> reconfigure (eg. udev)
>
> I have added the flag to the guix daemon's shepherd service to show
> how it works. I tested this by changing my substitute servers in
> config.scm, and after running "reconfigure" I saw my updated
> substitute servers in ps without having to run "sudo herd restart
> guix-daemon".

In what sense is guix-daemon “always safe to restart”?  It’s actually a
difficult question for me.

You could argue that its child guix-daemon processes will remain live
when we restart it, meaning that client connections remain active and
valid.  I believe this is indeed the case, though it would be worth
double-checking.

Now, if safe-to-restart means that we automatically invoke the “restart”
action on guix-daemon, that means that anything that depends on it
(‘guix-publish’, ‘cuirass’, ‘hpcguix-web’, etc.) would be restarted as
well (even though I *think* we don’t have to in this case.)  But these
may not be safe to restart: for example, on may want ‘guix-publish’ to
run uninterrupted.

Furthermore, whether something is “safe to restart” is really user
policy.

So the notion here should probably not be “safe to restart” but rather
“live-upgradable”.

sshd, nginx, and maybe guix-daemon can more or less be live-upgraded,
meaning that (1) existing connections are preserved but future
connections will talk to the new daemon, and as a corollary, (2)
dependent services do not need to be stopped & restarted.

Does that make sense?

Thanks,
Ludo’.