Subject: bug#77585: closed (Re: [bug#77585] [PATCH] services: mumi: Add Debbugs rsync as shepherd timer.)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 23 Apr 2025 02:20:01 +0000

Your bug report

#77585: [PATCH] services: mumi: Add Debbugs rsync as shepherd timer.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77585: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77585
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#77585] [PATCH] services: mumi: Add Debbugs rsync as shepherd timer.
From: Maxim Cournoyer <[email-masked]>
To: Arun Isaac <[email-masked]>
Cc: Ludovic Courtès <[email-masked]>, [email-masked]
Date: Wed, 23 Apr 2025 11:19:09 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Arun Isaac <[email-masked]> writes:

[...]

I think you'll see the new timer in 'herd status', e.g. on my machine:

Running timers:
 + log-cleanup
 + log-rotation

I assume they should be started automatically.

I'll close this issue as I'm assuming it's been taken care of already o
berlin.  Feel free to reopen if there are issues.

-- 
Thanks,
Maxim

Subject: [PATCH] services: mumi: Add Debbugs rsync as shepherd timer.
From: Arun Isaac <[email-masked]>
To: [email-masked]
Cc: Arun Isaac <[email-masked]>,Ludovic Courtès <[email-masked]>, Maxim Cournoyer <[email-masked]>
Date: Sun, 6 Apr 2025 20:30:27 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/services/web.scm (<mumi-configuration>)[data-directory, rsync-remote,
rsync-flags]: New fields.
(%mumi-worker-log): Delete variable.
(%mumi-rsync-and-index-log): New variable.
(mumi-rsync-and-index-gexp): New function.
(mumi-shepherd-services): Remove mumi-worker service. Add mumi-rsync-and-index
service.
(mumi-service-type): Remove default value.
* doc/guix.texi (Web Services)[mumi]: Document data-directory, rsync-remote
and rsync-flags fields.

Co-authored-by: Maxim Cournoyer <[email-masked]>
---
 doc/guix.texi        |  9 +++++++
 gnu/services/web.scm | 57 ++++++++++++++++++++++++++++++++------------
 2 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 12f155e912..b6c0e64a53 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -33999,6 +33999,15 @@ Web Services
 @item @code{mumi} (default: @code{mumi})
 The Mumi package to use.
 
+@item @code{data-directory} (default: @file{"/var/mumi/data"})
+Data directory to store Debbugs data from upstream Debbugs instance.
+
+@item @code{rsync-remote}
+Remote rsync path from which to download Debbugs data.
+
+@item @code{rsync-flags} (default: @code{'()})
+Additional flags to pass to @command{rsync}.
+
 @item @code{mailer?} (default: @code{#true})
 Whether to enable or disable the mailer component.
 
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index f8cf06fb48..eea9a19426 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2023 Bruno Victal <[email-masked]>
 ;;; Copyright © 2023 Miguel Ángel Moreno <[email-masked]>
 ;;; Copyright © 2024 Leo Nikkilä <[email-masked]>
+;;; Copyright © 2025 Maxim Cournoyer <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -51,6 +52,7 @@ (define-module (gnu services web)
   #:use-module (gnu packages php)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
+  #:use-module (gnu packages rsync)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages logging)
@@ -295,6 +297,9 @@ (define-module (gnu services web)
             mumi-configuration
             mumi-configuration?
             mumi-configuration-mumi
+            mumi-configuration-data-directory
+            mumi-configuration-rsync-remote
+            mumi-configuration-rsync-flags
             mumi-configuration-mailer?
             mumi-configuration-sender
             mumi-configuration-smtp
@@ -2033,6 +2038,11 @@ (define-record-type* <mumi-configuration>
   mumi-configuration make-mumi-configuration
   mumi-configuration?
   (mumi    mumi-configuration-mumi (default mumi))
+  (data-directory mumi-configuration-data-directory
+                  (default "/var/mumi/data"))
+  (rsync-remote mumi-configuration-rsync-remote)
+  (rsync-flags mumi-configuration-rsync-flags
+               (default '()))
   (mailer? mumi-configuration-mailer? (default #t))
   (sender  mumi-configuration-sender (default #f))
   (smtp    mumi-configuration-smtp (default #f))
@@ -2080,7 +2090,7 @@ (define %mumi-log "/var/log/mumi.log")
 
 (define %mumi-mailer-log "/var/log/mumi.mailer.log")
 
-(define %mumi-worker-log "/var/log/mumi.worker.log")
+(define %mumi-rsync-and-index-log "/var/log/mumi.rsync-and-index.log")
 
 (define mumi-package-configuration->alist
   (match-record-lambda <mumi-package-configuration>
@@ -2118,6 +2128,23 @@ (define mumi-config-file
                                           packages)))
                               <>))))))
 
+(define (mumi-rsync-and-index-gexp config)
+  (match-record config <mumi-configuration>
+    (data-directory rsync-remote rsync-flags)
+    (with-imported-modules '((guix build utils))
+      #~(begin
+          (use-modules (guix build utils))
+
+          (invoke #$(file-append rsync "/bin/rsync")
+                  "--delete" "--archive" "--verbose"
+                  "--timeout" "120"
+                  #$@rsync-flags
+                  #$rsync-remote
+                  #$data-directory)
+          (invoke #$(file-append mumi "/bin/mumi") "fetch"
+                  (string-append "--config="
+                                 #$(mumi-config-file config)))))))
+
 (define (mumi-shepherd-services config)
   (define environment
     #~(list "LC_ALL=en_US.utf8"
@@ -2140,17 +2167,19 @@ (define (mumi-shepherd-services config)
                       #:log-file #$%mumi-log))
             (stop #~(make-kill-destructor)))
            (shepherd-service
-            (provision '(mumi-worker))
-            (documentation "Mumi bug-tracking web interface database worker.")
-            (requirement '(user-processes networking))
-            (start #~(make-forkexec-constructor
-                      `(#$(file-append mumi "/bin/mumi") "worker"
-                        ,(string-append "--config="
-                                        #$(mumi-config-file config)))
-                      #:environment-variables #$environment
-                      #:user "mumi" #:group "mumi"
-                      #:log-file #$%mumi-worker-log))
-            (stop #~(make-kill-destructor)))
+            (provision '(mumi-rsync-and-index))
+            (modules '((shepherd service timer)))
+            (start #~(make-timer-constructor
+                      (calendar-event)
+                      (command
+                       (program-file "mumi-rsync-and-index"
+                                     (mumi-rsync-and-index-gexp config)))
+                      #:log-file #$%mumi-rsync-and-index-log
+                      #:max-duration (* 60 60)
+                      #:wait-for-termination? #t))
+            (stop #~(make-timer-destructor))
+            (actions (list shepherd-trigger-action))
+            (documentation "Rsync and index the GNU Debbugs data"))
            (shepherd-service
             (provision '(mumi-mailer))
             (documentation "Mumi bug-tracking web interface mailer.")
@@ -2181,9 +2210,7 @@ (define mumi-service-type
           (service-extension shepherd-root-service-type
                              mumi-shepherd-services)))
    (description
-    "Run Mumi, a Web interface to the Debbugs bug-tracking server.")
-   (default-value
-     (mumi-configuration))))
+    "Run Mumi, a Web interface to the Debbugs bug-tracking server.")))
 
 (define %default-gmnisrv-config-file
   (plain-file "gmnisrv.ini" "

base-commit: ada14197fb465c1c90efbc450308c14f077ff167
-- 
2.49.0