From patchwork Wed Sep 1 19:14:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 32492 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C832327BBE1; Wed, 1 Sep 2021 20:22:21 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 03D8627BBE3 for ; Wed, 1 Sep 2021 20:22:17 +0100 (BST) Received: from localhost ([::1]:39580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLVoO-0003Tq-01 for patchwork@mira.cbaines.net; Wed, 01 Sep 2021 15:22:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLVoA-0003ST-8h for guix-patches@gnu.org; Wed, 01 Sep 2021 15:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mLVoA-0004yU-0e for guix-patches@gnu.org; Wed, 01 Sep 2021 15:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mLVo9-0000AR-Od for guix-patches@gnu.org; Wed, 01 Sep 2021 15:22:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50326] [PATCH cuirass] Add systemd unit file for remote worker service. Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 01 Sep 2021 19:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50326 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50326@debbugs.gnu.org Cc: Thiago Jung Bauermann X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1630524103615 (code B ref -1); Wed, 01 Sep 2021 19:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Sep 2021 19:21:43 +0000 Received: from localhost ([127.0.0.1]:39026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mLVnm-00009n-Ab for submit@debbugs.gnu.org; Wed, 01 Sep 2021 15:21:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:42112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mLVng-00009b-Q6 for submit@debbugs.gnu.org; Wed, 01 Sep 2021 15:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLVng-0002n2-K1 for guix-patches@gnu.org; Wed, 01 Sep 2021 15:21:32 -0400 Received: from mx.kolabnow.com ([95.128.36.41]:3406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLVnY-0004Qy-Gl for guix-patches@gnu.org; Wed, 01 Sep 2021 15:21:31 -0400 Received: from localhost (unknown [127.0.0.1]) by ext-mx-out002.mykolab.com (Postfix) with ESMTP id 39E50BCD for ; Wed, 1 Sep 2021 21:15:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim20160331; t=1630523704; x=1632338105; bh=eaJgfIvgDMKpZrcmL53NtvlZG2CnyERW5cJjeyA0cX4=; b=fQbVPLSEIQtR 695gQjmiFKnU7WZ/Vh4H8TtseNA69WL6cNBaBjJJaPCDZthsW2kXK6PC9KEYV+x5 cPZw3a+yVqSXy631/ItqrMyn1R/OEakkBHuuAKn41O+KuKHxStNQyRJP/2tComd/ EibVl0ygA9whIq9fm+WyPF3o2sbZfBPVqncz/I1t61V2qwisu13DdgArDvLmdlXD 6OBJqh8PjDBnxRpG2if0YUJYYvMtFKMIXmbRfjgAjxp4t6ZPSzI9JrivFBtTuDir 1U2FmyqFg6hr5M48r9/MqjRcFuS8bWzPkTp+qDGqBf2k/6zkIntcxDuJom5JgwI9 5jHqZoCLamtdTs/xCLx+3hmQ3SjJjYbRHaLJ3/IPBe2TLXIRXF4uAnekyDZeicNn LVO6hKQpPeFiHg1TV+4FdSerGaVkME2fJehTM8dm/UiZJ4SCvkAA6gW1DsGDGE9o fWfLR6qc8LuDz589ccO/uH7jxFJWwR3GRufSxAbdOLh5USvTHkICkC2ANbs4N3/4 L/lb7M67/c6BRFN0XMUuw7SY+ZP3krV/kKe2eybQYAy41ihDDISqeUtNNy20IWlG yiYvhfR9PJpeKp0xeswEDf6uBsfhR4uk+BXWDCff9G4oO2iiT/2XwYgNgVytoQwX BVGZFolpUpyqgSZuIylXBXay6vEvQKg= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id olWNdKwmIE1d for ; Wed, 1 Sep 2021 21:15:04 +0200 (CEST) Received: from int-mx003.mykolab.com (unknown [10.9.13.3]) by ext-mx-out002.mykolab.com (Postfix) with ESMTPS id CC7C8BBA for ; Wed, 1 Sep 2021 21:15:03 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx003.mykolab.com (Postfix) with ESMTPS id F11FC2E9D; Wed, 1 Sep 2021 21:15:02 +0200 (CEST) Date: Wed, 1 Sep 2021 16:14:43 -0300 Message-Id: <20210901191443.59352-1-bauermann@kolabnow.com> MIME-Version: 1.0 Received-SPF: pass client-ip=95.128.36.41; envelope-from=bauermann@kolabnow.com; helo=mx.kolabnow.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches X-Patchwork-Original-From: Thiago Jung Bauermann via Guix-patches via From: Thiago Jung Bauermann X-getmail-retrieved-from-mailbox: Patches * etc/cuirass-remote-worker.service.in: New file. * doc/cuirass.texi: Mention it. * .gitignore: Ignore it. * Makefile.am (noinst_SCRIPTS): Add ‘etc/cuirass-remote-worker.service’. (EXTRA_DIST): Likewise. (etc/cuirass-remote-worker.service): New target. * configure.ac: Check for ‘(guix config)’ module. Set ‘guix_localstatedir’ variable. --- Hello, This patch adds the systemd unit file I installed on guixp9. The configure script finds out Guix’s localstatedir and substitutes it in etc/cuirass-remote-worker.service.in. The service file isn’t installed anywhere and the user is supposed to get it from the build directory if they want to use it. I did it this way because there’s no $PREFIX/doc/examples directory or equivalent where it could be shipped, and I thought that it would be excessive to add it to all Cuirass installations considering that only a few of them would actually have a use for it. But I can send a v2 making this change if people think it would be better. .gitignore | 1 + Makefile.am | 8 +++++++- configure.ac | 4 ++++ doc/cuirass.texi | 13 +++++++++++++ etc/cuirass-remote-worker.service.in | 15 +++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 etc/cuirass-remote-worker.service.in diff --git a/.gitignore b/.gitignore index 95ed6cb3982c..0807874e9513 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ /config.cache /configure /doc/version.texi +/etc/cuirass-remote-worker.service /src/cuirass/config.scm /tests/cache Makefile diff --git a/Makefile.am b/Makefile.am index 1d754673f450..6c5dab26f105 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,9 @@ bin_SCRIPTS = \ bin/cuirass -noinst_SCRIPTS = pre-inst-env +noinst_SCRIPTS = \ + pre-inst-env \ + etc/cuirass-remote-worker.service guilesitedir = $(datarootdir)/guile/site/@GUILE_EFFECTIVE_VERSION@ guileobjectdir = $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache @@ -188,6 +190,7 @@ EXTRA_DIST = \ bootstrap \ build-aux/guix.scm \ src/cuirass/config.scm.in \ + etc/cuirass-remote-worker.service.in \ $(TESTS) dist-hook: gen-ChangeLog @@ -247,6 +250,9 @@ $(bin_SCRIPTS): Makefile $(generate_file); chmod +x $@ src/cuirass/config.scm: $(srcdir)/src/cuirass/config.scm.in Makefile $(generate_file) +etc/cuirass-remote-worker.service: $(srcdir)/etc/cuirass-remote-worker.service.in \ + Makefile + $(generate_file) # Guile modules require 'src/cuirass/config.scm' to exist before their # compilation. diff --git a/configure.ac b/configure.ac index 479e93a1cb8e..af294c16d025 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,7 @@ GUILE_MODULE_REQUIRED([avahi]) GUILE_MODULE_REQUIRED([fibers]) GUILE_MODULE_REQUIRED([guix]) GUILE_MODULE_REQUIRED([guix git]) +GUILE_MODULE_REQUIRED([guix config]) GUILE_MODULE_REQUIRED([git]) GUILE_MODULE_REQUIRED([json]) GUILE_MODULE_REQUIRED([mailutils mailutils]) @@ -58,6 +59,9 @@ GUILE_MODULE_REQUIRED([zlib]) # We depend on new Guile-Git errors. GUILE_MODULE_REQUIRED_EXPORT([(git)], git-error-message) +guix_localstatedir="$($GUILE -c '(import (guix config)) (display %localstatedir)')" +AC_SUBST(guix_localstatedir) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in], [chmod +x pre-inst-env]) diff --git a/doc/cuirass.texi b/doc/cuirass.texi index 72b0b5b0913a..e32ab29e5d5d 100644 --- a/doc/cuirass.texi +++ b/doc/cuirass.texi @@ -463,6 +463,19 @@ The easiest way to setup such an infrastructure is to rely on the GNU Guix Cuirass services definitions (@pxref{Continuous Integration, Continuous Integration,, guix, Guix}). +Alternatively, there is a systemd service unit file at +@code{etc/cuirass-remote-worker.service} to launch the +@code{cuirass remote-worker} on systems which use systemd. It can be +installed and enabled as follows: + +@example +sudo install -o root -g root -m 644 \ + $CUIRASS_BUILD_DIR/etc/cuirass-remote-worker.service \ + /etc/systemd/system +sudo systemctl enable cuirass-remote-worker.service +sudo systemctl start cuirass-remote-worker.service +@end example + @c ********************************************************************* @node Invocation @chapter Invocation diff --git a/etc/cuirass-remote-worker.service.in b/etc/cuirass-remote-worker.service.in new file mode 100644 index 000000000000..2c334d74804f --- /dev/null +++ b/etc/cuirass-remote-worker.service.in @@ -0,0 +1,15 @@ +# This is a "service unit file" for the systemd init system to launch +# 'cuirass remote-worker'. Drop it in /etc/systemd/system or similar +# to have 'cuirass remote-worker' automatically started. + +[Unit] +Description=Continuous integration remmote worker for GNU Guix + +[Service] +ExecStart=@guix_localstatedir@/guix/profiles/per-user/root/guix-profile/bin/cuirass \ + remote-worker --workers=2 --server=10.0.0.1:5555 +Environment= LC_ALL=en_US.UTF-8 \ + 'GUIX_LOCPATH=@guix_localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' + +[Install] +WantedBy=multi-user.target