all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: "Clément Lassieur" <clement@lassieur.org>
Cc: 26830@debbugs.gnu.org
Subject: bug#26830: Allow services to implement a 'reload' action
Date: Fri, 12 May 2017 10:25:09 +0200	[thread overview]
Message-ID: <87inl6trbu.fsf@gnu.org> (raw)
In-Reply-To: <874lwrq9em.fsf@lassieur.org> ("Clément Lassieur"'s message of "Fri, 12 May 2017 01:08:17 +0200")

Heya,

Clément Lassieur <clement@lassieur.org> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>> However, I think ‘reload’ might be confusing since in fact it doesn’t
>> load Scheme code, contrary to what “herd load root foo.scm” does (maybe
>> that’s what you meant?).  In fact it’s closer to what “herd restart
>> foo” does.
>>
>> What about changing the name to ‘reconfigure’ or ‘upgrade’ to avoid the
>> confusion?
>
> I think it's going to be even more confusing because the other init
> systems (systemd, sysvinit) all call it 'reload'.  And, well, people are
> probably more familiar with Systemd's 'reload' than with Shepherd's
> 'reload root' :)  WDYT?

I think it’s a valid argument!  However, if the choice is between
internal consistency (on the use of the word “load” in Shepherd
commands) and the rule of least surprise (choosing command names similar
to those of other programs), I would favor internal consistency, I
think.  WDYT?

We have a nice bike shed to paint here.  :-)

>> Some comments:
>>
>> +                      #:actions (make-actions
>> +                                 (reload
>> +                                  "Reload the service's configuration files."
>> +                                  #$(shepherd-service-reload service))))))))
>>
>> Here I think we should only define the action when it has a non-#f
>> value.  That way we can distinguish between services that have a useful
>> reload/reconfigure/upgrade action and those that don’t; in the latter
>> case, we simply use ‘restart’ when upgrading.
>
> Ok.  But right now IIRC we don't even use restart after a system
> reconfigure, probably because some services can't be restarted safely.

Currently ‘guix system reconfigure’ (specifically
‘upgrade-shepherd-services’) reloads and starts all services that are
currently stopped, on the grounds that it would not be safe/desirable to
simply stop any running service.

> Would that be why we need a 'reload/reconfigure/upgrade' for them?

‘upgrade-shepherd-services’ could check whether a service has an
‘upgrade’ action.  If it does, it could call that action unconditionally
since that action would semantically have the same effect has
stop/unload/load/start, except that it does that “live”, without
stopping anything.

>> Regarding nginx:
>>
>> +              (stop (nginx-action "-s" "stop"))
>> +              (reload (nginx-action "-s" "reload"))))))))
>>
>> Is this of any use in practice?  The nginx command line is something
>> like:
>>
>>   /gnu/store/74kz9m850ycxpzkg6dvn9wbd3xjkwwrb-nginx-1.12.0/sbin/nginx -c /gnu/store/5w11ahw113fndvab3xmwcjzs2rw56sbh-nginx-config/bayfront.conf -p /var/run/nginx
>>
>> and the configuration file in /gnu/store is immutable, so “nginx -s
>> reload” does nothing.
>
> Actually, my goal was to use this after a certificate renewal.  There
> was going to be other patches on the certbot service as well :)  And
> after a certificate renewal, the names of the certificates don't change
> (AFAIK they are still in /etc).

Indeed.

> So I think it would work.  But indeed, I didn't think about the main
> configuration file :/

Yeah.  Sorry for dropping a fly in the ointment.  :-/

>> If the action took an argument, we could do:
>>
>>   herd reconfigure nginx /gnu/store/…-new-config.conf
>>
>> which would translate to:
>>
>>   nginx -s reload -c /gnu/store/…-new-config.conf
>>
>> Probably our best option.
>
> I don't see the point.  If the service has already been reloaded by the
> 'guix system reconfigure' command (let's assume it does, but I know it
> doesn't currently reload nor restart sevices...), why would a user want
> to reload it again with the 'herd' command?  Or maybe you want this
> feature as a workaround while the 'guix system reconfigure' that reloads
> services isn't implemented?

Sorry, I wasn’t clear.  Action can take arguments; most don’t, but some
do (like ‘herd start cow-store /mnt’ when installing GuixSD.)  What I’m
suggesting here is to add one/several arguments to this reload/upgrade
action.  The meaning of these arguments would be defined by the service
itself.

For nginx, there could be one argument (the config file) or two (the
config file and the nginx executable file name).  The reload/upgrade
action would do “nginx -s reload -c …” and so on.

The ‘upgrade-shepherd-services’ procedure would automatically call the
reload/upgrade action with the right arguments.  For that, it needs to
know what the arguments are.  An option would be to add an
‘upgrade-arguments’ field to <shepherd-service> that would return the
arguments to pass to the upgrade action.

Does that make sense?

> Anyway, I think the argument should be optional, so that if there are
> none, the current configuration file is used.  That will be useful for
> certificates anyway, or for other kinds of configuration files that
> aren't in the store.

We could do that too.  My thought was that the primary consumer of this
action would be ‘guix system reconfigure’ and not the user.

Thanks,
Ludo’.

  reply	other threads:[~2017-05-12  8:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 15:25 bug#26830: Allow services to implement a 'reload' action Clément Lassieur
2017-05-08 15:28 ` bug#26830: [PATCH 1/4] services: shepherd: " Clément Lassieur
2017-05-08 15:28   ` bug#26830: [PATCH 2/4] gnu: services: nginx: Add " Clément Lassieur
2017-05-08 15:28   ` bug#26830: [PATCH 3/4] gnu: services: prosody: " Clément Lassieur
2017-05-08 15:28   ` bug#26830: [PATCH 4/4] gnu: services: dovecot: " Clément Lassieur
2017-05-09 15:37 ` bug#26830: Allow services to implement " Mathieu Othacehe
2017-05-10 19:31   ` bug#26830: [PATCH] services: shepherd: " Clément Lassieur
2017-05-11  7:13     ` Clément Lassieur
2017-05-11 12:40       ` Clément Lassieur
2017-05-11 12:57         ` Mathieu Othacehe
2017-05-10 19:31   ` bug#26830: " Clément Lassieur
2017-05-11 21:24   ` Ludovic Courtès
2017-05-11 23:08     ` Clément Lassieur
2017-05-12  8:25       ` Ludovic Courtès [this message]
2017-05-12  8:57         ` Clément Lassieur
2018-01-28 20:34           ` [bug#26830] " Danny Milosavljevic
2018-01-28 23:23             ` Clément Lassieur
2018-07-11 22:00     ` Ludovic Courtès
2018-07-12 13:06       ` Clément Lassieur
2022-03-23 12:56       ` zimoun
2022-03-24  8:41         ` Ludovic Courtès
2022-03-24 13:52           ` Oleg Pykhalov
2022-03-26 20:46             ` Ludovic Courtès
2022-03-26 21:14               ` Maxime Devos
2022-03-29 13:36                 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87inl6trbu.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=26830@debbugs.gnu.org \
    --cc=clement@lassieur.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.