all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Configuring a service but not starting it on boot
@ 2018-11-28  7:47 Arun Isaac
  2018-11-28  9:34 ` Clément Lassieur
  0 siblings, 1 reply; 8+ messages in thread
From: Arun Isaac @ 2018-11-28  7:47 UTC (permalink / raw)
  To: help-guix


I would like to have the a service (specifically the tor service) listed
in my config.scm and configured using `guix system reconfigure
config.scm'. But, I do not want the service to start up at boot time. I
want to start/stop it using `herd' later as and when I require it. How
do I achieve this?

Thanks!

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

* Re: Configuring a service but not starting it on boot
  2018-11-28  7:47 Configuring a service but not starting it on boot Arun Isaac
@ 2018-11-28  9:34 ` Clément Lassieur
  2018-11-28 16:11   ` Arun Isaac
  0 siblings, 1 reply; 8+ messages in thread
From: Clément Lassieur @ 2018-11-28  9:34 UTC (permalink / raw)
  To: Arun Isaac; +Cc: help-guix

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

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> writes:

> I would like to have the a service (specifically the tor service) listed
> in my config.scm and configured using `guix system reconfigure
> config.scm'. But, I do not want the service to start up at boot time. I
> want to start/stop it using `herd' later as and when I require it. How
> do I achieve this?
>
> Thanks!

Attached is a hack I did a while ago.

Hope it helps,
Clément

[-- Attachment #2: dont-auto-start.patch --]
[-- Type: text/x-diff, Size: 1795 bytes --]

commit 5ebc46a52e543c316924ac936bb65c3ae7f113bb
Author: Clément Lassieur <clement@lassieur.org>
Date:   Fri May 5 15:11:37 2017 +0200

    guix: don't auto-start nginx

diff --git a/guix/configs/modules/rodion/web.scm b/guix/configs/modules/rodion/web.scm
index 5c26651..35fe3d3 100644
--- a/guix/configs/modules/rodion/web.scm
+++ b/guix/configs/modules/rodion/web.scm
@@ -1,6 +1,8 @@
 (define-module (rodion web)
   #:use-module (gnu services)
   #:use-module (gnu services web)
+  #:use-module (srfi srfi-1) ; find
+  #:use-module (gnu services shepherd) ; shepherd-root-service-type
   #:export (%my-nginx-service))
 
 (define my-nginx-configuration
@@ -18,5 +20,29 @@
          (uri "/")
          (body (list "index index.html;"))))))))))
 
+(define (my-nginx-shepherd-service nginx-conf)
+  (let ((nginx-shepherd-service
+         (service-extension-compute
+          (find (lambda (ext)
+                  (eq? (service-extension-target ext)
+                       shepherd-root-service-type))
+                (service-type-extensions nginx-service-type)))))
+    (list
+     (shepherd-service
+      (inherit (car (nginx-shepherd-service nginx-conf)))
+      (auto-start? #f)))))
+
+(define my-nginx-service-type
+  (service-type
+   (inherit nginx-service-type)
+   (extensions
+    (cons
+     (service-extension shepherd-root-service-type
+                        my-nginx-shepherd-service)
+     (remove (lambda (ext)
+               (eq? (service-extension-target ext)
+                    shepherd-root-service-type))
+             (service-type-extensions nginx-service-type))))))
+
 (define %my-nginx-service
-  (service nginx-service-type my-nginx-configuration))
+  (service my-nginx-service-type my-nginx-configuration))

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

* Re: Configuring a service but not starting it on boot
  2018-11-28  9:34 ` Clément Lassieur
@ 2018-11-28 16:11   ` Arun Isaac
  2018-11-28 16:44     ` znavko
  2018-11-28 17:20     ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Arun Isaac @ 2018-11-28 16:11 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: help-guix


> Attached is a hack I did a while ago.

Hacks like the one you showed could work, but it would be nice to have a
general purpose #:auto-start? property common to all services. Is there
such a feature? If not, could we implement such a feature?

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

