all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Giacomo Leidi via Guix-patches via <guix-patches@gnu.org>
To: 71263@debbugs.gnu.org
Cc: "Giacomo Leidi" <goodoldpaul@autistici.org>,
	"Florian Pelz" <pelzflorian@pelzflorian.de>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Matthew Trzcinski" <matt@excalamus.com>,
	"Maxim Cournoyer" <maxim.cournoyer@gmail.com>
Subject: [bug#71263] [PATCH 4/5] gnu: docker: Allow setting Shepherd respawn? in oci-container-configuration.
Date: Wed, 29 May 2024 23:38:55 +0200	[thread overview]
Message-ID: <4e9095471f8157305cb7b0e26cacd6580de344c2.1717018736.git.goodoldpaul@autistici.org> (raw)
In-Reply-To: <31ff6a93a8c7b50e5152f75b091b28851d5c4cc8.1717018735.git.goodoldpaul@autistici.org>

* gnu/services/docker.scm (oci-container-configuration)
[respawn?]: New field;
(oci-container-shepherd-service): use it.

Change-Id: I0d6367607fd0fd41f90a54b33d80bf4d4f43dd8b
---
 doc/guix.texi           | 4 ++++
 gnu/services/docker.scm | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index dfc4d65349..9abdc77869 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -40653,6 +40653,10 @@ Miscellaneous Services
 Whether this service should be started automatically by the Shepherd.  If it
 is @code{#f} the service has to be started manually with @command{herd start}.
 
+@item @code{respawn?} (default: @code{#f}) (type: boolean)
+Whether to have Shepherd restart the service when it stops, for instance when
+the underlying process dies.
+
 @item @code{network} (default: @code{""}) (type: string)
 Set a Docker network for the spawned container.
 
diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm
index 712ca14cba..bc566e6316 100644
--- a/gnu/services/docker.scm
+++ b/gnu/services/docker.scm
@@ -76,6 +76,7 @@ (define-module (gnu services docker)
             oci-container-configuration-requirement
             oci-container-configuration-log-file
             oci-container-configuration-auto-start?
+            oci-container-configuration-respawn?
             oci-container-configuration-network
             oci-container-configuration-ports
             oci-container-configuration-volumes
@@ -472,6 +473,10 @@ (define-configuration/no-serialization oci-container-configuration
    (boolean #t)
    "Whether this service should be started automatically by the Shepherd.  If it
 is @code{#f} the service has to be started manually with @command{herd start}.")
+  (respawn?
+   (boolean #f)
+   "Whether to restart the service when it stops, for instance when the
+underlying process dies.")
   (network
    (maybe-string)
    "Set a Docker network for the spawned container.")
@@ -685,6 +690,8 @@ (define (oci-container-shepherd-service config)
          (log-file (oci-container-configuration-log-file config))
          (provision (oci-container-configuration-provision config))
          (requirement (oci-container-configuration-requirement config))
+         (respawn?
+          (oci-container-configuration-respawn? config))
          (image (oci-container-configuration-image config))
          (image-reference (oci-image-reference image))
          (options (oci-container-configuration->options config))
@@ -697,7 +704,7 @@ (define (oci-container-shepherd-service config)
 
     (shepherd-service (provision `(,(string->symbol name)))
                       (requirement `(dockerd user-processes ,@requirement))
-                      (respawn? #f)
+                      (respawn? respawn?)
                       (auto-start? auto-start?)
                       (documentation
                        (string-append
-- 
2.41.0





  parent reply	other threads:[~2024-05-29 21:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 21:37 [bug#71263] Add additional fields to oci-container-configuration paul via Guix-patches via
2024-05-29 21:38 ` [bug#71263] [PATCH 1/5] doc: Minor changes to the OCI-backed Services documentation Giacomo Leidi via Guix-patches via
2024-05-29 21:38   ` [bug#71263] [PATCH 2/5] gnu: docker: Allow setting Shepherd log-file in oci-container-configuration Giacomo Leidi via Guix-patches via
2024-05-29 21:38   ` [bug#71263] [PATCH 3/5] gnu: docker: Allow setting Shepherd auto-start? " Giacomo Leidi via Guix-patches via
2024-05-29 21:38   ` Giacomo Leidi via Guix-patches via [this message]
2024-05-29 21:38   ` [bug#71263] [PATCH 5/5] gnu: docker: Allow setting Shepherd actions " Giacomo Leidi via Guix-patches via
2024-06-11 20:01 ` [bug#71263] [PATCH v2] Add additional fields to oci-container-configuration - Rebase on current master paul via Guix-patches via
2024-06-11 20:04 ` [bug#71263] [PATCH v2 1/5] doc: Minor changes to the OCI-backed Services documentation Giacomo Leidi via Guix-patches via
2024-06-11 20:04   ` [bug#71263] [PATCH v2 2/5] gnu: docker: Allow setting Shepherd log-file in oci-container-configuration Giacomo Leidi via Guix-patches via
2024-07-05  7:35     ` Zheng Junjie
2024-06-11 20:04   ` [bug#71263] [PATCH v2 3/5] gnu: docker: Allow setting Shepherd auto-start? " Giacomo Leidi via Guix-patches via
2024-06-11 20:04   ` [bug#71263] [PATCH v2 4/5] gnu: docker: Allow setting Shepherd respawn? " Giacomo Leidi via Guix-patches via
2024-06-11 20:05   ` [bug#71263] [PATCH v2 5/5] gnu: docker: Allow setting Shepherd actions " Giacomo Leidi via Guix-patches via
2024-07-05  7:41   ` [bug#71263] [PATCH v2 1/5] doc: Minor changes to the OCI-backed Services documentation Zheng Junjie

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=4e9095471f8157305cb7b0e26cacd6580de344c2.1717018736.git.goodoldpaul@autistici.org \
    --to=guix-patches@gnu.org \
    --cc=71263@debbugs.gnu.org \
    --cc=goodoldpaul@autistici.org \
    --cc=ludo@gnu.org \
    --cc=matt@excalamus.com \
    --cc=maxim.cournoyer@gmail.com \
    --cc=pelzflorian@pelzflorian.de \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.