GNU bug report logs - #50326
[PATCH cuirass] Add systemd unit file for remote worker service.

Previous Next

Package: guix-patches;

Reported by: Thiago Jung Bauermann <bauermann <at> kolabnow.com>

Date: Wed, 1 Sep 2021 19:22:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50326 in the body.
You can then email your comments to 50326 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#50326; Package guix-patches. (Wed, 01 Sep 2021 19:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thiago Jung Bauermann <bauermann <at> kolabnow.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 01 Sep 2021 19:22:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: guix-patches <at> gnu.org
Cc: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Subject: [PATCH cuirass] Add systemd unit file for remote worker service.
Date: Wed,  1 Sep 2021 16:14:43 -0300
* 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




Information forwarded to guix-patches <at> gnu.org:
bug#50326; Package guix-patches. (Wed, 08 Sep 2021 14:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 50326 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Cc: 50326 <at> debbugs.gnu.org
Subject: Re: bug#50326: [PATCH cuirass] Add systemd unit file for remote
 worker service.
Date: Wed, 08 Sep 2021 16:01:06 +0200
Hello!

Thiago Jung Bauermann <bauermann <at> kolabnow.com> skribis:

> * 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.

With this approach, the user has to get the source and configure it,
which is somewhat annoying.

I’d prefer installing it to $sysconfdir, similar to how we do it in
Guix.  That makes it easier for interested users to locate the right
.service and to install it, right after they’ve done ‘guix install
cuirass’.

WDYT?

If that’s fine with you, I’ll happily push v2 on your behalf!

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#50326; Package guix-patches. (Wed, 08 Sep 2021 14:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 50326 <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 50326 <at> debbugs.gnu.org
Subject: Re: bug#50326: [PATCH cuirass] Add systemd unit file for remote
 worker service.
Date: Wed, 08 Sep 2021 11:24:58 -0300
Hello Ludo!

Em quarta-feira, 8 de setembro de 2021, às 11:01:06 -03, Ludovic Courtès 
escreveu:
> Hello!
> 
> Thiago Jung Bauermann <bauermann <at> kolabnow.com> skribis:
> > * 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.
> 
> With this approach, the user has to get the source and configure it,
> which is somewhat annoying.

Yes, that is true.

> I’d prefer installing it to $sysconfdir, similar to how we do it in
> Guix.  That makes it easier for interested users to locate the right
> .service and to install it, right after they’ve done ‘guix install
> cuirass’.
> 
> WDYT?

I think it’s a good idea.

> If that’s fine with you, I’ll happily push v2 on your behalf!

Of course! Feel free to do that. Thank you for the offer, and for reviewing 
this patch!

-- 
Thanks,
Thiago






Information forwarded to guix-patches <at> gnu.org:
bug#50326; Package guix-patches. (Thu, 16 Sep 2021 02:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 50326 <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 50326 <at> debbugs.gnu.org, Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Subject: [PATCH cuirass v2] Add systemd unit file for remote worker service.
Date: Wed, 15 Sep 2021 23:38:44 -0300
* etc/cuirass-remote-worker.service.in: New file.
* doc/cuirass.texi (Build modes): Mention it.
* .gitignore: Ignore it.
* Makefile.am (systemdservicedir): New variable.
(dist_systemdservice_DATA): Likewise.
(EXTRA_DIST): Add ‘etc/cuirass-remote-worker.service’.
(etc/cuirass-remote-worker.service): New target.
* configure.ac: Check for ‘(guix config)’ module.
Set and substitute ‘guix_localstatedir’ variable.
---

Hello Ludo,

I wanted to send the other patch with the new systemd files for ‘guix gc’ (issue
50610), so I took the opportunity to also work on this one.

Em quarta-feira, 8 de setembro de 2021, às 11:01:06 -03, Ludovic Courtès escreveu:
> I’d prefer installing it to $sysconfdir, similar to how we do it in
> Guix.  That makes it easier for interested users to locate the right
> .service and to install it, right after they’ve done ‘guix install
> cuirass’.

Guix actually installs its systemd files in $libdir, so I did the same for
Cuirass. Feel free to change the patch to install to another place if you
prefer.

