From: Zheng Junjie <zhengjunjie@iscas.ac.cn>
To: 71263@debbugs.gnu.org
Cc: goodoldpaul@autistici.org, maxim.cournoyer@gmail.com,
ludo@gnu.org, pelzflorian@pelzflorian.de, matt@excalamus.com
Subject: [bug#71263] [PATCH v2 2/5] gnu: docker: Allow setting Shepherd log-file in oci-container-configuration.
Date: Fri, 05 Jul 2024 15:35:49 +0800 [thread overview]
Message-ID: <878qygi94a.fsf@iscas.ac.cn> (raw)
In-Reply-To: <cebe8bfb07cbf4aabd3c91ccd657e6e04f352446.1718136300.git.goodoldpaul@autistici.org> (Giacomo Leidi via Guix-patches via's message of "Tue, 11 Jun 2024 22:04:57 +0200")
[-- Attachment #1: Type: text/plain, Size: 4990 bytes --]
Giacomo Leidi via Guix-patches via <guix-patches@gnu.org> writes:
> * gnu/services/docker.scm (oci-container-configuration)
> [log-file]: New field;
> (oci-container-shepherd-service): use it.
>
> * doc/guix.texi: Document it.
>
> Change-Id: Icad29ac6342b6f5bafc0d9be13a93cee99674185
> ---
> doc/guix.texi | 5 +++++
> gnu/services/docker.scm | 19 +++++++++++++++----
> 2 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 5a06d7cdc5..40296fcd5f 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -40698,6 +40698,11 @@ Miscellaneous Services
> Set additional Shepherd services dependencies to the provisioned
> Shepherd service.
>
> +@item @code{log-file} (default: @code{""}) (type: string)
^^^^^^^^^^^^^^^^^^^^
i remove it, because it is not "".
> +@item @code{log-file} (default: @code{""}) (type: string)
^^^^^^
maybe-string
> +When @code{log-file} is set, it names the file to which the service's
> +standard output and standard error are redirected. @code{log-file} is created
> +if it does not exist, otherwise it is appended to.
> +
> @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 cc1201508c..678e8b1139 100644
> --- a/gnu/services/docker.scm
> +++ b/gnu/services/docker.scm
> @@ -74,6 +74,7 @@ (define-module (gnu services docker)
> oci-container-configuration-image
> oci-container-configuration-provision
> oci-container-configuration-requirement
> + oci-container-configuration-log-file
> oci-container-configuration-network
> oci-container-configuration-ports
> oci-container-configuration-volumes
> @@ -461,6 +462,11 @@ (define-configuration/no-serialization oci-container-configuration
> (list-of-symbols '())
> "Set additional Shepherd services dependencies to the provisioned Shepherd
> service.")
> + (log-file
> + (maybe-string)
> + "When @code{log-file} is set, it names the file to which the service’s
> +standard output and standard error are redirected. @code{log-file} is created
> +if it does not exist, otherwise it is appended to.")
> (network
> (maybe-string)
> "Set a Docker network for the spawned container.")
> @@ -669,12 +675,16 @@ (define (oci-container-shepherd-service config)
> (host-environment
> (oci-container-configuration-host-environment config))
> (command (oci-container-configuration-command config))
> + (log-file (oci-container-configuration-log-file config))
> (provision (oci-container-configuration-provision config))
> (requirement (oci-container-configuration-requirement config))
> (image (oci-container-configuration-image config))
> (image-reference (oci-image-reference image))
> (options (oci-container-configuration->options config))
> (name (guess-name provision image))
> + (loader (if (oci-image? image)
> + (%oci-image-loader name image image-reference)
> + #f))
> (extra-arguments
> (oci-container-configuration-extra-arguments config)))
>
> @@ -687,10 +697,8 @@ (define (oci-container-shepherd-service config)
> (if (oci-image? image) name image) "."))
> (start
> #~(lambda ()
> - #$@(if (oci-image? image)
> - #~((invoke #$(%oci-image-loader
> - name image image-reference)))
> - #~())
> + (when #$(oci-image? image)
> + (invoke #$loader))
if (oci-image? image) return #f
```
(when #f
(invoke #f))
```
This is noise in the file.
> (fork+exec-command
> ;; docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
> (list #$docker "run" "--rm" "--name" #$name
> @@ -698,6 +706,9 @@ (define (oci-container-shepherd-service config)
> #$image-reference #$@command)
> #:user #$user
> #:group #$group
> + #$@(if (maybe-value-set? log-file)
> + (list #:log-file log-file)
> + '())
> #:environment-variables
> (list #$@host-environment))))
> (stop
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2024-07-05 7:37 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 ` [bug#71263] [PATCH 4/5] gnu: docker: Allow setting Shepherd respawn? " Giacomo Leidi via Guix-patches via
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 [this message]
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=878qygi94a.fsf@iscas.ac.cn \
--to=zhengjunjie@iscas.ac.cn \
--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.