From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id cO44Cd7IHmUYvQAA9RJhRA:P1 (envelope-from ) for ; Thu, 05 Oct 2023 16:31:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cO44Cd7IHmUYvQAA9RJhRA (envelope-from ) for ; Thu, 05 Oct 2023 16:31:58 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BA12B5C1C4 for ; Thu, 5 Oct 2023 16:31:57 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=mN+tfK5L; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696516318; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dewsmrblf++qAB/1KmJYtAeQq+SbUBPXC6fscAyK7u0=; b=DCPdM9TytNF9/gpELxaWB0rvFm8jnU55QIlw1octK8+0BReB5u33pvAp6EXea4fgx09BZ+ UwYNqq8wBf0uS7E9+Obgs1gXxL8BQnhwHgQhnkFqoPv1bxG3DW529wwlFtUC2bA0gnDIyi 4DAtjzdb817+Zs11Lm/H6pi98F34YkeYfWn5sURzXwr23SgJ3DGKNWUeiXS5bzr7cXrrt1 u32/D6wp53mkCTbbHn+eP7ehNrfkOXXUaYR0ftly+FIui26xEHdKjQUaf403eubDsARpvl Dzezkcyr0OU20BOVmZp14s0rNnAsvnEqVfyhKzVIIRGT71r1e5vSkzOGgIc8VA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=mN+tfK5L; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696516318; a=rsa-sha256; cv=none; b=t5te6KWP0GMMY830juOlvLYbGgXc2sz9G/uEHbMChQrwTUPuqYx66hjhTeNjmqAK/kp+5S QLs0rybmjeNo0JkNODjsl72Rs9YPZXwHn0jXLtd22yzJVF2QyYH7rxLo0FCumzd+ZIfVz2 WTa6IHApkUYVNA5eR/ZlhGJksGWapThRdzE7JRZf97tv+8B6ss2CUIARLJDqKA4+OzT3GJ GRAnpjQQnDcN8qwVBwdqW2KbQMsAkcBszunVQL3MG835SOQLNOisfLmw8+EOLmwfNBoENi jRR7QkrD4epm3fCD4JvLlfgn75BF9ey3wKZUjz/FIRtISrQOZjR5KqvIOQojFw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoPOD-00051I-OL; Thu, 05 Oct 2023 10:31:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoPOC-0004v6-12 for guix-patches@gnu.org; Thu, 05 Oct 2023 10:31:44 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoPOB-0005QI-Ou for guix-patches@gnu.org; Thu, 05 Oct 2023 10:31:43 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoPOT-0008PK-VT for guix-patches@gnu.org; Thu, 05 Oct 2023 10:32:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66160] [PATCH] gnu: Add oci-container-service-type. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 05 Oct 2023 14:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66160 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Giacomo Leidi Cc: 66160@debbugs.gnu.org Received: via spool by 66160-submit@debbugs.gnu.org id=B66160.169651629232275 (code B ref 66160); Thu, 05 Oct 2023 14:32:01 +0000 Received: (at 66160) by debbugs.gnu.org; 5 Oct 2023 14:31:32 +0000 Received: from localhost ([127.0.0.1]:48062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoPNz-0008OV-Hd for submit@debbugs.gnu.org; Thu, 05 Oct 2023 10:31:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoPNw-0008OD-8W for 66160@debbugs.gnu.org; Thu, 05 Oct 2023 10:31:30 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoPNW-0005K6-W3; Thu, 05 Oct 2023 10:31:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=dewsmrblf++qAB/1KmJYtAeQq+SbUBPXC6fscAyK7u0=; b=mN+tfK5LZludW+gLANIC tN34IW6Azd2jnmz0NiargaFZuC0Xpdow8kBuMIt9reCe9TOWzXWd10nifgLVIl9oIC4/EQvUTytZk PeptzGt2RKs1DPtD8grElIES5lV8RT9JKDfyWH/fRUR8tXW03+Ryg9rSxJA2wGm61qC6YDnH+Tt6y YdPLgM1yBnui9C1cmOBZ0nZpphI+Wd9JOndANdjTXHksCELryZ1EYloF534W/kMt/ue38sw+Jor7Z ZK9FDSN0M0f/YwPnnKnVd4jlZ8NMr2t4Mh93WeKJ8BK64UBHyxCdEG6gheAA+dvVJajXNHMuEyqCY kiYEjbzoBl0gjA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <3b982aed1fa51f7b9e4bd87294b006f1977d26aa.1695414861.git.goodoldpaul@autistici.org> (Giacomo Leidi's message of "Fri, 22 Sep 2023 22:34:21 +0200") References: <650a02e2-9425-a7fd-2014-7cf6e17ee65b@autistici.org> <3b982aed1fa51f7b9e4bd87294b006f1977d26aa.1695414861.git.goodoldpaul@autistici.org> Date: Thu, 05 Oct 2023 16:30:59 +0200 Message-ID: <87v8bl3zvg.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.89 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: BA12B5C1C4 X-Spam-Score: -6.89 X-TUID: xXXGfho2grvB Hi, Giacomo Leidi skribis: > * gnu/services/docker.scm (oci-container-configuration): New variable; > (oci-container-shepherd-service): new variable; > (oci-container-service-type): new variable. > * doc/guix.texi: Document it. Neat! > +@cindex OCI-backed, Shepherd services > +@subsubheading OCI backed services > + > +Should you wish to manage your Docker containers with the same consistent > +interface you use for your other Shepherd services, > +@var{oci-container-service-type} is the tool to use. Perhaps expound a bit, like: =E2=80=A6 is the tool to use: given an @acronym{Open Container Initiative, OCI} container image, it will run it in a Shepherd service. One example where this is useful: it lets you run services that are available as Docker/OCI images but not yet packaged for Guix. > +@defvar oci-container-service-type > + > +This is a thin wrapper around Docker's CLI that wraps OCI images backed > +processes as Shepherd Services. > + > +@lisp > +(simple-service 'oci-grafana-service > + (list > + (oci-container-configuration The second argument to =E2=80=98simple-service=E2=80=99 is missing. > + (image "prom/prometheus") > + (network "host") > + (ports > + '(("9000" . "9000") > + ("9090" . "9090")))))) > + (oci-container-configuration > + (image "grafana/grafana:10.0.1") > + (network "host") > + (volumes > + '("/var/lib/grafana:/var/lib/grafana")))))) > +@end lisp Please explain the example in one or two sentences. Personally, I=E2=80=99d like to know how the image names are resolved; woul= d be nice to mention it in the doc. > +@table @asis > +@item @code{command} (default: @code{()}) (type: list-of-strings) > +Overwrite the default CMD of the image. =E2=80=9C=E2=80=A6 the default command (@code{CMD}) of the image.=E2=80=9D > +@item @code{entrypoint} (default: @code{""}) (type: string) > +Overwrite the default ENTRYPOINT of the image. Likewise. > +@item @code{environment} (default: @code{()}) (type: list) > +Set environment variables. This can be a list of pairs or strings, even = mixed: > + > +@lisp > +(list '("LANGUAGE" . "eo:ca:eu") > + "JAVA_HOME=3D/opt/java") I would choose one or the other, but not both. > +@item @code{ports} (default: @code{()}) (type: list) > +Set the port or port ranges to expose from the spawned container. This c= an be a > +list of pairs or strings, even mixed: > + > +@lisp > +(list '("8080" . "80") > + "10443:443") Likewise. > +(define (oci-sanitize-pair pair delimiter) > + (cond ((file-like? (car pair)) > + (file-append (car pair) delimiter (cdr pair))) Please use =E2=80=98match=E2=80=99 instead of car/cdr (info "(guix) Data Ty= pes and Pattern Matching"). > + (error > + (format #f "pair members must only contain gexps, file-like ob= jects and strings but ~a was found" (car pair)))))) Should be (raise (formatted-message (G_ =E2=80=A6))). That way we get i18n support and the message is presented like other error messages. > + (error > + (format #f "~a members must be either a string or a pair bu= t ~a was found!" name el))))) Ditto. > + (shepherd-service (provision `(,(string->symbol name))) > + (requirement '(dockerd)) Actually: (requirement '(dockerd user-processes)). > + (description > + "This service provides allows the management of Docker > +containers as Shepherd services."))) =E2=80=9CDocker and OCI containers=E2=80=9D Could you send an updated patch? Thanks, Ludo=E2=80=99.