GNU bug report logs - #26830
Allow services to implement a 'reload' action

Previous Next

Package: guix-patches;

Reported by: Clément Lassieur <clement <at> lassieur.org>

Date: Mon, 8 May 2017 15:26:01 UTC

Severity: important

To reply to this bug, email your comments to 26830 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Mon, 08 May 2017 15:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Lassieur <clement <at> lassieur.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 08 May 2017 15:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: guix-patches <at> gnu.org
Subject: Allow services to implement a 'reload' action
Date: Mon, 08 May 2017 17:25:18 +0200
Hi,

The first patch allows services to implement a 'reload' action, and the
other three implement the 'reload' action for nginx, prosody and
dovecot.

Services do not have to implement 'reload' and if, say, foo-daemon
doesn't implement it, 'herd reload foo-daemon' will return 1 and display
a message saying that foo-deamon does not have an action 'reload'.
That's the reason of the #f default value.

WDYT?




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Mon, 08 May 2017 15:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: [PATCH 1/4] services: shepherd: Allow services to implement a
 'reload' action.
Date: Mon,  8 May 2017 17:28:29 +0200
* gnu/services/shepherd.scm (<shepherd-service>)[reload]: Add it.
(shepherd-service-file): Add it to the Shepherd's service definition.
* doc/guix.texi (Services): Update accordingly.
---
 doc/guix.texi             | 7 ++++---
 gnu/services/shepherd.scm | 9 ++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 4446909ed..3ccfa8d9e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8671,9 +8671,10 @@ service:
 Run libc's name service cache daemon (nscd).
 @end example
 
-The @command{start}, @command{stop}, and @command{restart} sub-commands
-have the effect you would expect.  For instance, the commands below stop
-the nscd service and restart the Xorg display server:
+The @command{start}, @command{stop}, @command{restart} and
+@command{reload} sub-commands have the effect you would expect.  For
+instance, the commands below stop the nscd service and restart the Xorg
+display server:
 
 @example
 # herd stop nscd
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 7281746ab..17e53f774 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -47,6 +47,7 @@
             shepherd-service-respawn?
             shepherd-service-start
             shepherd-service-stop
+            shepherd-service-reload
             shepherd-service-auto-start?
             shepherd-service-modules
 
