* bug#26830: Allow services to implement a 'reload' action @ 2017-05-08 15:25 Clément Lassieur 2017-05-08 15:28 ` bug#26830: [PATCH 1/4] services: shepherd: " Clément Lassieur 2017-05-09 15:37 ` bug#26830: Allow services to implement " Mathieu Othacehe 0 siblings, 2 replies; 25+ messages in thread From: Clément Lassieur @ 2017-05-08 15:25 UTC (permalink / raw) To: 26830 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? ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: [PATCH 1/4] services: shepherd: Allow services to implement a 'reload' action. 2017-05-08 15:25 bug#26830: Allow services to implement a 'reload' action Clément Lassieur @ 2017-05-08 15:28 ` Clément Lassieur 2017-05-08 15:28 ` bug#26830: [PATCH 2/4] gnu: services: nginx: Add " Clément Lassieur ` (2 more replies) 2017-05-09 15:37 ` bug#26830: Allow services to implement " Mathieu Othacehe 1 sibling, 3 replies; 25+ messages in thread From: Clément Lassieur @ 2017-05-08 15:28 UTC (permalink / raw) To: 26830 * 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 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* bug#26830: [PATCH 2/4] gnu: services: nginx: Add a 'reload' action. 2017-05-08 15:28 ` bug#26830: [PATCH 1/4] services: shepherd: " Clément Lassieur @ 2017-05-08 15:28 ` 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 2 siblings, 0 replies; 25+ messages in thread From: Clément Lassieur @ 2017-05-08 15:28 UTC (permalink / raw) To: 26830 * 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@we.make.ritual.n0.is> ;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> +;;; Copyright © 2017 Clément Lassieur <clement@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 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* bug#26830: [PATCH 3/4] gnu: services: prosody: Add a 'reload' action. 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 ` Clément Lassieur 2017-05-08 15:28 ` bug#26830: [PATCH 4/4] gnu: services: dovecot: " Clément Lassieur 2 siblings, 0 replies; 25+ messages in thread From: Clément Lassieur @ 2017-05-08 15:28 UTC (permalink / raw) To: 26830 * 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 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* bug#26830: [PATCH 4/4] gnu: services: dovecot: Add a 'reload' action. 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 ` Clément Lassieur 2 siblings, 0 replies; 25+ messages in thread From: Clément Lassieur @ 2017-05-08 15:28 UTC (permalink / raw) To: 26830 * 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 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* bug#26830: Allow services to implement a 'reload' action 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-09 15:37 ` Mathieu Othacehe 2017-05-10 19:31 ` bug#26830: [PATCH] services: shepherd: " Clément Lassieur ` (2 more replies) 1 sibling, 3 replies; 25+ messages in thread From: Mathieu Othacehe @ 2017-05-09 15:37 UTC (permalink / raw) To: Clément Lassieur; +Cc: 26830 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 ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action. 2017-05-09 15:37 ` bug#26830: Allow services to implement " Mathieu Othacehe @ 2017-05-10 19:31 ` Clément Lassieur 2017-05-11 7:13 ` Clément Lassieur 2017-05-10 19:31 ` bug#26830: " Clément Lassieur 2017-05-11 21:24 ` Ludovic Courtès 2 siblings, 1 reply; 25+ messages in thread From: Clément Lassieur @ 2017-05-10 19:31 UTC (permalink / raw) To: 26830 * 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 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action. 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 0 siblings, 1 reply; 25+ messages in thread From: Clément Lassieur @ 2017-05-11 7:13 UTC (permalink / raw) To: 26830 Clément Lassieur <clement@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}). ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action. 2017-05-11 7:13 ` Clément Lassieur @ 2017-05-11 12:40 ` Clément Lassieur 2017-05-11 12:57 ` Mathieu Othacehe 0 siblings, 1 reply; 25+ messages in thread From: Clément Lassieur @ 2017-05-11 12:40 UTC (permalink / raw) To: 26830 Clément Lassieur <clement@lassieur.org> writes: > Clément Lassieur <clement@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}). ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action. 2017-05-11 12:40 ` Clément Lassieur @ 2017-05-11 12:57 ` Mathieu Othacehe 0 siblings, 0 replies; 25+ messages in thread From: Mathieu Othacehe @ 2017-05-11 12:57 UTC (permalink / raw) To: Clément Lassieur; +Cc: 26830 > @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 ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: Allow services to implement a 'reload' action 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-10 19:31 ` Clément Lassieur 2017-05-11 21:24 ` Ludovic Courtès 2 siblings, 0 replies; 25+ messages in thread From: Clément Lassieur @ 2017-05-10 19:31 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: 26830 Mathieu Othacehe <m.othacehe@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? ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: Allow services to implement a 'reload' action 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-10 19:31 ` bug#26830: " Clément Lassieur @ 2017-05-11 21:24 ` Ludovic Courtès 2017-05-11 23:08 ` Clément Lassieur 2018-07-11 22:00 ` Ludovic Courtès 2 siblings, 2 replies; 25+ messages in thread From: Ludovic Courtès @ 2017-05-11 21:24 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: Clément Lassieur, 26830 Hello! Mathieu Othacehe <m.othacehe@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’. ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: Allow services to implement a 'reload' action 2017-05-11 21:24 ` Ludovic Courtès @ 2017-05-11 23:08 ` Clément Lassieur 2017-05-12 8:25 ` Ludovic Courtès 2018-07-11 22:00 ` Ludovic Courtès 1 sibling, 1 reply; 25+ messages in thread From: Clément Lassieur @ 2017-05-11 23:08 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 26830 Hi Ludovic, Thanks for commenting on this :) Ludovic Courtès <ludo@gnu.org> writes: > Hello! > > Mathieu Othacehe <m.othacehe@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 ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: Allow services to implement a 'reload' action 2017-05-11 23:08 ` Clément Lassieur @ 2017-05-12 8:25 ` Ludovic Courtès 2017-05-12 8:57 ` Clément Lassieur 0 siblings, 1 reply; 25+ messages in thread From: Ludovic Courtès @ 2017-05-12 8:25 UTC (permalink / raw) To: Clément Lassieur; +Cc: 26830 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’. ^ permalink raw reply [flat|nested] 25+ messages in thread
* bug#26830: Allow services to implement a 'reload' action 2017-05-12 8:25 ` Ludovic Courtès @ 2017-05-12 8:57 ` Clément Lassieur 2018-01-28 20:34 ` [bug#26830] " Danny Milosavljevic 0 siblings, 1 reply; 25+ messages in thread From: Clément Lassieur @ 2017-05-12 8:57 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 26830 Ludovic Courtès <ludo@gnu.org> writes: > 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? 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 :) ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2017-05-12 8:57 ` Clément Lassieur @ 2018-01-28 20:34 ` Danny Milosavljevic 2018-01-28 23:23 ` Clément Lassieur 0 siblings, 1 reply; 25+ messages in thread From: Danny Milosavljevic @ 2018-01-28 20:34 UTC (permalink / raw) To: Clément Lassieur; +Cc: 26830 Any news on this reload action patchset? ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2018-01-28 20:34 ` [bug#26830] " Danny Milosavljevic @ 2018-01-28 23:23 ` Clément Lassieur 0 siblings, 0 replies; 25+ messages in thread From: Clément Lassieur @ 2018-01-28 23:23 UTC (permalink / raw) To: Danny Milosavljevic; +Cc: 26830 Danny Milosavljevic <dannym@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. ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2017-05-11 21:24 ` Ludovic Courtès 2017-05-11 23:08 ` 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 1 sibling, 2 replies; 25+ messages in thread From: Ludovic Courtès @ 2018-07-11 22:00 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: 26830, Clément Lassieur Hello! ludo@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’. ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2018-07-11 22:00 ` Ludovic Courtès @ 2018-07-12 13:06 ` Clément Lassieur 2022-03-23 12:56 ` zimoun 1 sibling, 0 replies; 25+ messages in thread From: Clément Lassieur @ 2018-07-12 13:06 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 26830 Ludovic Courtès <ludo@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 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 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 1 sibling, 1 reply; 25+ messages in thread From: zimoun @ 2022-03-23 12:56 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Mathieu Othacehe, 26830, Clément Lassieur Hi, This old patch [1] is… old! :-) 1: <http://issues.guix.gnu.org/issue/26830> On Thu, 12 Jul 2018 at 00:00, ludo@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 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2022-03-23 12:56 ` zimoun @ 2022-03-24 8:41 ` Ludovic Courtès 2022-03-24 13:52 ` Oleg Pykhalov 0 siblings, 1 reply; 25+ messages in thread From: Ludovic Courtès @ 2022-03-24 8:41 UTC (permalink / raw) To: zimoun; +Cc: Mathieu Othacehe, 26830, Clément Lassieur Hi, zimoun <zimon.toutoune@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’. ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2022-03-24 8:41 ` Ludovic Courtès @ 2022-03-24 13:52 ` Oleg Pykhalov 2022-03-26 20:46 ` Ludovic Courtès 0 siblings, 1 reply; 25+ messages in thread From: Oleg Pykhalov @ 2022-03-24 13:52 UTC (permalink / raw) To: Ludovic Courtès Cc: Mathieu Othacehe, Clément Lassieur, 26830, zimoun [-- Attachment #1: Type: text/plain, Size: 525 bytes --] Hi, Ludovic Courtès <ludo@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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --] ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2022-03-24 13:52 ` Oleg Pykhalov @ 2022-03-26 20:46 ` Ludovic Courtès 2022-03-26 21:14 ` Maxime Devos 0 siblings, 1 reply; 25+ messages in thread From: Ludovic Courtès @ 2022-03-26 20:46 UTC (permalink / raw) To: Oleg Pykhalov; +Cc: Mathieu Othacehe, Clément Lassieur, 26830, zimoun Hi, Oleg Pykhalov <go.wigust@gmail.com> skribis: > Ludovic Courtès <ludo@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’. ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2022-03-26 20:46 ` Ludovic Courtès @ 2022-03-26 21:14 ` Maxime Devos 2022-03-29 13:36 ` Ludovic Courtès 0 siblings, 1 reply; 25+ messages in thread From: Maxime Devos @ 2022-03-26 21:14 UTC (permalink / raw) To: Ludovic Courtès, Oleg Pykhalov Cc: Mathieu Othacehe, 26830, Clément Lassieur, zimoun [-- Attachment #1: Type: text/plain, Size: 449 bytes --] 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. [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 260 bytes --] ^ permalink raw reply [flat|nested] 25+ messages in thread
* [bug#26830] Allow services to implement a 'reload' action 2022-03-26 21:14 ` Maxime Devos @ 2022-03-29 13:36 ` Ludovic Courtès 0 siblings, 0 replies; 25+ messages in thread From: Ludovic Courtès @ 2022-03-29 13:36 UTC (permalink / raw) To: Maxime Devos Cc: Oleg Pykhalov, Mathieu Othacehe, 26830, Clément Lassieur, zimoun Maxime Devos <maximedevos@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’. ^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2022-03-29 13:37 UTC | newest] Thread overview: 25+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).