* Re: Configuring a service but not starting it on boot
  2018-11-28 16:11   ` Arun Isaac
@ 2018-11-28 16:44     ` znavko
  2018-11-28 17:20     ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: znavko @ 2018-11-28 16:44 UTC (permalink / raw)
  To: Arun Isaac; +Cc: Help Guix, Clément Lassieur

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

Your words are awesome! 
We need this option!


Nov 28, 2018, 7:11 PM by arunisaac@systemreboot.net:

>> Attached is a hack I did a while ago.
>>
>
> Hacks like the one you showed could work, but it would be nice to have a
> general purpose #:auto-start? property common to all services. Is there
> such a feature? If not, could we implement such a feature?
>


[-- Attachment #2: Type: text/html, Size: 786 bytes --]

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

* Re: Configuring a service but not starting it on boot
  2018-11-28 16:11   ` Arun Isaac
  2018-11-28 16:44     ` znavko
@ 2018-11-28 17:20     ` Ludovic Courtès
  2018-11-28 17:52       ` Arun Isaac
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-11-28 17:20 UTC (permalink / raw)
  To: Arun Isaac; +Cc: help-guix, Clément Lassieur

Hello Arun,

Arun Isaac <arunisaac@systemreboot.net> skribis:

>> Attached is a hack I did a while ago.
>
> Hacks like the one you showed could work, but it would be nice to have a
> general purpose #:auto-start? property common to all services. Is there
> such a feature? If not, could we implement such a feature?

The openssh service has such an option, but currently, it’s really
per-service, which isn’t great.  It would be best if we had a generic
way to say which Shepherd services should be started automatically and
which shouldn’t.

Ludo’.

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

* Re: Configuring a service but not starting it on boot
  2018-11-28 17:20     ` Ludovic Courtès
@ 2018-11-28 17:52       ` Arun Isaac
  2018-11-29 10:49         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Arun Isaac @ 2018-11-28 17:52 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix


> It would be best if we had a generic way to say which Shepherd
> services should be started automatically and which shouldn’t.

Could you describe some way to achieve this? If it's simple enough, I
can implement it and contribute a patch.

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

* Re: Configuring a service but not starting it on boot
  2018-11-28 17:52       ` Arun Isaac
@ 2018-11-29 10:49         ` Ludovic Courtès
  2018-11-30  9:03           ` Arun Isaac
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-11-29 10:49 UTC (permalink / raw)
  To: Arun Isaac; +Cc: help-guix

Arun Isaac <arunisaac@systemreboot.net> skribis:

>> It would be best if we had a generic way to say which Shepherd
>> services should be started automatically and which shouldn’t.
>
> Could you describe some way to achieve this? If it's simple enough, I
> can implement it and contribute a patch.

I don’t have a good idea on how to do it.

One thing I proposed long ago is this:
<https://issues.guix.info/issue/27155>.  It would allow us to address
this kind of issue but it has the drawback that it makes it harder to
reason about the relationships among services: anything can happen.

Needs more thought…

Ludo’.

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

* Re: Configuring a service but not starting it on boot
  2018-11-29 10:49         ` Ludovic Courtès
@ 2018-11-30  9:03           ` Arun Isaac
  0 siblings, 0 replies; 8+ messages in thread
From: Arun Isaac @ 2018-11-30  9:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix


> One thing I proposed long ago is this:
> <https://issues.guix.info/issue/27155>.  It would allow us to address
> this kind of issue but it has the drawback that it makes it harder to
> reason about the relationships among services: anything can happen.

I can see how the proposed finalization service can be inelegant. But, I
don't have any insight to offer. So, for now, I'll just use hacks like
the one Clement proposed.

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

end of thread, other threads:[~2018-11-30  9:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-28  7:47 Configuring a service but not starting it on boot Arun Isaac
2018-11-28  9:34 ` Clément Lassieur
2018-11-28 16:11   ` Arun Isaac
2018-11-28 16:44     ` znavko
2018-11-28 17:20     ` Ludovic Courtès
2018-11-28 17:52       ` Arun Isaac
2018-11-29 10:49         ` Ludovic Courtès
2018-11-30  9:03           ` Arun Isaac

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.