@@ -137,6 +138,8 @@ for a service that extends SHEPHERD-ROOT-SERVICE-TYPE and nothing else."
   (start         shepherd-service-start)               ;g-expression (procedure)
   (stop          shepherd-service-stop                 ;g-expression (procedure)
                  (default #~(const #f)))
+  (reload        shepherd-service-reload               ;g-expression (procedure)
+                 (default #f))
   (auto-start?   shepherd-service-auto-start?          ;Boolean
                  (default #t))
   (modules       shepherd-service-modules              ;list of module names
@@ -214,7 +217,11 @@ stored."
                       #:requires '#$(shepherd-service-requirement service)
                       #:respawn? '#$(shepherd-service-respawn? service)
                       #:start #$(shepherd-service-start service)
-                      #:stop #$(shepherd-service-stop service))))))
+                      #:stop #$(shepherd-service-stop service)
+                      #:actions (make-actions
+                                 (reload
+                                  "Reload the service's configuration files."
+                                  #$(shepherd-service-reload service))))))))
 
 (define (shepherd-configuration-file services)
   "Return the shepherd configuration file for SERVICES."
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Mon, 08 May 2017 15:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: [PATCH 2/4] gnu: services: nginx: Add a 'reload' action.
Date: Mon,  8 May 2017 17:28:30 +0200
* gnu/services/web.scm (nginx-shepherd-service): Add it.
---
 gnu/services/web.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index f85b41215..956aa1518 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016 ng0 <ng0 <at> we.make.ritual.n0.is>
 ;;; Copyright © 2016, 2017 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2017 Christopher Baines <mail <at> cbaines.net>
+;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -262,13 +263,13 @@ of index files."
                                      run-directory server-blocks upstream-blocks))
                              #$@args))))))
 
-       ;; TODO: Add 'reload' action.
        (list (shepherd-service
               (provision '(nginx))
               (documentation "Run the nginx daemon.")
               (requirement '(user-processes loopback))
               (start (nginx-action "-p" run-directory))
-              (stop (nginx-action "-s" "stop"))))))))
+              (stop (nginx-action "-s" "stop"))
+              (reload (nginx-action "-s" "reload"))))))))
 
 (define nginx-service-type
   (service-type (name 'nginx)
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Mon, 08 May 2017 15:29:03 GMT) Full text and rfc822 format available.

Message #14 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: [PATCH 3/4] gnu: services: prosody: Add a 'reload' action.
Date: Mon,  8 May 2017 17:28:31 +0200
* gnu/services/messaging.scm (prosody-shepherd-service): Add it.
---
 gnu/services/messaging.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm
index 715d6181f..1f357c1c5 100644
--- a/gnu/services/messaging.scm
+++ b/gnu/services/messaging.scm
@@ -582,7 +582,8 @@ See also @url{http://prosody.im/doc/modules/mod_muc}."
            (provision '(prosody xmpp-daemon))
            (requirement '(networking syslogd user-processes))
            (start (prosodyctl-action "start"))
-           (stop (prosodyctl-action "stop"))))))
+           (stop (prosodyctl-action "stop"))
+           (reload (prosodyctl-action "reload"))))))
 
 (define %prosody-accounts
   (list (user-group (name "prosody") (system? #t))
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Mon, 08 May 2017 15:29:03 GMT) Full text and rfc822 format available.

Message #17 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: [PATCH 4/4] gnu: services: dovecot: Add a 'reload' action.
Date: Mon,  8 May 2017 17:28:32 +0200
* gnu/services/mail.scm (dovecot-shepherd-service): Add it.
---
 gnu/services/mail.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 6305f06f8..db0772c47 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1528,7 +1528,10 @@ greyed out, instead of only later giving \"not selectable\" popup error.
                            "-F" "-c" #$config-file)))
            (stop #~(make-forkexec-constructor
                     (list (string-append #$dovecot "/sbin/dovecot")
-                          "-c" #$config-file "stop")))))))
+                          "-c" #$config-file "stop")))
+           (reload #~(make-forkexec-constructor
+                      (list (string-append #$dovecot "/bin/doveadm")
+                            "-c" #$config-file "reload")))))))
 
 (define %dovecot-pam-services
   (list (unix-pam-service "dovecot")))
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Tue, 09 May 2017 15:37:02 GMT) Full text and rfc822 format available.

Message #20 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Tue, 09 May 2017 17:37:25 +0200
Hi Clément,

> Services do not have to implement 'reload' and if, say, foo-daemon
> doesn't implement it, 'herd reload foo-daemon' will return 1 and display
> a message saying that foo-deamon does not have an action 'reload'.
> That's the reason of the #f default value.
>
> WDYT?

Your whole serie LGTM for me !

I have just one small concern, there is a already a "reload" action on
shepherd root service.

For instance you can call "herd reload root conf.scm".

Maybe it will be unclear for users how reload action differs on root
service where it takes an argument and guix services where it does not.

You could maybe mention that in the documentation and/or in the code ?

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Wed, 10 May 2017 19:32:02 GMT) Full text and rfc822 format available.

Message #23 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: [PATCH] services: shepherd: Allow services to implement a 'reload'
 action.
Date: Wed, 10 May 2017 21:31:37 +0200
* gnu/services/shepherd.scm (<shepherd-service>)[reload]: Add it.
(shepherd-service-file): Add it to the Shepherd's service definition.
* doc/guix.texi (Services, Shepherd Services): Update accordingly.
---
 doc/guix.texi             | 14 +++++++++++---
 gnu/services/shepherd.scm |  9 ++++++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 81aa957c6..2d2015df2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8674,9 +8674,10 @@ service:
 Run libc's name service cache daemon (nscd).
 @end example
 
-The @command{start}, @command{stop}, and @command{restart} sub-commands
-have the effect you would expect.  For instance, the commands below stop
-the nscd service and restart the Xorg display server:
+The @command{start}, @command{stop}, @command{restart} and
+@command{reload} sub-commands have the effect you would expect.  For
+instance, the commands below stop the nscd service and restart the Xorg
+display server:
 
 @example
 # herd stop nscd
@@ -16204,6 +16205,13 @@ Constructors,,, shepherd, The GNU Shepherd Manual}).  They are given as
 G-expressions that get expanded in the Shepherd configuration file
 (@pxref{G-Expressions}).
 
+@item @code{reload} (default: @code{#f})
+The @code{reload} field refers to the Shepherd's facilities to reload
+the service's configuration files without restarting.  They are
+@code{actions} (@pxref{Slots of services,,, shepherd, The GNU Shepherd
+Manual}) and are given as G-expressions that get expanded in the
+Shepherd configuration file (@pxref{G-Expressions}).
+
 @item @code{documentation}
 A documentation string, as shown when running:
 
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 7281746ab..17e53f774 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -47,6 +47,7 @@
             shepherd-service-respawn?
             shepherd-service-start
             shepherd-service-stop
+            shepherd-service-reload
             shepherd-service-auto-start?
             shepherd-service-modules
 
@@ -137,6 +138,8 @@ for a service that extends SHEPHERD-ROOT-SERVICE-TYPE and nothing else."
   (start         shepherd-service-start)               ;g-expression (procedure)
   (stop          shepherd-service-stop                 ;g-expression (procedure)
                  (default #~(const #f)))
+  (reload        shepherd-service-reload               ;g-expression (procedure)
+                 (default #f))
   (auto-start?   shepherd-service-auto-start?          ;Boolean
                  (default #t))
   (modules       shepherd-service-modules              ;list of module names
@@ -214,7 +217,11 @@ stored."
                       #:requires '#$(shepherd-service-requirement service)
                       #:respawn? '#$(shepherd-service-respawn? service)
                       #:start #$(shepherd-service-start service)
-                      #:stop #$(shepherd-service-stop service))))))
+                      #:stop #$(shepherd-service-stop service)
+                      #:actions (make-actions
+                                 (reload
+                                  "Reload the service's configuration files."
+                                  #$(shepherd-service-reload service))))))))
 
 (define (shepherd-configuration-file services)
   "Return the shepherd configuration file for SERVICES."
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Wed, 10 May 2017 19:32:03 GMT) Full text and rfc822 format available.

Message #26 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Wed, 10 May 2017 21:31:58 +0200
Mathieu Othacehe <m.othacehe <at> gmail.com> writes:

>> Services do not have to implement 'reload' and if, say, foo-daemon
>> doesn't implement it, 'herd reload foo-daemon' will return 1 and display
>> a message saying that foo-deamon does not have an action 'reload'.
>> That's the reason of the #f default value.
>>
>> WDYT?
>
> Your whole serie LGTM for me !

Hi Mathieu, thanks for reviewing :)

> I have just one small concern, there is a already a "reload" action on
> shepherd root service.
>
> For instance you can call "herd reload root conf.scm".
>
> Maybe it will be unclear for users how reload action differs on root
> service where it takes an argument and guix services where it does not.

They don't differ: 'root' is just another service, as 'nginx' is.  Our
'reload' action can handle many arguments as well.  The only tiny
difference is that the 'root' service is implemented by Shepherd, not by
Guix.

> You could maybe mention that in the documentation and/or in the code ?

Sure, I updated the documentation.  I had forgotten the "Shepherd
Services" part and I think it helps understanding.  But I didn't talk
about the 'root' service because it is a Shepherd thing and is already
described in the Shepherd manual.

WDYT?




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 11 May 2017 07:14:01 GMT) Full text and rfc822 format available.

Message #29 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: [PATCH] services: shepherd: Allow services to
 implement a 'reload' action.
Date: Thu, 11 May 2017 09:13:05 +0200
Clément Lassieur <clement <at> lassieur.org> writes:

> +@item @code{reload} (default: @code{#f})
> +The @code{reload} field refers to the Shepherd's facilities to reload
> +the service's configuration files without restarting.  They are
> +@code{actions} (@pxref{Slots of services,,, shepherd, The GNU Shepherd
> +Manual}) and are given as G-expressions that get expanded in the
> +Shepherd configuration file (@pxref{G-Expressions}).

With singular instead of plural...:

@item @code{reload} (default: @code{#f})
The @code{reload} field refers to the Shepherd's facilities to reload
the service's configuration files without restarting.  It is an
@code{action} (@pxref{Slots of services,,, shepherd, The GNU Shepherd
Manual}) and is given as a G-expression that gets expanded in the
Shepherd configuration file (@pxref{G-Expressions}).




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 11 May 2017 12:41:01 GMT) Full text and rfc822 format available.

Message #32 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: [PATCH] services: shepherd: Allow services to
 implement a 'reload' action.
Date: Thu, 11 May 2017 14:40:25 +0200
Clément Lassieur <clement <at> lassieur.org> writes:
> Clément Lassieur <clement <at> lassieur.org> writes:
>
>> +@item @code{reload} (default: @code{#f})
>> +The @code{reload} field refers to the Shepherd's facilities to reload
>> +the service's configuration files without restarting.  They are
>> +@code{actions} (@pxref{Slots of services,,, shepherd, The GNU Shepherd
>> +Manual}) and are given as G-expressions that get expanded in the
>> +Shepherd configuration file (@pxref{G-Expressions}).
>
> With singular instead of plural...:
>
> @item @code{reload} (default: @code{#f})
> The @code{reload} field refers to the Shepherd's facilities to reload
> the service's configuration files without restarting.  It is an
> @code{action} (@pxref{Slots of services,,, shepherd, The GNU Shepherd
> Manual}) and is given as a G-expression that gets expanded in the
> Shepherd configuration file (@pxref{G-Expressions}).

New version:

@item @code{reload} (default: @code{#f})
The @code{reload} field allows Shepherd to reload the service's
configuration files without restarting.  It is an @code{action}
(@pxref{Slots of services,,, shepherd, The GNU Shepherd Manual}) and is
given as a G-expression that gets expanded in the Shepherd configuration
file (@pxref{G-Expressions}).




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 11 May 2017 12:58:01 GMT) Full text and rfc822 format available.

Message #35 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: [PATCH] services: shepherd: Allow services to
 implement a 'reload' action.
Date: Thu, 11 May 2017 14:57:26 +0200
> @item @code{reload} (default: @code{#f})
> The @code{reload} field allows Shepherd to reload the service's
> configuration files without restarting.  It is an @code{action}
> (@pxref{Slots of services,,, shepherd, The GNU Shepherd Manual}) and is
> given as a G-expression that gets expanded in the Shepherd configuration
> file (@pxref{G-Expressions}).

The new version looks better !

LGTM !

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 11 May 2017 21:25:02 GMT) Full text and rfc822 format available.

Message #38 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26830 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Thu, 11 May 2017 23:24:04 +0200
Hello!

Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

>> Services do not have to implement 'reload' and if, say, foo-daemon
>> doesn't implement it, 'herd reload foo-daemon' will return 1 and display
>> a message saying that foo-deamon does not have an action 'reload'.
>> That's the reason of the #f default value.
>>
>> WDYT?
>
> Your whole serie LGTM for me !

Same here, really happy to see this addressed!

> I have just one small concern, there is a already a "reload" action on
> shepherd root service.

Right, but that’s just for ‘root’, not for the other services.

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?

The logical next step of this series will be to have the service upgrade
code in ‘guix system reconfigure’ invoke this action when it is defined.
That will be awesome.

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.

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.  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.

Otherwise, I think we’d have to move the config to a fixed location, say
/etc/nginx, for “nginx -s reload” to have any effect.  However I don’t
quite like the use of /etc.  Thoughts?

Does Dovecot have the same problem?

Thank you!

Ludo’.




Severity set to 'important' from 'normal' Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Thu, 11 May 2017 21:25:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 11 May 2017 23:09:02 GMT) Full text and rfc822 format available.

Message #43 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Fri, 12 May 2017 01:08:17 +0200
Hi Ludovic,

Thanks for commenting on this :)

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

> Hello!
>
> Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:
>
>>> Services do not have to implement 'reload' and if, say, foo-daemon
>>> doesn't implement it, 'herd reload foo-daemon' will return 1 and display
>>> a message saying that foo-deamon does not have an action 'reload'.
>>> That's the reason of the #f default value.
>>>
>>> WDYT?
>>
>> Your whole serie LGTM for me !
>
> Same here, really happy to see this addressed!
>
>> I have just one small concern, there is a already a "reload" action on
>> shepherd root service.
>
> Right, but that’s just for ‘root’, not for the other services.
>
> 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?

> The logical next step of this series will be to have the service upgrade
> code in ‘guix system reconfigure’ invoke this action when it is defined.
> That will be awesome.

Indeed!

> 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.
Would that be why we need a 'reload/reconfigure/upgrade' for them?

> 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).  So I think it would work.  But indeed,
I didn't think about the main configuration file :/

> 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?

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.

> Otherwise, I think we’d have to move the config to a fixed location, say
> /etc/nginx, for “nginx -s reload” to have any effect.  However I don’t
> quite like the use of /etc.  Thoughts?

I don't like it either :)  'reload' definitely has to support
configuration files that are in the store!

> Does Dovecot have the same problem?

Yes.  (But Prosody doesn't.)

Clément





Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Fri, 12 May 2017 08:26:01 GMT) Full text and rfc822 format available.

Message #46 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Fri, 12 May 2017 10:25:09 +0200
Heya,

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

> Ludovic Courtès <ludo <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Fri, 12 May 2017 08:58:02 GMT) Full text and rfc822 format available.

Message #49 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Fri, 12 May 2017 10:57:47 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Heya,
>
> Clément Lassieur <clement <at> lassieur.org> skribis:
>
>> Ludovic Courtès <ludo <at> 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?

Ok!  I like 'upgrade'.

>>> 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?

Yes!  Thank you :)




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Sun, 28 Jan 2018 20:35:02 GMT) Full text and rfc822 format available.

Message #52 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Sun, 28 Jan 2018 21:34:30 +0100
Any news on this reload action patchset?




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Sun, 28 Jan 2018 23:24:01 GMT) Full text and rfc822 format available.

Message #55 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Mon, 29 Jan 2018 00:23:10 +0100
Danny Milosavljevic <dannym <at> scratchpost.org> writes:

> Any news on this reload action patchset?

I didn't find time to work on it.  It's still on my todo list but if
anyone wants to do it, please go ahead.




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Wed, 11 Jul 2018 22:01:02 GMT) Full text and rfc822 format available.

Message #58 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: Clément Lassieur <clement <at> lassieur.org>,
 26830 <at> debbugs.gnu.org
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Thu, 12 Jul 2018 00:00:00 +0200
Hello!

ludo <at> gnu.org (Ludovic Courtès) skribis:

> The logical next step of this series will be to have the service upgrade
> code in ‘guix system reconfigure’ invoke this action when it is defined.
> That will be awesome.
>
> 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.
>
> 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.  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

FWIW, with the patch at <https://bugs.gnu.org/32128>, adding such
actions becomes easy (it’s a generalization of what you did in this
patch series.)

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 12 Jul 2018 13:07:02 GMT) Full text and rfc822 format available.

Message #61 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org
Subject: Re: [bug#26830] Allow services to implement a 'reload' action
Date: Thu, 12 Jul 2018 15:06:20 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> FWIW, with the patch at <https://bugs.gnu.org/32128>, adding such
> actions becomes easy (it’s a generalization of what you did in this
> patch series.)
>
> Ludo’.

Hehe thanks for the reminder, I'll consider working on this again soon
:-)

Clément




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Wed, 23 Mar 2022 13:03:01 GMT) Full text and rfc822 format available.

Message #64 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Wed, 23 Mar 2022 13:56:32 +0100
Hi,

This old patch [1] is… old! :-)

1: <http://issues.guix.gnu.org/issue/26830>


On Thu, 12 Jul 2018 at 00:00, ludo <at> gnu.org (Ludovic Courtès) wrote:

> FWIW, with the patch at <https://bugs.gnu.org/32128>, adding such
> actions becomes easy (it’s a generalization of what you did in this
> patch series.)

Considering this merged #32128 [1]:

--8<---------------cut here---------------start------------->8---
Done in Shepherd commit 5ab8cbc9bcfce586a5389ad95a65f011d02bd289.
--8<---------------cut here---------------end--------------->8---

1: <https://issues.guix.gnu.org/32128#4>


What is then the status of this patch adding ’upgrade’?  Does it still
make sense?


Cheers,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 24 Mar 2022 08:42:02 GMT) Full text and rfc822 format available.

Message #67 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>
Subject: Re: bug#26830: Allow services to implement a 'reload' action
Date: Thu, 24 Mar 2022 09:41:46 +0100
Hi,

zimoun <zimon.toutoune <at> gmail.com> skribis:

> What is then the status of this patch adding ’upgrade’?  Does it still
> make sense?

I think having ‘reload’ actions for nginx, dovecot, etc. whereby the
daemon reloads its config without stopping still makes sense.

I wonder if the patch as-is would achieve that though, because in
general those daemons are run with ‘-c /gnu/store/…-config’, so
reloading would just reload the same file.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Thu, 24 Mar 2022 13:54:01 GMT) Full text and rfc822 format available.

Message #70 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>,
 Clément Lassieur <clement <at> lassieur.org>,
 26830 <at> debbugs.gnu.org, zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: [bug#26830] Allow services to implement a 'reload' action
Date: Thu, 24 Mar 2022 16:52:58 +0300
[Message part 1 (text/plain, inline)]
Hi,

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

[…]

> I wonder if the patch as-is would achieve that though, because in
> general those daemons are run with ‘-c /gnu/store/…-config’, so
> reloading would just reload the same file.

Maybe we could switch to another practice in service definitions:

‘/gnu/store/...-some-program/bin/some-program -c /etc/some-config’

$ ls -l /etc/static
/etc/static -> /gnu/store/...-etc/etc

$ ls -l /etc/some-config
/etc/some-config -> /etc/static/some-config
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Sat, 26 Mar 2022 20:47:01 GMT) Full text and rfc822 format available.

Message #73 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>,
 Clément Lassieur <clement <at> lassieur.org>,
 26830 <at> debbugs.gnu.org, zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: [bug#26830] Allow services to implement a 'reload' action
Date: Sat, 26 Mar 2022 21:46:17 +0100
Hi,

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
> […]
>
>> I wonder if the patch as-is would achieve that though, because in
>> general those daemons are run with ‘-c /gnu/store/…-config’, so
>> reloading would just reload the same file.
>
> Maybe we could switch to another practice in service definitions:
>
> ‘/gnu/store/...-some-program/bin/some-program -c /etc/some-config’
>
> $ ls -l /etc/static
> /etc/static -> /gnu/store/...-etc/etc
>
> $ ls -l /etc/some-config
> /etc/some-config -> /etc/static/some-config

Hmm yes, we could (I think Maxim did that recently for a service, I
forgot which one.)

I like the clarity of ‘-c /gnu/store/…-config’ better than the ambient
authority and ambiguity of ‘/etc/config’, but I guess we have to made a
tradeoff.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Sat, 26 Mar 2022 21:15:02 GMT) Full text and rfc822 format available.

Message #76 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Ludovic Courtès <ludo <at> gnu.org>, Oleg Pykhalov
 <go.wigust <at> gmail.com>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>,
 zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: [bug#26830] Allow services to implement a 'reload' action
Date: Sat, 26 Mar 2022 22:14:21 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès schreef op za 26-03-2022 om 21:46 [+0100]:
> I like the clarity of ‘-c /gnu/store/…-config’ better than the ambient
> authority and ambiguity of ‘/etc/config’, but I guess we have to made a
> tradeoff.

How about something in-between:

  /run/current-system/SOME-SUBDIRECTORY/etc/config

That way, there is less potential for non-atomicity problems caused by
individual files in /etc/...

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26830; Package guix-patches. (Tue, 29 Mar 2022 13:37:01 GMT) Full text and rfc822 format available.

Message #79 received at 26830 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>,
 Mathieu Othacehe <m.othacehe <at> gmail.com>, 26830 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>,
 zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: [bug#26830] Allow services to implement a 'reload' action
Date: Tue, 29 Mar 2022 15:36:32 +0200
Maxime Devos <maximedevos <at> telenet.be> skribis:

> Ludovic Courtès schreef op za 26-03-2022 om 21:46 [+0100]:
>> I like the clarity of ‘-c /gnu/store/…-config’ better than the ambient
>> authority and ambiguity of ‘/etc/config’, but I guess we have to made a
>> tradeoff.
>
> How about something in-between:
>
>   /run/current-system/SOME-SUBDIRECTORY/etc/config

It’s “ambient authority” in the same way as /etc.

Ludo’.




This bug report was last modified 1 year and 364 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.