From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GNviJLbSWGD7HgAA0tVLHw (envelope-from ) for ; Mon, 22 Mar 2021 17:24:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qGzKILbSWGAZJQAA1q6Kng (envelope-from ) for ; Mon, 22 Mar 2021 17:24:06 +0000 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 19FBD1F152 for ; Mon, 22 Mar 2021 18:24:06 +0100 (CET) Received: from localhost ([::1]:49604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOOHd-0006mN-4v for larch@yhetil.org; Mon, 22 Mar 2021 13:24:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOOBp-0000Cm-3x for guix-patches@gnu.org; Mon, 22 Mar 2021 13:18:37 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOOBm-0000z1-Bt for guix-patches@gnu.org; Mon, 22 Mar 2021 13:18:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lOOBm-0008Hj-7a for guix-patches@gnu.org; Mon, 22 Mar 2021 13:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#45905] [PATCH] IPFS service definition Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 22 Mar 2021 17:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45905 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: 45905@debbugs.gnu.org Received: via spool by 45905-submit@debbugs.gnu.org id=B45905.161643348031840 (code B ref 45905); Mon, 22 Mar 2021 17:18:02 +0000 Received: (at 45905) by debbugs.gnu.org; 22 Mar 2021 17:18:00 +0000 Received: from localhost ([127.0.0.1]:58449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOOBk-0008HT-29 for submit@debbugs.gnu.org; Mon, 22 Mar 2021 13:18:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOOBi-0008HH-79 for 45905@debbugs.gnu.org; Mon, 22 Mar 2021 13:17:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34932) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOOBc-0000wN-Ql; Mon, 22 Mar 2021 13:17:52 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=43086 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lOOBa-0007P6-UI; Mon, 22 Mar 2021 13:17:52 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: Date: Mon, 22 Mar 2021 18:17:49 +0100 In-Reply-To: (Maxime Devos's message of "Fri, 15 Jan 2021 22:22:54 +0100") Message-ID: <874kh3w1j6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616433846; 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; bh=Nyymg+6/B4ki0vDh7b3ENnsyL+YRvWQKp4R2wISZwXc=; b=Bu0lPMNWjM6dZrmpiEeM6oiMTFuBkL2ATTZ54G9QC9HpnpY9cv84HChp/1PZ2DJGixIb0j 27TDJjvdd8hyVEeIoPUvsCXYz/g9aqQeRgFpD7FFudC5GDuCaZ6jrQFDBe/XHkT/LiM7fz SOVEVnOZfnG4nwMlqucnFmh+AprarTuFz69EDpU9ZWS2bzW6ol1d6kHVEYRZekXg5Y8MxY Igsv9BCXPpQTanGszlluDOx316W6CBHpNnj9mvFMLZs+TBG8lbmHIb6dfZMj4Sw36x5qOe 2dPkcALF6Y/tq/rEy3bmutefbMy2l1mwYy2JJAbBSp3fzSr/jqyrl8vGESApWg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616433846; a=rsa-sha256; cv=none; b=K3aepU3P+a6idkduiUfcmpz71AwdrikCxp8HLeXyYUdj/88SPPgIQdbrz7a9EwJg6YzC+R Ok4hrBNoUPe3NZbbSmAdd4SI15nC7/0s/y4BydZxSH176t+cm9EeIeAB7ZRchuuzH7blEx idctUb9pbDT9XeD+ttb98VEgxOnApGVE1zNM4NTbTbFZbuptkCptwdhilovkxyxgo4K3iz LuqK2sUG09D7/FlAkA9x1siboKjkE9kWwPTSD9I+fgNVwQNobSHhVPajkGKLw/2C0oUc/4 KxFGtGDmtyf4KQymGGJmXwQKNK2SYIfeHwuv168gOd8bAUyu4jrPblqGSNuZWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 19FBD1F152 X-Spam-Score: -2.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: gvD7SwoDb1Kr Hi Maxime, Maxime Devos skribis: > A patch defining simple =E2=80=98ipfs-service-type=E2=80=99 is attached. = I've tested > this in a VM, and will test it on a =E2=80=98real=E2=80=99 system later. = The gateway > is currently broken, it tries to redirect to non-existent subdomains > of localhost. Correcting this might require fiddling with the DNS > configuration. OK. That doesn=E2=80=99t prevent one from using it, right? > From c441bca727df67837652eb2f0b5ad23528fd11a3 Mon Sep 17 00:00:00 2001 > From: Maxime Devos > Date: Fri, 15 Jan 2021 21:46:42 +0100 > Subject: [PATCH] services: Add ipfs-service-type > > * gnu/services/networking.scm (ipfs-service-type) > (%ipfs-home-mapping, %ipfs-environment) > (%ipfs-accounts, %ipfs-home): New variables. > (ipfs-configuration, ipfs-configuration?) > (ipfs-configuration-package, ipfs-configuration-gateway) > (ipfs-configuration-api, ipfs-shepherd-service) > (ipfs-binary, %ipfs-activation): New procedures. > * doc/guix.texi (Networking Services): Document it. [...] > +@lisp > +;; part of the operating-system declaration I think you can omit this line. > +(service ipfs-service-type > + (ipfs-configuration > + (gateway "/ip4/127.0.0.1/tcp/8880") > + (api "/ip4/127.0.0.1/tcp/8881"))) Indentation is left (should be aligned with =E2=80=98ipfs-service-type=E2= =80=99.) > + (start #~(make-forkexec-constructor/container > + #$ipfs-daemon-command > + #:namespaces '#$(fold delq %namespaces '(user net)) > + #:mappings (list #$%ipfs-home-mapping) > + #:log-file "/var/log/ipfs.log" > + #:user "ipfs" > + #:group "ipfs" > + #:environment-variables #$%ipfs-environment)) Nice! > + ;; Run ipfs init and ipfs config from a container, > + ;; in case the IPFS daemon was compromised at some point > + ;; and ~/.ipfs is now a symlink to somewhere outside > + ;; %ipfs-home. > + (define container-gexp > + (with-extensions (list shepherd) > + (with-imported-modules (source-module-closure > + '((gnu build shepherd) > + (gnu system file-systems))) > + #~(begin > + (use-modules (gnu build shepherd) > + (gnu system file-systems)) > + (let* ((constructor > + (make-forkexec-constructor/container > + (list #$inner-script) > + #:namespaces '#$(fold delq %namespaces '(user)) > + #:mappings (list #$%ipfs-home-mapping) > + #:user "ipfs" > + #:group "ipfs" > + #:environment-variables #$%ipfs-environment)) > + (pid (constructor))) > + (waitpid pid)))))) > + ;; The activation may happen from the initrd, which uses > + ;; a statically-linked guile, while the guix container > + ;; procedures require a working dynamic-link. > + (define container-script > + (program-file "ipfs-activation-container" container-gexp)) > + #~(system* #$container-script)) That=E2=80=99s a bit involved, but it makes sense to me. The patch LGTM. However, we usually commit services along with a system test under (gnu tests =E2=80=A6). The manual has info on how to run indivi= dual system tests: https://guix.gnu.org/manual/en/html_node/Running-the-Test-Suite.html Could you write a test that ensures that basic functionality works? It could be as simple as waiting for the service to be up, then invoking =E2=80=98ipfs add=E2=80=99 and =E2=80=98ipfs get=E2=80=99. WDYT? Thank you! Ludo=E2=80=99.