Thanks,
Thiago

 .gitignore                           |  1 +
 Makefile.am                          |  8 ++++++++
 configure.ac                         |  4 ++++
 doc/cuirass.texi                     | 13 +++++++++++++
 etc/cuirass-remote-worker.service.in | 15 +++++++++++++++
 5 files changed, 41 insertions(+)
 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..6cfa3d70e612 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,6 +45,7 @@ cssdir = $(staticdir)/css
 fontsdir = $(staticdir)/fonts
 imagesdir = $(staticdir)/images
 jsdir = $(staticdir)/js
+systemdservicedir = $(libdir)/systemd/system
 
 dist_pkgmodule_DATA =				\
   src/cuirass/base.scm				\
@@ -129,6 +130,9 @@ dist_js_DATA =					\
   src/static/js/jquery-3.3.1.min.js		\
   src/static/js/popper.min.js
 
+dist_systemdservice_DATA =			\
+  etc/cuirass-remote-worker.service
+
 TEST_EXTENSIONS = .scm .sh
 AM_TESTS_ENVIRONMENT = \
   env GUILE_AUTO_COMPILE='0' \
@@ -188,6 +192,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 +252,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..21d25569339a 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 installed at
+@code{$CUIRASS_PREFIX/lib/systemd/system/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_PREFIX/lib/systemd/system/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




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 16 Sep 2021 20:06:02 GMT) Full text and rfc822 format available.

Notification sent to Thiago Jung Bauermann <bauermann <at> kolabnow.com>:
bug acknowledged by developer. (Thu, 16 Sep 2021 20:06:02 GMT) Full text and rfc822 format available.

Message #19 received at 50326-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Cc: 50326-done <at> debbugs.gnu.org
Subject: Re: [PATCH cuirass v2] Add systemd unit file for remote worker
 service.
Date: Thu, 16 Sep 2021 22:04:55 +0200
Hi Thiago,

Thiago Jung Bauermann <bauermann <at> kolabnow.com> skribis:

> * etc/cuirass-remote-worker.service.in: New file.
> * doc/cuirass.texi (Build modes): Mention it.
> * .gitignore: Ignore it.
> * Makefile.am (systemdservicedir): New variable.
> (dist_systemdservice_DATA): Likewise.
> (EXTRA_DIST): Add ‘etc/cuirass-remote-worker.service’.
> (etc/cuirass-remote-worker.service): New target.
> * configure.ac: Check for ‘(guix config)’ module.
> Set and substitute ‘guix_localstatedir’ variable.

Applied, thanks!

> Guix actually installs its systemd files in $libdir, so I did the same for
> Cuirass. Feel free to change the patch to install to another place if you
> prefer.

$libdir is fine with me.

Cheers,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#50326; Package guix-patches. (Thu, 16 Sep 2021 20:18:02 GMT) Full text and rfc822 format available.

Message #22 received at 50326-done <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 50326-done <at> debbugs.gnu.org
Subject: Re: [PATCH cuirass v2] Add systemd unit file for remote worker
 service.
Date: Thu, 16 Sep 2021 17:17:06 -0300
Hello Ludo,

Em quinta-feira, 16 de setembro de 2021, às 17:04:55 -03, Ludovic Courtès 
escreveu:
> Hi Thiago,
> 
> Thiago Jung Bauermann <bauermann <at> kolabnow.com> skribis:
> > * etc/cuirass-remote-worker.service.in: New file.
> > * doc/cuirass.texi (Build modes): Mention it.
> > * .gitignore: Ignore it.
> > * Makefile.am (systemdservicedir): New variable.
> > (dist_systemdservice_DATA): Likewise.
> > (EXTRA_DIST): Add ‘etc/cuirass-remote-worker.service’.
> > (etc/cuirass-remote-worker.service): New target.
> > * configure.ac: Check for ‘(guix config)’ module.
> > Set and substitute ‘guix_localstatedir’ variable.
> 
> Applied, thanks!
> 
> > Guix actually installs its systemd files in $libdir, so I did the same
> > for Cuirass. Feel free to change the patch to install to another place
> > if you prefer.
> 
> $libdir is fine with me.

Thanks!

-- 
Thanks,
Thiago






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Oct 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.