From patchwork Sat Mar 22 11:36:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40585 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 1130027BBEA; Sat, 22 Mar 2025 11:38:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 75C1D27BBE2 for ; Sat, 22 Mar 2025 11:38:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxB9-0001q1-Bb; Sat, 22 Mar 2025 07:38:16 -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 1tvxAx-0001ks-Uc for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -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 1tvxAw-000062-PH; Sat, 22 Mar 2025 07:38:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=kKFwC/YhTb7T7zwFlaAjiepVG764iIJVG4MkOXfEuV8=; b=F+WwcK7RA3ktHib+2nJdTRo9ELarqmLPfTAYDmFx6rwuwAdRwsjyvJ4WltcohzNp+MPafVyjYMvhS02fsQTtobEfE8mEDOggUI+5CmCvqeKjS+Mdb0YJtTqR5UWzrx+YUO25u3nAJYb6ZdGqRkCOVNBv4ze720i0RoDgffhyCWbfivGSYn/nYPOnL57q1zehComutegrnbBgM0mSiRndvnruDeQoJWMqq8otzQxH8nWFfkDKyPoGPGNMojJINPSxxgGmOUpdHVcRMw6bion8A+vX0Ua0dWJSRUtP0XHMP+igVL2oMPL6vfMOe7APKKV5z5mm1Kaqcs26QJHddreCmw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAw-0002YB-5y; Sat, 22 Mar 2025 07:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 01/16] services: shepherd: Factorize =?utf-8?b?4oCYdHJpZ2dlcuKAmQ==?= action. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour X-Debbugs-Original-Xcc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434479574 (code B ref 77041); Sat, 22 Mar 2025 11:38:02 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:27 +0000 Received: from localhost ([127.0.0.1]:41149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAM-0002UL-Sv for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33524) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAF-0002TS-S5 for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:20 -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 1tvxAA-0008Sv-Cz; Sat, 22 Mar 2025 07:37:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=kKFwC/YhTb7T7zwFlaAjiepVG764iIJVG4MkOXfEuV8=; b=FZhOE8tjeGKfyiyEx2Sc tDHiLTf4m+W5B4kNQNIQhEU1wt8p7GF+GYVQFGQmjq3Uru28xsGQ1TfwyD6xdRb1BXLzHUCGTiukQ tqyevyuhjuvI/+6FWe9aB6HOJ7ogdrC6M1BQnWQ9BBapS+tHnX6TsMuyVClH7nwzvtwECKJ9nBjCB qO3sBQ/d3K58a5i9bnmt3B9MzN37T/LEtcJojDL/H4mHOkP9diCuUoSyWAzi1lPXZyzpNaQ1X85hQ KtZsn019cIqRM5yTzCdkMFJVev1NOw49y+iKpZKxcfGuDdBQ5ybTw8cIVgn2H4RU1xV9SaDfC4DG+ 64yzxhHjEbf4bQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:38 +0100 Message-ID: <3aa2a59b21ca35f4821768248914c85f77ab4868.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/shepherd.scm (shepherd-trigger-action): New variable. * gnu/services/admin.scm (log-cleanup-shepherd-services) (unattended-upgrade-shepherd-services): Use it. * gnu/services/backup.scm (restic-backup-job->shepherd-service): Use it. * gnu/home/services/shepherd.scm: Re-export ‘shepherd-trigger-action’. Change-Id: I834b5b9b61c78f012ee9306df6cf4fd8a93dd6d2 --- gnu/home/services/shepherd.scm | 3 ++- gnu/services/admin.scm | 10 ++-------- gnu/services/backup.scm | 6 +----- gnu/services/shepherd.scm | 8 ++++++++ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm index b2b141d4de..25f1641b32 100644 --- a/gnu/home/services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -52,7 +52,8 @@ (define-module (gnu home services shepherd) shepherd-service-modules shepherd-action - shepherd-configuration-action)) + shepherd-configuration-action + shepherd-trigger-action)) (define-record-type* home-shepherd-configuration make-home-shepherd-configuration diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 2a11a4f4f1..726ca5f918 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -404,10 +404,7 @@ (define (log-cleanup-shepherd-services configuration) schedule) (command '(#$program)))) (stop #~(make-timer-destructor)) - (actions (list (shepherd-action - (name 'trigger) - (documentation "Trigger log cleanup.") - (procedure #~trigger-timer)))) + (actions (list shepherd-trigger-action)) (documentation "Periodically delete old log files.")))))) (define log-cleanup-service-type @@ -671,10 +668,7 @@ (define (unattended-upgrade-shepherd-services config) ;; again. #:wait-for-termination? #t)) (stop #~(make-timer-destructor)) - (actions (list (shepherd-action - (name 'trigger) - (documentation "Trigger unattended system upgrade.") - (procedure #~trigger-timer))))))) + (actions (list shepherd-trigger-action))))) (define unattended-upgrade-service-type (service-type diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm index 4d8cf167f0..6e066bd3d6 100644 --- a/gnu/services/backup.scm +++ b/gnu/services/backup.scm @@ -255,11 +255,7 @@ (define (restic-backup-job->shepherd-service config) max-duration))) (stop #~(make-timer-destructor)) - (actions (list (shepherd-action - (name 'trigger) - (documentation "Manually trigger a backup, -without waiting for the scheduled time.") - (procedure #~trigger-timer))))))) + (actions (list shepherd-trigger-action))))) (define (restic-guix-wrapper-package jobs) (package diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 65c49b9c59..e7e414b920 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -72,6 +72,7 @@ (define-module (gnu services shepherd) shepherd-action-procedure shepherd-configuration-action + shepherd-trigger-action %default-modules @@ -404,6 +405,13 @@ (define (shepherd-configuration-action file) (format #t "~a~%" #$file) #$file)))) +(define shepherd-trigger-action + ;; Action to trigger a timer. + (shepherd-action + (name 'trigger) + (documentation "Trigger immediate execution of this timer.") + (procedure #~trigger-timer))) + (define (shepherd-configuration-file services shepherd) "Return the shepherd configuration file for SERVICES. SHEPHERD is used as shepherd package." From patchwork Sat Mar 22 11:36:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40595 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 84DFB27BBE9; Sat, 22 Mar 2025 11:38:54 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AA81F27BBE2 for ; Sat, 22 Mar 2025 11:38:53 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxB1-0001mE-Tf; Sat, 22 Mar 2025 07:38:08 -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 1tvxAx-0001kq-5q for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:03 -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 1tvxAw-000063-Qu; Sat, 22 Mar 2025 07:38:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=A9CsfCmB1L872i5JSIhAgCXZn/rLv0CIkxfwiPoFeOE=; b=Kky88CoWFJfjaijQESI4YhOQ9RzDv2PKcRPdftmr8wyX5+ftEpGIX5fC2oQqyWn6Ma5uCj/NcWFCnIF6qq5K4v6HuUbYFQSObabjvq2K4PVhK9fGQjK45t7BQUAbC84Z9tQXQF6nlLNOKOxlpzc95trVfAnBM+mlgmsjvRuXP22jBUYqgZnNSjSX5ck84sDrfK/rDmszfHXONFrph9+x5OIV3Qz2rSlWlClNeOfNNZytWcUu9rpHL6Gn/FkvhtbNWFoq9R5D6RFiFm7josnDmvWdBoUv4nDojjUqjyObXs2Niun5xl245FCOC/fS3YMLSGOVuomuinVCUudahZx05g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAw-0002YI-L9; Sat, 22 Mar 2025 07:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 02/16] services: file-database: Turn into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434489591 (code B ref 77041); Sat, 22 Mar 2025 11:38:02 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:28 +0000 Received: from localhost ([127.0.0.1]:41153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAN-0002UN-Ip for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33528) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAJ-0002TX-My for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:24 -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 1tvxAE-0008T3-EQ; Sat, 22 Mar 2025 07:37:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=A9CsfCmB1L872i5JSIhAgCXZn/rLv0CIkxfwiPoFeOE=; b=TudasvZpViYcOlBZ6RmQ CDnQ9jiWFFTdstUKAxD49nnluX6PznLMt3EUyzPKFDYAdNtKbjq3bY6YgCIFds67LEn7HSmuDFQxT jINQ3n7679vPsNkSoy3zRErHvnCZVyHqvSL2btILKT/KUMLemjyEiPvKxw6Q2zFkapdjZh79zySyq Hm1C8/JeENWc5fdOfO6hIQQsTDsbzM5zUPYwpXG3ZcOuZcV4BPeA4ruk1xJoLf2dQ5cw66jeGF+OR M5yxurl0fvG4dplpB0YdP28FMMSMt/DWoa0pw2bXcTDdIJZq/RJ0cVurkfTuO98keN6FT891nmxow T5+mzmKas7S+9g==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:39 +0100 Message-ID: <3652998fa2af326e775f7aa7f63356e73e2ff6fa.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/admin.scm (file-database-mcron-jobs): Rename to… (file-database-shepherd-services): … this. Return a list of Shepherd services. (file-database-service-type): Adjust accordingly. * doc/guix.texi (File Search Services): Update documentation of ‘schedule’. Change-Id: I5734c629b113e54057694d2ec480abd26b7815db --- doc/guix.texi | 5 +++-- gnu/services/admin.scm | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0adc6f8c65..9e3b452577 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27162,8 +27162,9 @@ File Search Services is taken. @item @code{schedule} (default: @code{%default-file-database-update-schedule}) -String or G-exp denoting an mcron schedule for the periodic -@command{updatedb} job (@pxref{Guile Syntax,,, mcron, GNU@tie{}mcron}). +This is the schedule of database updates, expressed as a string in +traditional cron syntax or as a gexp evaluating to a Shepherd calendar +event (@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). @item @code{excluded-directories} (default @code{%default-file-database-excluded-directories}) List of regular expressions of directories to ignore when building the diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 726ca5f918..5f5b76ffbb 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -462,7 +462,7 @@ (define-configuration/no-serialization file-database-configuration guix locate}). This list is passed to the @option{--prunepaths} option of @command{updatedb} (@pxref{Invoking updatedb,,, find, GNU@tie{}Findutils}).")) -(define (file-database-mcron-jobs configuration) +(define (file-database-shepherd-services configuration) (match-record configuration (package schedule excluded-directories) (let ((updatedb (program-file @@ -481,13 +481,27 @@ (define (file-database-mcron-jobs configuration) #$(string-append "--prunepaths=" (string-join excluded-directories))))))) - (list #~(job #$schedule #$updatedb))))) + (list (shepherd-service + (provision '(file-database-update)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command '(#$updatedb)) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation + "Periodically update the system-wide file database that can be +queried by the 'locate' command.") + (actions (list shepherd-trigger-action))))))) (define file-database-service-type (service-type (name 'file-database) - (extensions (list (service-extension mcron-service-type - file-database-mcron-jobs))) + (extensions (list (service-extension shepherd-root-service-type + file-database-shepherd-services))) (description "Periodically update the file database used by the @command{locate} command, which lets you search for files by name. The database is created by running From patchwork Sat Mar 22 11:36:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40589 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 BC56927BBE9; Sat, 22 Mar 2025 11:38:42 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 024CE27BBE2 for ; Sat, 22 Mar 2025 11:38:41 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxB3-0001mb-Sa; Sat, 22 Mar 2025 07:38:10 -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 1tvxAx-0001kr-IL for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:04 -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 1tvxAx-00006Q-7e for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=9eL9AEjaF2tnAIBILCGkih41DWt5i+SsLqMRM5LtqxM=; b=L/gKFeBRnmyHVvATJvd1s+LnHwd1/Azz2SH1wUiX/W0a3ducZRQCyC4+JmnD+Gqka/fp1wemOkLwh6z9h7iWdMC9KDFDjXVo/0qeaoG/HtIShPxATbh8tagGm3oi32njPfTvLQ5NdR4e5i5SLZn7q6vDke7wjbU6tCfF1nIOSXLOAi4F5yFI3uhtSywy5DXb9mMCTL+hIKKX8l9eILHX/q0C25XZgiP//70lNGncZckEqdsmjfFFxoNMjoUefWKSF0gMIIyutoeGwTMFZAENOlnbOz4B4DjuQ83IncSMOUCEXuqE/X6g6xFyrBxqwN3Zq7t5O9u6o3vOdl5J+u+bgg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAx-0002YT-36 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 03/16] services: file-database: Exclude /dev by default. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434489597 (code B ref 77041); Sat, 22 Mar 2025 11:38:03 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:28 +0000 Received: from localhost ([127.0.0.1]:41157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAO-0002Ue-9P for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33540) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAK-0002Te-QH for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:25 -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 1tvxAF-0008TB-HQ; Sat, 22 Mar 2025 07:37:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=9eL9AEjaF2tnAIBILCGkih41DWt5i+SsLqMRM5LtqxM=; b=VBpHsXQiL60hu6oiOR5J IYPonU6bHoN7Tsww9yZK025Tc63YHOC4eVBRJ9AbbZUXWC7O7Jpec6VAu0zcP1fyZq0hRC5WMtn2L K3eF8Hqj8BVBE3zSjJx0QGhE00FabuexBMVeK5UhFaFvGQX4dqqkuJBb1CjBvhepVaWMM1LVzmPdP KbPRmrZqiRy9CSkLsldm/P1SMHL20O+Vj5A9JHYYh+fRxn1LcXFgoFY8i0pL8WfdAVuBNEzg4/22v akCnHO+3Aa9gTCT+532c2VyWHwT+dNoM+zyXM6K3ar8jNqgVJexc5L3IHWbSqXHQ21AXEzVz1U/2s DY8WjYnN9pK3PA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:40 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/admin.scm (%default-file-database-excluded-directories): Add “/dev’. Change-Id: I06af6621cd363e140a6fc49e1cee97d15b365b89 --- gnu/services/admin.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 5f5b76ffbb..b73accc4af 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -430,7 +430,7 @@ (define %default-file-database-excluded-directories ;; Regexps of directories excluded from the 'locate' database. (list (%store-prefix) "/tmp" "/var/tmp" "/var/cache" ".*/\\.cache" - "/run/udev")) + "/run/udev" "/dev")) (define (string-or-gexp? obj) (or (string? obj) (gexp? obj))) From patchwork Sat Mar 22 11:36:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40592 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 7229E27BBE2; Sat, 22 Mar 2025 11:38:45 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 10B8127BBE2 for ; Sat, 22 Mar 2025 11:38:45 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBL-00021s-RE; Sat, 22 Mar 2025 07:38:28 -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 1tvxAz-0001l7-ML for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -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 1tvxAx-00006W-Ml; Sat, 22 Mar 2025 07:38:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=PgbqXgtoTexWfVBvbRDW/xq0s5T6dJftZNFqA/+l6bY=; b=YuGkqC1toPKReFxiIPNXZg60bo01j0dQkh/A1bcG2BoZLofEvGki6qrbkR8+VVQt6r+iL2/lU17ZmnWX29HZCEztKivFGQbyiZT3uBDnAw9sY7qM/aGLzSfUUL1mYcVB71fe21viHk7UqJOAgVGl/ViSoQ4FqS6h1I0LG51NZ00oBA4OAusETFZGcU6ExJF+WOwbl9L2WVReMKPe0Ct+X+AAtso86EeOjIr2bI4wxbAWO0PixMBxdpdvJSyHlzTXpeEuLe8w7EM5SKkZHyJZ10srN183lzG41aDWXPLQQLBrmSrxg27vp7+mqM/KVWlCcLACDWaa8tHpd0G/KKkuwA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAx-0002Yb-Ha; Sat, 22 Mar 2025 07:38:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 04/16] services: package-database: Turn into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434639674 (code B ref 77041); Sat, 22 Mar 2025 11:38:03 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:43 +0000 Received: from localhost ([127.0.0.1]:41175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAc-0002Vx-QX for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44726) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAL-0002Tr-Sg for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:26 -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 1tvxAG-0008TJ-K9; Sat, 22 Mar 2025 07:37:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=PgbqXgtoTexWfVBvbRDW/xq0s5T6dJftZNFqA/+l6bY=; b=HJsjDl3H5Wvc/vTcJuTy m0qgGkp1z0hct6fdn+v9wTkq1/68yeXKdXPY5QzItH9+Pu8vzdrQyBlNP7MmfLQuRTw0/k699yQMD 8DIfK95J3pV87PxF1ECiDewUJphWRXbdg/9tevHs1+/l5bRikvK83HyCUW+NI7vbvG8tBWte1yMUy zvwj2cM20ncnDzf/s8JMU/X0keyANLOjOAPB20e2DVeBqRs1bStfAelTG7CfoT62GRPFPop+G3vaC yZk6Y0mXHmjL+PmHYgsrmPL14I9Dv2QzPEr2JoNAcxrx/oaBdGM59rEHDrXAB05UR5RlCTo1mFJIf YCF9AlXrPble+A==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:41 +0100 Message-ID: <6cc6ca8950931518bab8c779466cd41770abbbdf.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/admin.scm (package-database-mcron-jobs): Rename to… (package-database-shepherd-services): … this. Return a shepherd service. (package-database-service-type): Update accordingly. * doc/guix.texi (File Search Services): Update documentation of the ‘schedule’ field. Change-Id: Id7b4c5cff95a7117dca7d95af37db7389bb5ca92 --- doc/guix.texi | 7 ++++--- gnu/services/admin.scm | 34 ++++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 9e3b452577..eb0a18eff4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27204,9 +27204,10 @@ File Search Services The Guix package to use. @item @code{schedule} (default: @code{%default-package-database-update-schedule}) -String or G-exp denoting an mcron schedule for the periodic -@command{guix locate --update} job (@pxref{Guile Syntax,,, mcron, -GNU@tie{}mcron}). +This is the schedule of the periodic @command{guix locate --update} job, +expressed as a string in traditional cron syntax or as a gexp evaluating +to a Shepherd calendar event (@pxref{Timers,,, shepherd, The GNU +Shepherd Manual}). @item @code{method} (default: @code{'store}) Indexing method for @command{guix locate}. The default value, diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index b73accc4af..e473794043 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -529,23 +529,37 @@ (define-configuration/no-serialization package-database-configuration "G-exp denoting the channels to use when updating the database (@pxref{Channels}).")) -(define (package-database-mcron-jobs configuration) +(define (package-database-shepherd-services configuration) (match-record configuration (package schedule method channels) (let ((channels (scheme-file "channels.scm" channels))) - (list #~(job #$schedule - ;; XXX: The whole thing's running as "root" just because it - ;; needs write access to /var/cache/guix/locate. - (string-append #$(file-append package "/bin/guix") - " time-machine -C " #$channels - " -- locate --update --method=" - #$(symbol->string method))))))) + (list (shepherd-service + (provision '(package-database-update)) + (requirement '(user-processes guix-daemon)) + (modules '((shepherd service timer))) + ;; XXX: The whole thing's running as "root" just because it needs + ;; write access to /var/cache/guix/locate. + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command '(#$(file-append package "/bin/guix") + "time-machine" "-C" #$channels + "--" "locate" "--update" + #$(string-append + "--method=" (symbol->string method)))) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation + "Periodically update the system-wide package database that can +be queried by the 'guix locate' command.") + (actions (list shepherd-trigger-action))))))) (define package-database-service-type (service-type (name 'package-database) - (extensions (list (service-extension mcron-service-type - package-database-mcron-jobs))) + (extensions (list (service-extension shepherd-root-service-type + package-database-shepherd-services))) (description "Periodically update the package database used by the @code{guix locate} command, which lets you search for packages that provide a given file.") From patchwork Sat Mar 22 11:36:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40591 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 C4B8527BBEB; Sat, 22 Mar 2025 11:38:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3C9DC27BBE2 for ; Sat, 22 Mar 2025 11:38:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBL-00021d-R4; Sat, 22 Mar 2025 07:38:28 -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 1tvxAz-0001lH-U1 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -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 1tvxAy-00006a-81; Sat, 22 Mar 2025 07:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=aZzbLgwecY8nnMYdKCGfSNoCUaCBO/u+0cJBIinqz0o=; b=rzzNWv4xExvGoI/jWcj7ipEekn2GN6WrjyCa5EDskETcd7ceHSSCf9q2nchcPIf37z3QOCQRzc4C3c9pkkSbROqITZwKa53vV1P6b58UJBzmGr9PvSXY55KLu0wiXGMlHzdOdnAxW/PKeWldCnq8Abca/q8jlJkfy1Awv3N+K8Ev+zO0S6TpgHcUlA8qHV6DUzW4W+OOGFOzeyqMHEnAiqcOw3Uw9O829HYS4S/elIjITucighQ60JgRTDTtbBuzoeKXUp5XwcqQzdeYgawTQ0aCgNCbutv7dy0ipJ8o1mUbDh86HRzLelyA9wmu5N4z0vwT+0BhzzgeNacHZODVTw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAy-0002Yj-1q; Sat, 22 Mar 2025 07:38:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 05/16] services: fstrim: Turn into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434649682 (code B ref 77041); Sat, 22 Mar 2025 11:38:04 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:44 +0000 Received: from localhost ([127.0.0.1]:41177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAd-0002Vz-AZ for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44734) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAM-0002Tu-V6 for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:27 -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 1tvxAH-0008TS-Kl; Sat, 22 Mar 2025 07:37:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=aZzbLgwecY8nnMYdKCGfSNoCUaCBO/u+0cJBIinqz0o=; b=I3R62rzVhH5G5wIr7POJ z3pInFmiT4pYH5z+sF8EVLnHB9OQMmnb0Y+yHbavqELpPyUMqaE1L94vzy+QpysJzSZS8PQMiy5va FmyKXAAa8fwxsLF6vDz1282rsDNB199kuIjqktejjEgSm6rwxD4raWts3LkWcJDWE/eqqRa3OtL5o 8n3k8sgM79FTrOglBUzd/37kS65Ky0aUoSFz06XdeRFTn0niF2YcQBHI3aPVnqdwDiXN28E77atUD Uj7lQ1HmWYx4CytAM2DUXCqIhFPQP/QoqZj+pUd8hzW1tVgV86BhhvngD7ff2lg2lIdyOGEPEIlhQ j75O2lhpZ8FnKw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:42 +0100 Message-ID: <3e855021731ed7877824270ff0faed6a523965ca.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/linux.scm (mcron-time?): Remove. (shepherd-calendar-event?): New procedure. (fstrim-configuration)[schedule]: Change type to ‘shepherd-calendar-event’ and update docstring. (fstrim-mcron-job): Rename to… (fstrim-shepherd-services): … this. Return a list of Shepherd services. (fstrim-service-type): Adjust accordingly. * doc/guix.texi (Linux Services): Update. Change-Id: I9a7433cb15a1f4600470a915769d612e6e644dd8 --- doc/guix.texi | 14 +++++++----- gnu/services/linux.scm | 50 +++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index eb0a18eff4..e194919a9d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -42118,6 +42118,7 @@ Linux Services @end defvar @c %start of fragment + @deftp {Data Type} fstrim-configuration Available @code{fstrim-configuration} fields are: @@ -42125,11 +42126,11 @@ Linux Services @item @code{package} (default: @code{util-linux}) (type: file-like) The package providing the @command{fstrim} command. -@item @code{schedule} (default: @code{"0 0 * * 0"}) (type: mcron-time) -Schedule for launching @command{fstrim}. This can be a procedure, a -list or a string. For additional information, see @ref{Guile -Syntax,,Job specification,mcron,the mcron manual}. By default this is -set to run weekly on Sunday at 00:00. +@item @code{schedule} (default: @code{"0 0 * * 0"}) (type: shepherd-calendar-event) +Schedule for launching @command{fstrim}, expressed as a string in +traditional cron syntax or as a gexp evaluating to a Shepherd calendar +event (@pxref{Timers,,, shepherd,The GNU Shepherd Manual}). By default +this is set to run weekly on Sunday at 00:00. @item @code{listed-in} (default: @code{'("/etc/fstab" "/proc/self/mountinfo")}) (type: maybe-list-of-strings) List of files in fstab or kernel mountinfo format. All missing or empty @@ -42148,7 +42149,10 @@ Linux Services more information). @end table + @end deftp + + @c %end of fragment @cindex modprobe diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index b22dbeefa0..d7aee1b82e 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -34,7 +34,6 @@ (define-module (gnu services linux) #:use-module (gnu services admin) #:use-module (gnu services base) #:use-module (gnu services configuration) - #:use-module (gnu services mcron) #:use-module (gnu services shepherd) #:use-module (gnu packages linux) #:use-module (srfi srfi-1) @@ -196,8 +195,8 @@ (define earlyoom-service-type ;;; fstrim ;;; -(define (mcron-time? x) - (or (procedure? x) (string? x) (list? x))) +(define (shepherd-calendar-event? x) + (or (string? x) (gexp? x))) (define-maybe list-of-strings (prefix fstrim-)) @@ -216,11 +215,11 @@ (define-configuration fstrim-configuration "The package providing the @command{fstrim} command." empty-serializer) (schedule - (mcron-time "0 0 * * 0") - "Schedule for launching @command{fstrim}. This can be a procedure, a list -or a string. For additional information, see @ref{Guile Syntax,, -Job specification, mcron, the mcron manual}. By default this is set to run -weekly on Sunday at 00:00." + (shepherd-calendar-event "0 0 * * 0") + "Schedule for launching @command{fstrim}, expressed as a string in +traditional cron syntax or as a gexp evaluating to a Shepherd calendar +event (@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). By default this +is set to run weekly on Sunday at 00:00." empty-serializer) ;; The following are fstrim-related options. (listed-in @@ -251,26 +250,31 @@ (define (serialize-fstrim-configuration config) rcons fstrim-configuration-fields)) -(define (fstrim-mcron-job config) - (match-record config (package schedule) - #~(job - ;; Note: The “if” below is to ensure that - ;; lists are ungexp'd correctly since @var{schedule} - ;; can be either a procedure, a string or a list. - #$(if (list? schedule) - #~'(#$@schedule) - schedule) - (lambda () - (system* #$(file-append package "/sbin/fstrim") - #$@(serialize-fstrim-configuration config))) - "fstrim"))) +(define (fstrim-shepherd-services config) + (match-record config + (package schedule) + (list (shepherd-service + (provision '(fstrim)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command + (list #$(file-append package "/sbin/fstrim") + #$@(serialize-fstrim-configuration config))) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation "Periodically run the 'fstrim' command.") + (actions (list shepherd-trigger-action)))))) (define fstrim-service-type (service-type (name 'fstrim) (extensions - (list (service-extension mcron-service-type - (compose list fstrim-mcron-job)))) + (list (service-extension shepherd-root-service-type + fstrim-shepherd-services))) (description "Discard unused blocks from file systems.") (default-value (fstrim-configuration)))) From patchwork Sat Mar 22 11:36:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40590 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 D704F27BBEA; Sat, 22 Mar 2025 11:38:44 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 38D7A27BBE2 for ; Sat, 22 Mar 2025 11:38:44 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBR-0002IV-8u; Sat, 22 Mar 2025 07:38:33 -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 1tvxAz-0001lF-U3 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -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 1tvxAy-00006c-Lg for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=CPnZxR/pohpAunTFKidIoJ7AjLUZeZDa/uHrJIQ6+gA=; b=T1ZNG9+huMfLAsU3ORaoGNwd0oMgZCcVHbyAvsvVU0vnVYCfKAIqPBgyeJYebQ46A0aXbFJlFsY0CuOqR4QjeUsz7ake23hFyO1V086VzkJLp/GAAf32qIx9BCRMQgDdPeYkXNmvLQBRm2AvZ+NKMjJMgUdpohzYTyPeTnBoBCeojQdECDzV8nUHq6e5TmXutJ+WvXOC04gVaOP2kJU3cgPvbviRpMia+xTo0DkhAVFAdpnELlMITXlcQsdetNKP6GVumHdL3Pr4SiK/kHTv4vaBWh6hiWdb8dgvNyYW733FjCVvXMi5KuVlezlqNdak/SLI1U1ihqqsZL6v5mi/Vw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAy-0002Yr-HT for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 06/16] services: certbot: Turn into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434649695 (code B ref 77041); Sat, 22 Mar 2025 11:38:04 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:44 +0000 Received: from localhost ([127.0.0.1]:41181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAd-0002W8-U8 for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44750) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAO-0002Tw-3g for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:29 -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 1tvxAI-0008Tn-Pl; Sat, 22 Mar 2025 07:37:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=CPnZxR/pohpAunTFKidIoJ7AjLUZeZDa/uHrJIQ6+gA=; b=kDneFVJOF8MzhFaHwP4t uukz7VeLE4gflQIKEmvXiNiIhLFcve3TiX15DEOZ8qK8ysAFjXaueYVFniRJs1Xb8I9amZAvlWeVi MPFDRJFlVnmxtVmDwYygSZynRBRFfvDLkjFygSfLmPDz/mSTAGptpcO2hdEG1Izta7tWLPxOwdgmY PxcoONj+wUNneWiDJPZWcVgNGrkxoYy3vHtX1VibCBHSCU2S8yQ43svHjCDT8kEDZaJCHdeiAp2DG 1WTrhpXlN8GrXsfmTttR2U2o6vHPqbgV6jKhcsqMPwD33/yBB5u5GAFvb3srxAZwtj73UdXuTQddW F/2N3G/9lmhX+g==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:43 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/certbot.scm (certbot-renewal-jobs): Rename to… (certbot-renewal-shepherd-services): … this. Return a list of Shepherd services, including ‘renew-certbot-certificates’, formally defined… (certbot-renewal-one-shot): … here. Remove. (certbot-service-type): Adjust accordingly. Change-Id: I25ad9fc1277f4f6f948ab5fce7c6626f22591d10 --- gnu/services/certbot.scm | 93 +++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm index b276c49e0f..d6c7d175ff 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -27,7 +27,6 @@ (define-module (gnu services certbot) #:use-module (gnu services) #:use-module (gnu services base) #:use-module (gnu services shepherd) - #:use-module (gnu services mcron) #:use-module (gnu services web) #:use-module (gnu system shadow) #:use-module (gnu packages tls) @@ -220,46 +219,56 @@ (define certbot-command '#$commands) (exit script-code)))))))) -(define (certbot-renewal-jobs config) - (list - ;; Attempt to renew the certificates twice per day, at a random minute - ;; within the hour. See https://eff-certbot.readthedocs.io/. - #~(job '(next-minute-from (next-hour '(0 12)) (list (random 60))) - #$(certbot-command config)))) +(define (certbot-renewal-shepherd-services config) + (list (shepherd-service + (provision '(certbot-certificate-renewal)) + (requirement '(user-processes nginx)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + ;; Attempt to renew the certificates twice per day. See + ;; https://eff-certbot.readthedocs.io/. + (calendar-event #:minutes '(22) #:hours '(0 12)) + (command '(#$(certbot-command config))) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation "Periodically run the 'certbot' command to renew X.509 +certificates.") + (actions + (list shepherd-trigger-action + (shepherd-configuration-action (certbot-command config))))) -(define (certbot-renewal-one-shot config) - (list - ;; Renew certificates when the system first starts. This is a one-shot - ;; service, because the mcron configuration will take care of running this - ;; periodically. This is most useful the very first time the system starts, - ;; to overwrite our self-signed certificates as soon as possible without - ;; user intervention. - (shepherd-service - (provision '(renew-certbot-certificates)) - (requirement '(nginx)) - (one-shot? #t) - (start #~(lambda _ - ;; This needs the network, but there's no reliable way to know - ;; if the network is up other than trying. If we fail due to a - ;; connection error we retry a number of times in the hope that - ;; the network comes up soon. - (let loop ((attempt 0)) - (let ((code (status:exit-val - (system* #$(certbot-command config))))) - (cond - ((and (= code 2) ; Exit code 2 means connection error - (< attempt 12)) ; Arbitrarily chosen max attempts - (sleep 10) ; Arbitrarily chosen retry delay - (loop (1+ attempt))) - ((zero? code) - ;; Success! - #t) - (else - ;; Failure. - #f)))))) - (auto-start? #t) - (documentation "Call certbot to renew certificates.") - (actions (list (shepherd-configuration-action (certbot-command config))))))) + ;; Renew certificates when the system first starts. This is a one-shot + ;; service, because the timer above takes care of running this + ;; periodically. This is most useful the very first time the system + ;; starts, to overwrite our self-signed certificates as soon as + ;; possible without user intervention. + (shepherd-service + (provision '(renew-certbot-certificates)) + (requirement '(user-processes nginx)) + (one-shot? #t) + (start #~(lambda _ + ;; This needs the network, but there's no reliable way to know + ;; if the network is up other than trying. If we fail due to a + ;; connection error we retry a number of times in the hope that + ;; the network comes up soon. + (let loop ((attempt 0)) + (let ((code (status:exit-val + (system* #$(certbot-command config))))) + (cond + ((and (= code 2) ; Exit code 2 means connection error + (< attempt 12)) ; Arbitrarily chosen max attempts + (sleep 10) ; Arbitrarily chosen retry delay + (loop (1+ attempt))) + ((zero? code) + ;; Success! + #t) + (else + ;; Failure. + #f)))))) + (auto-start? #t) + (documentation "Run 'certbot' to renew certificates at boot time.") + (actions + (list (shepherd-configuration-action (certbot-command config))))))) (define (generate-certificate-gexp certbot-cert-directory rsa-key-size) (match-lambda @@ -354,10 +363,8 @@ (define certbot-service-type (compose list certbot-configuration-package)) (service-extension activation-service-type certbot-activation) - (service-extension mcron-service-type - certbot-renewal-jobs) (service-extension shepherd-root-service-type - certbot-renewal-one-shot))) + certbot-renewal-shepherd-services))) (compose concatenate) (extend (lambda (config additional-certificates) (certbot-configuration From patchwork Sat Mar 22 11:36:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40588 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 9FABA27BBE9; Sat, 22 Mar 2025 11:38:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6FB8827BBEA for ; Sat, 22 Mar 2025 11:38:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBK-0001r1-Gb; Sat, 22 Mar 2025 07:38:26 -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 1tvxAz-0001lG-Uk for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:06 -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 1tvxAz-00006f-5E; Sat, 22 Mar 2025 07:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=Vzal9oLBSriYCLr+1tEFaevFSXuwUjZ8YKNNEjjU8ik=; b=G9U3SELoYa0XEbkDX5MSsns9G79ycWEpVruTtrArtMiQ6Qi7toIY85deG29far/1zva36Bw4Zkqh9BcshjDZMcE29o53WSCh7PtE9AGt8nAgJ4iVxIs9qcTyvHmUAY9G7rpBG5VVWqRyCLg7uOIJmeUr0SIrXM8xtIeXaWtENvyM0o3gX++KzhgHkenRZhBT4PPKVQfHLJ9/bfDkQ0XYdKOHgtgE88yrh+Q1DQxqkFMlbmcn42WXUQgayHcuBG+bA6cXD5cRgVFynEaTQsln9wNZ6m+LVAtQPxg8OG5n8OBGwTCPGR2AYKf2qQ/7nfIwO+v09DwLDocpHrEm4+30Mg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAy-0002Z0-W7; Sat, 22 Mar 2025 07:38:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 07/16] services: wireguard: Turn monitoring into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434659707 (code B ref 77041); Sat, 22 Mar 2025 11:38:04 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:45 +0000 Received: from localhost ([127.0.0.1]:41183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAe-0002WK-HO for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44764) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAP-0002U3-AC for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37: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 1tvxAK-0008Tu-0Q; Sat, 22 Mar 2025 07:37:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Vzal9oLBSriYCLr+1tEFaevFSXuwUjZ8YKNNEjjU8ik=; b=l5E1KqcmH2VBAkh8huoX BM0V5wcdJvmnq9UJaW5LrlDo6fkVv6vERUrgJOufpz2xS+vP4QeEHfMBe7DCv8P8ZjpalAJxrqELM nuTYZEtvsRD6xTUp+jvlRQjeebOvyW5DGK8q3xapxAUWn/G6aOslpD/8nU+5gnrWJrXP+S2sSggAN BBaD5HLzzWPD6ghs+55xsDyAngAbhpOhqjJdTmfFw4I4nrQTK6YTU1XqEiz2WmWHd/28LL5eBlDoM 8Oab5yjFW9jDPDCzZEqSQz2dEuxTEN1ZhPGM1sG5CL5xj05Ivvml5/dLvLmY0RSzHjkyxLrcr0mSo UybnTvr6t4YdYw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:44 +0100 Message-ID: <7543d6be7e2f254f824af0a2823bf2160f301670.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/vpn.scm ()[schedule]: Change default value. (wireguard-monitoring-program): New procedure, with code taken from… (wireguard-monitoring-jobs): … here. Remove. (wireguard-shepherd-services): New procedure, with code taken from… (wireguard-shepherd-service): … here. Remove. * doc/guix.texi (VPN Services): Update. Change-Id: I6851ddf1eb9480bdc9e6c6c6b88958ab2e6225d7 --- doc/guix.texi | 7 +- gnu/services/vpn.scm | 199 ++++++++++++++++++++++--------------------- 2 files changed, 108 insertions(+), 98 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index e194919a9d..df5378bce5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35749,9 +35749,10 @@ VPN Services name. Set this to @code{#t} if one or more endpoints use host names provided by a dynamic DNS service to keep the sessions alive. -@item @code{monitor-ips-interval} (default: @code{'(next-minute (range 0 60 5))}) -The time interval at which the IP monitoring job should run, provided as -an mcron time specification (@pxref{Guile Syntax,,,mcron}). +@item @code{monitor-ips-interval} (default: @code{"*/5 * * * *"}) +This is the monitoring schedule, expressed as a string in traditional +cron syntax or as a gexp evaluating to a Shepherd calendar event +(@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). @item @code{private-key} (default: @code{"/etc/wireguard/private.key"}) The private key file for the interface. It is automatically generated diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm index 3f1f8661d8..f97cbac7bb 100644 --- a/gnu/services/vpn.scm +++ b/gnu/services/vpn.scm @@ -34,7 +34,6 @@ (define-module (gnu services vpn) #:use-module (gnu services) #:use-module (gnu services configuration) #:use-module (gnu services dbus) - #:use-module (gnu services mcron) #:use-module (gnu services shepherd) #:use-module (gnu system shadow) #:use-module (gnu packages admin) @@ -43,6 +42,7 @@ (define-module (gnu services vpn) #:use-module (guix packages) #:use-module (guix records) #:use-module (guix gexp) + #:use-module (guix diagnostics) #:use-module (guix i18n) #:use-module (guix deprecation) #:use-module (srfi srfi-1) @@ -757,7 +757,7 @@ (define-record-type* (monitor-ips? wireguard-configuration-monitor-ips? ;boolean (default #f)) (monitor-ips-interval wireguard-configuration-monitor-ips-interval - (default '(next-minute (range 0 60 5)))) ;string | list + (default "*/5 * * * *")) ;string | list (pre-up wireguard-configuration-pre-up ;list of strings (default '())) (post-up wireguard-configuration-post-up ;list of strings @@ -919,117 +919,126 @@ (define (endpoint-host-names peers) '() peers))) -(define (wireguard-shepherd-service config) +(define (wireguard-monitoring-program config) (match-record config - (wireguard interface shepherd-requirement) + (interface monitor-ips-interval peers) + (let ((host-names (endpoint-host-names peers))) + (when (null? host-names) + (warning (G_ "'monitor-ips?' is #t but no host name to monitor~%"))) + + ;; Loosely based on WireGuard's own 'reresolve-dns.sh' shell script + ;; (see: https://raw.githubusercontent.com/WireGuard/wireguard-tools/ + ;; master/contrib/reresolve-dns/reresolve-dns.sh). + (program-file + (format #f "wireguard-~a-monitoring" interface) + (with-imported-modules (source-module-closure + '((gnu services herd) + (guix build utils))) + #~(begin + (use-modules (gnu services herd) + (guix build utils) + (ice-9 popen) + (ice-9 match) + (ice-9 textual-ports) + (srfi srfi-1) + (srfi srfi-26)) + + (define (resolve-host name) + "Return the IP address resolved from NAME." + (let* ((ai (car (getaddrinfo name))) + (sa (addrinfo:addr ai))) + (inet-ntop (sockaddr:fam sa) + (sockaddr:addr sa)))) + + (define wg #$(file-append wireguard-tools "/bin/wg")) + + #$(procedure-source strip-port/maybe) + + (define service-name + '#$(wireguard-service-name interface)) + + (when (live-service-running + (current-service service-name)) + (let* ((pipe (open-pipe* OPEN_READ wg "show" + #$interface "endpoints")) + (lines (string-split (get-string-all pipe) + #\newline)) + ;; IPS is an association list mapping + ;; public keys to IP addresses. + (ips (map (match-lambda + ((public-key ip) + (cons public-key + (strip-port/maybe ip)))) + (map (cut string-split <> #\tab) + (remove string-null? + lines))))) + (close-pipe pipe) + (for-each + (match-lambda + ((key . host-name) + (let ((resolved-ip (resolve-host + (strip-port/maybe + host-name))) + (current-ip (assoc-ref ips key))) + (unless (string=? resolved-ip current-ip) + (format #t "resetting `~a' peer \ +endpoint to `~a' due to stale IP (`~a' instead of `~a')~%" + key host-name + current-ip resolved-ip) + (invoke wg "set" #$interface "peer" key + "endpoint" host-name))))) + '#$host-names))))))))) + +(define (wireguard-shepherd-services config) + (match-record config + (wireguard interface monitor-ips? monitor-ips-interval shepherd-requirement) (let ((wg-quick (file-append wireguard "/bin/wg-quick")) (auto-start? (wireguard-configuration-auto-start? config)) - (config (wireguard-configuration-file config))) - (list (shepherd-service + (config-file (wireguard-configuration-file config))) + (define monitoring-service + (and monitor-ips? + (shepherd-service + (provision (list (symbol-append + (wireguard-service-name interface) + '-monitoring))) + (requirement (list 'user-processes + (wireguard-service-name interface))) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? monitor-ips-interval) + #~(cron-string->calendar-event + #$monitor-ips-interval) + monitor-ips-interval) + (command '(#$(wireguard-monitoring-program config))) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation "Monitor the Wireguard VPN tunnel.") + (actions (list shepherd-trigger-action))))) + + (cons (shepherd-service (requirement `(networking user-processes ,@shepherd-requirement)) (provision (list (wireguard-service-name interface))) (start #~(lambda _ - (invoke #$wg-quick "up" #$config))) + (invoke #$wg-quick "up" #$config-file))) (stop #~(lambda _ - (invoke #$wg-quick "down" #$config) + (invoke #$wg-quick "down" #$config-file) #f)) ;stopped! - (actions (list (shepherd-configuration-action config))) + (actions (list (shepherd-configuration-action config-file))) (auto-start? auto-start?) - (documentation "Run the Wireguard VPN tunnel")))))) - -(define (wireguard-monitoring-jobs config) - ;; Loosely based on WireGuard's own 'reresolve-dns.sh' shell script (see: - ;; https://raw.githubusercontent.com/WireGuard/wireguard-tools/ - ;; master/contrib/reresolve-dns/reresolve-dns.sh). - (match-record config - (interface monitor-ips? monitor-ips-interval peers) - (let ((host-names (endpoint-host-names peers))) - (if monitor-ips? - (if (null? host-names) - (begin - (warn "monitor-ips? is #t but no host name to monitor") - '()) - ;; The mcron monitor job may be a string or a list; ungexp strips - ;; one quote level, which must be added back when a list is - ;; provided. - (list - #~(job - (if (string? #$monitor-ips-interval) - #$monitor-ips-interval - '#$monitor-ips-interval) - #$(program-file - (format #f "wireguard-~a-monitoring" interface) - (with-imported-modules (source-module-closure - '((gnu services herd) - (guix build utils))) - #~(begin - (use-modules (gnu services herd) - (guix build utils) - (ice-9 popen) - (ice-9 match) - (ice-9 textual-ports) - (srfi srfi-1) - (srfi srfi-26)) - - (define (resolve-host name) - "Return the IP address resolved from NAME." - (let* ((ai (car (getaddrinfo name))) - (sa (addrinfo:addr ai))) - (inet-ntop (sockaddr:fam sa) - (sockaddr:addr sa)))) - - (define wg #$(file-append wireguard-tools "/bin/wg")) - - #$(procedure-source strip-port/maybe) - - (define service-name '#$(wireguard-service-name - interface)) - - (when (live-service-running - (current-service service-name)) - (let* ((pipe (open-pipe* OPEN_READ wg "show" - #$interface "endpoints")) - (lines (string-split (get-string-all pipe) - #\newline)) - ;; IPS is an association list mapping - ;; public keys to IP addresses. - (ips (map (match-lambda - ((public-key ip) - (cons public-key - (strip-port/maybe ip)))) - (map (cut string-split <> #\tab) - (remove string-null? - lines))))) - (close-pipe pipe) - (for-each - (match-lambda - ((key . host-name) - (let ((resolved-ip (resolve-host - (strip-port/maybe - host-name))) - (current-ip (assoc-ref ips key))) - (unless (string=? resolved-ip current-ip) - (format #t "resetting `~a' peer \ -endpoint to `~a' due to stale IP (`~a' instead of `~a')~%" - key host-name - current-ip resolved-ip) - (invoke wg "set" #$interface "peer" key - "endpoint" host-name))))) - '#$host-names))))))))) - '())))) ;monitor-ips? is #f + (documentation "Run the Wireguard VPN tunnel")) + (or (and=> monitoring-service list) + '()))))) (define wireguard-service-type (service-type (name 'wireguard) (extensions (list (service-extension shepherd-root-service-type - wireguard-shepherd-service) + wireguard-shepherd-services) (service-extension activation-service-type wireguard-activation) (service-extension profile-service-type (compose list - wireguard-configuration-wireguard)) - (service-extension mcron-service-type - wireguard-monitoring-jobs))) + wireguard-configuration-wireguard)))) (description "Set up Wireguard @acronym{VPN, Virtual Private Network} tunnels."))) From patchwork Sat Mar 22 11:36:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40587 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 DFFB527BBEA; Sat, 22 Mar 2025 11:38:36 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 99DFC27BBE2 for ; Sat, 22 Mar 2025 11:38:36 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBR-0002Ik-O1; Sat, 22 Mar 2025 07:38:33 -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 1tvxB0-0001lR-1G for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:06 -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 1tvxAz-00006m-KY for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=J86d6wlJyiG/xFreO7hCsXLBQMr+goEI4lMG2ZhkdWs=; b=cYB+jk1oufSgYwaGh0U/ftutN9+wgou4qiZuCbitTmMYhV8GmRfuXZ0/HYHPNLeoFe5rr3Ag3FOy9oEdlfcjFHwbzAlqjYm4cgXYhiOci3JutkpCdA9geff+mgyDJs1qRNUMv/yD82tEaC7f89j0CVnIl9w8lXDhjyX5YJF7NYMpetmAjIlhQW2eU5bdfVpIyBpHjijy3utb1Aw1hz9QLJk1BJts8hyOvMdzoeYu1RF7y2s8zYkMylPN6zW6jVD9mKMHQwkoiNZXM4f0AmecNe0GaxULP2VLfPDuepB9W0ezuvKCZnH9oPMqmXYNODKbksUiqfLscJXG/UrKEyBEfA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAz-0002Z8-Ff for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 08/16] tests: Make =?utf-8?q?=E2=80=98operati?= =?utf-8?q?ng-system-with-console-syslog=E2=80=99?= public. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434669714 (code B ref 77041); Sat, 22 Mar 2025 11:38:05 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:46 +0000 Received: from localhost ([127.0.0.1]:41187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAf-0002WW-DP for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44770) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAT-0002Ub-2H for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:33 -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 1tvxAM-0008UD-1t; Sat, 22 Mar 2025 07:37:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=J86d6wlJyiG/xFreO7hCsXLBQMr+goEI4lMG2ZhkdWs=; b=fdATpzERg3aPfMP15dJo HgCk4xd/uTH6ikrwRsLo8D65LfPYe/wQn15d7DNV3g+HuNjJIUR0hFJLC024PGo/J0oRr4FtDdOdu dIU5maZ3htAiVgC01kN7bywSQU+8WJ1cjaIwqq47DD8O9N/QKyfGhkXprDAFiuZOxucOMUCtmt0Pd nLsD8e95fweH2rGTp+BwDHjCsqLPkMsN//pQ6dGbxprhIMO76xYLC8fnv5aGl7NOzMILgjH5vBGEX P2c56OaNuD7vlTMez4ORmtuUrayTdfM3x/t9so+SLzQLUi4lnr4+wEt8l0n9ZZheUqarWr2GthRBz zxq8xbTvNaGKRg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:45 +0100 Message-ID: <0dbd5aaedd936891d115aae44dcbd4152f4a9546.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/install.scm (operating-system-with-console-syslog): Move to… * gnu/tests.scm (operating-system-with-console-syslog): … here. New procedure. Change-Id: I015e24525140365d09f22127d366107fdc9ca902 --- gnu/tests.scm | 21 +++++++++++++++++++++ gnu/tests/install.scm | 20 -------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/gnu/tests.scm b/gnu/tests.scm index 84298de448..abb7076208 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -53,6 +53,7 @@ (define-module (gnu tests) %simple-os simple-operating-system + operating-system-with-console-syslog system-test system-test? @@ -268,6 +269,26 @@ (define-syntax-rule (simple-operating-system user-services ...) (services (cons* user-services ... %base-services)))) +(define (operating-system-with-console-syslog os) + "Return OS with a system log service that writes to /dev/console." + (operating-system + (inherit os) + (services + (modify-services (operating-system-user-services os) + (shepherd-system-log-service-type + config + => + (system-log-configuration + (inherit config) + (message-destination + #~(lambda (message) + (let ((destinations ((default-message-destination-procedure) + message))) + (if (<= (system-log-message-priority message) + (system-log-priority info)) + (cons "/dev/console" destinations) + destinations)))))))))) + ;;; ;;; Tests. diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index a837637b18..8293296339 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -1784,26 +1784,6 @@ (define %test-xfs-root-os ;;; Installation through the graphical interface. ;;; -(define (operating-system-with-console-syslog os) - "Return OS with a syslog service that writes to /dev/console." - (operating-system - (inherit os) - (services - (modify-services (operating-system-user-services os) - (shepherd-system-log-service-type - config - => - (system-log-configuration - (inherit config) - (message-destination - #~(lambda (message) - (let ((destinations ((default-message-destination-procedure) - message))) - (if (<= (system-log-message-priority message) - (system-log-priority info)) - (cons "/dev/console" destinations) - destinations)))))))))) - (define %root-password "foo") (define* (gui-test-program marionette From patchwork Sat Mar 22 11:36:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40596 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 F09E727BBEA; Sat, 22 Mar 2025 11:38:58 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7C53027BBE2 for ; Sat, 22 Mar 2025 11:38:58 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBM-00024P-O5; Sat, 22 Mar 2025 07:38:28 -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 1tvxB0-0001m4-TB for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -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 1tvxB0-00007J-4G for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=ASZ5k0dIb4ZYdG0mMlz81k+mQPqwvtTufBnDwD19o1Y=; b=NF3va2V069sg6lkQNiu5uKP7Vfm3p9DlxMeN2XDA6nupARkYwF2gUIAOHY/7RBHJSCbIGnMUhG/Nlxu8b0wNH7z9Jdt9LgbDoSV5xe84S8g5B8RyX74LwM9Y3P530LA/aZ4UmwP2aHyXbX5RTrdmMYegpvHNmzm4iOFShtfJdHNlA0xEc0VeTUJOpalF4cwSOhLRaON6GTfTGpNjslpgXHhwgYuyffbAmBgQoTDCLfHIN5xvJALAnSVPLdlKrbC5xjLBUvxW/tXPFZT1i5zMd3mbgqMvdss1rUCNtOj4UwHtYyFJK8L6BArifn/HkYyrtlwquciLpYGWmyTUuHKAHA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAz-0002ZG-Vv for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 09/16] tests: ganeti: Remove unnecessary =?utf-8?b?4oCYYmVnaW7igJku?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434669722 (code B ref 77041); Sat, 22 Mar 2025 11:38:05 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:46 +0000 Received: from localhost ([127.0.0.1]:41189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAf-0002Wi-UM for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44774) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAT-0002Uc-9p for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:33 -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 1tvxAO-0008UU-0J; Sat, 22 Mar 2025 07:37:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=ASZ5k0dIb4ZYdG0mMlz81k+mQPqwvtTufBnDwD19o1Y=; b=KKPz6NolyhO1eh1Khojp NpriUNVng1w5xySP9QyCSX6Ix6GTv1xuErPwvU8CEJGKaDV8UPcXS+cDzdJn5pdtkcOiUkJ9Y+rGp Q2wlodkRZSaELXStvz3JGtQfAXJDz0mfiEgjU/I5dyVIOTcYFVVWfM/vDqcpePmM2wu+ps6KbS+gB hULisgTPf1fPaEdnztNT+9A8skA0WV6rBieYZFGDiaJbjZ69ALr81t6SBR2vaF3UsqA9YAlBshYQd IqE/gRe75Lm9MxVXbf0UkNrIymytd6aDyUlVxHm1ICal1NlPa1uj7e6ZXWXHg3nbhrgek4FSsT6Uz dhRMzt5L1MGugQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:46 +0100 Message-ID: <3a213dd818bf1bbd1a302162de8c2625fbfea96f.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/ganeti.scm (run-ganeti-test): Remove ‘begin’ where unnecessary. Change-Id: I3a36fffdc797c9187b5ffa406f7a06985f18d29c --- gnu/tests/ganeti.scm | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm index 29eb354044..ce55c8e04f 100644 --- a/gnu/tests/ganeti.scm +++ b/gnu/tests/ganeti.scm @@ -154,9 +154,8 @@ (define* (run-ganeti-test hypervisor #:key (test-eq "watcher pause" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/sbin/gnt-cluster") - "watcher" "pause" "1h")) + '(system* #$(file-append ganeti "/sbin/gnt-cluster") + "watcher" "pause" "1h") marionette)) (test-assert "force-start wconfd" @@ -174,8 +173,7 @@ (define* (run-ganeti-test hypervisor #:key (test-eq "gnt-cluster verify 1" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/sbin/gnt-cluster") "verify")) + '(system* #$(file-append ganeti "/sbin/gnt-cluster") "verify") marionette)) ;; Try stopping and starting daemons with daemon-util like @@ -183,33 +181,29 @@ (define* (run-ganeti-test hypervisor #:key (test-eq "daemon-util stop-all" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/lib/ganeti/daemon-util") - "stop-all")) + '(system* #$(file-append ganeti "/lib/ganeti/daemon-util") + "stop-all") marionette)) (test-eq "daemon-util start-all" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/lib/ganeti/daemon-util") - "start-all")) + '(system* #$(file-append ganeti "/lib/ganeti/daemon-util") + "start-all") marionette)) ;; Check that the cluster is still healthy after the daemon restarts. (test-eq "gnt-cluster verify 2" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/sbin/gnt-cluster") "verify")) + '(system* #$(file-append ganeti "/sbin/gnt-cluster") "verify") marionette)) (test-eq "watcher continue" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/sbin/gnt-cluster") - "watcher" "continue")) + '(system* #$(file-append ganeti "/sbin/gnt-cluster") + "watcher" "continue") marionette)) ;; Try accessing the RAPI. @@ -244,9 +238,8 @@ (define* (run-ganeti-test hypervisor #:key (test-eq "gnt-cluster destroy" 0 (marionette-eval - '(begin - (system* #$(file-append ganeti "/sbin/gnt-cluster") - "destroy" "--yes-do-it")) + '(system* #$(file-append ganeti "/sbin/gnt-cluster") + "destroy" "--yes-do-it") marionette)) (test-end)))) From patchwork Sat Mar 22 11:36:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40599 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 489B527BBE9; Sat, 22 Mar 2025 11:39:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DB59127BBE2 for ; Sat, 22 Mar 2025 11:39:18 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBM-00022K-8m; Sat, 22 Mar 2025 07:38:28 -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 1tvxB1-0001m9-GT for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -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 1tvxB0-00007T-NL for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=S+IKs4pr1pR4iSgRs+HL5omwv7CnO337JSiYV4uwBkc=; b=qA5AvEUQQ1xe7D9eHPC+XqgP+fDr4moqO6hFArKqBfMEMH9I56sohR8l13InVqt4NnecFdduxYFPsepF567nCI0orXkkKX/4x+Wn9uyf48anwRLHCbLk78WSu01+UtkuLHRH0SOqMtgFF4kCKdDKyVxIuCZs/L5abLsWw62av72H422pAX09hPrwPatzFSF34+0r/P1aoKZzLTzBx47RROo8l9BrqOaPXma5LbAERk57QuVZ0BrKj2c1u/LGTP2pxyevLuiWB0o4W4KsC4tAmx4ErSU96PMC83cmEC5j6o6ETzhgGPPnHwrqbZZp/aoU+VKwafuf/Z1Ol+lXOyIUlQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxB0-0002ZN-F2 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 10/16] tests: ganeti: Write system log to /dev/console. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434679730 (code B ref 77041); Sat, 22 Mar 2025 11:38:06 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:47 +0000 Received: from localhost ([127.0.0.1]:41191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAg-0002Wl-CQ for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54226) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAX-0002V3-9C for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:37 -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 1tvxAS-0008Uv-18; Sat, 22 Mar 2025 07:37:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=S+IKs4pr1pR4iSgRs+HL5omwv7CnO337JSiYV4uwBkc=; b=p8f+dxhyxcDEjlkviB3T jnslJOmO7vb62yVSCg1AN3b0bWA2Oia25DyNqyno1i+5ePv5U6OB83/kct8cV/V3GUgR98kXAcqo3 glcWeIACjnjxCbWwxBga+VeO+I99ioL2tZ6+lOXtvDHxFOWTVVf0TqMnBxlDNZnxkLi3CBR2QzjYu suksm3n0qKuoaRwPkB5ZyaTOLm8xpdYlG4cOh0EAHkyJdhGXDFRR6FyIMQ9DArgmsNWGdKW8MwOYF wVcgLHGkDTu2tJQEM+S5HlIrVgas5HNankyBPGlc6l5qHSWzbYIV8N8jke5V6i16VBjX4yTXzxgYV tGKn89Ia2i3Opw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:47 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/ganeti.scm (%ganeti-os): Wrap in ‘operating-system-with-console-syslog’. Change-Id: Ie86ad640ad6a7c154f5768ac4250acdd0e8940af --- gnu/tests/ganeti.scm | 87 ++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm index ce55c8e04f..42ed58d977 100644 --- a/gnu/tests/ganeti.scm +++ b/gnu/tests/ganeti.scm @@ -33,54 +33,55 @@ (define-module (gnu tests ganeti) #:export (%test-ganeti-kvm %test-ganeti-lxc)) (define %ganeti-os - (operating-system - (host-name "gnt1") - (timezone "Etc/UTC") - (locale "en_US.UTF-8") + (operating-system-with-console-syslog + (operating-system + (host-name "gnt1") + (timezone "Etc/UTC") + (locale "en_US.UTF-8") - (bootloader (bootloader-configuration - (bootloader grub-bootloader) - (targets '("/dev/vda")))) - (file-systems (cons (file-system - (device (file-system-label "my-root")) - (mount-point "/") - (type "ext4")) - %base-file-systems)) - (firmware '()) + (bootloader (bootloader-configuration + (bootloader grub-bootloader) + (targets '("/dev/vda")))) + (file-systems (cons (file-system + (device (file-system-label "my-root")) + (mount-point "/") + (type "ext4")) + %base-file-systems)) + (firmware '()) - (packages (append (list ganeti-instance-debootstrap ganeti-instance-guix) - %base-packages)) + (packages (append (list ganeti-instance-debootstrap ganeti-instance-guix) + %base-packages)) - ;; The hosts file must contain a nonlocal IP for host-name. - (essential-services - (modify-services (operating-system-default-essential-services this-operating-system) - (hosts-service-type config => (list - (host "127.0.0.1" "localhost") - (host "::1" "localhost"))))) - (services - (append (list (service static-networking-service-type - (list %qemu-static-networking)) - (service openssh-service-type - (openssh-configuration - (permit-root-login 'prohibit-password))) + ;; The hosts file must contain a nonlocal IP for host-name. + (essential-services + (modify-services (operating-system-default-essential-services this-operating-system) + (hosts-service-type config => (list + (host "127.0.0.1" "localhost") + (host "::1" "localhost"))))) + (services + (append (list (service static-networking-service-type + (list %qemu-static-networking)) + (service openssh-service-type + (openssh-configuration + (permit-root-login 'prohibit-password))) - ;; In addition, the cluster name must resolve to an IP address that - ;; is not currently provisioned. - (simple-service 'ganeti-host-entries hosts-service-type - (list - (host "10.0.2.15" "gnt1.example.com" '("gnt1")) - (host "192.168.254.254" "ganeti.example.com"))) + ;; In addition, the cluster name must resolve to an IP address that + ;; is not currently provisioned. + (simple-service 'ganeti-host-entries hosts-service-type + (list + (host "10.0.2.15" "gnt1.example.com" '("gnt1")) + (host "192.168.254.254" "ganeti.example.com"))) - (service ganeti-service-type - (ganeti-configuration - (file-storage-paths '("/srv/ganeti/file-storage")) - (rapi-configuration - (ganeti-rapi-configuration - ;; Disable TLS so we can test the RAPI without - ;; pulling in GnuTLS. - (ssl? #f))) - (os %default-ganeti-os)))) - %base-services)))) + (service ganeti-service-type + (ganeti-configuration + (file-storage-paths '("/srv/ganeti/file-storage")) + (rapi-configuration + (ganeti-rapi-configuration + ;; Disable TLS so we can test the RAPI without + ;; pulling in GnuTLS. + (ssl? #f))) + (os %default-ganeti-os)))) + %base-services))))) (define* (run-ganeti-test hypervisor #:key (master-netdev "eth0") From patchwork Sat Mar 22 11:36:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40594 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 E74AD27BBEC; Sat, 22 Mar 2025 11:38:53 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B18B627BBE9 for ; Sat, 22 Mar 2025 11:38:53 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBO-0002BQ-M1; Sat, 22 Mar 2025 07:38:30 -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 1tvxB1-0001mJ-Qs for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -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 1tvxB1-00007Z-6u for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=f578GIeB3CRy8TTnsIafTl4hBoKgVU+hOI0dI2zxvuE=; b=re90w7ZC1K+DDzd1FwcA5z5yupIBIybdlc39LNT2cZzYFlr6qI3hpcZqusv8dqyMgRZT7ZlF7TBPkYg/zPctPaTuaYGloN7TjVoVdld/6u1Xahwjk9k+tG8cUz+Z0/0IIqieVF05i/5FEo2Qr3OPERShEEFriVppmXFBRQfOBY+L/IX5ZQoghU5g82FUG13p9EIJACFZxOjXrUh4DOtncWlEwg9koPEury1GfuIMUzxwjMvbqr6VtOFqZE7iZrKWuVZnz2EoPpfR/4VpptQ2bSrImPu+cVjqydeLZRLz7UDjuJPBk9A6qT424qxvkV4b8h/q2BLtcQdBYCGmhYz3gw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxB1-0002ZV-0z for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 11/16] tests: ganeti: Increase VM memory size. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434679737 (code B ref 77041); Sat, 22 Mar 2025 11:38:06 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:47 +0000 Received: from localhost ([127.0.0.1]:41193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAg-0002Wt-Sd for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54238) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAY-0002V6-Ky for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:38 -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 1tvxAT-0008V2-Cj; Sat, 22 Mar 2025 07:37:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=f578GIeB3CRy8TTnsIafTl4hBoKgVU+hOI0dI2zxvuE=; b=gC1rbquhXX6sy5hyRKaf FN7YnMafEekq0NM77rvR4zl6HG5eSpzA2LEmFbiJb9teOZLJ5DUncFu9RqB038qVwW0xBj4msXR1K LiYgLcfWm8hmH0Zof1NcAF7JItn7jO2dIJ2VbgJ7kEqzDwc4UW4l/Z4JvRFX86OUDx3JfHWpb0gkh HYb+RluxCtWeVljS0agH3waO7JzOlPh7XvzPnKR3QpELCaK2FfQgM15tuKvhexpZd3NJoIvEn3tzU 2MHPwsiM0L69LX2+UsEtySZbLpMIKthv+95QEsdv3EH9a1cpekfbaMOreak/xdQ/AvsfYPpzYfL3D 2KRtltSnt88j5A==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:48 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/ganeti.scm (run-ganeti-test): Pass ‘-m 1024’ to ‘make-marionette’. Change-Id: I82c8a0eb37c16079f1affe793afc0d8a773c62c8 --- gnu/tests/ganeti.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm index 42ed58d977..140950776e 100644 --- a/gnu/tests/ganeti.scm +++ b/gnu/tests/ganeti.scm @@ -117,7 +117,7 @@ (define* (run-ganeti-test hypervisor #:key (gnu build marionette)) (define marionette - (make-marionette (list #$vm))) + (make-marionette (list #$vm "-m" "1024"))) (test-runner-current (system-test-runner #$output)) (test-begin "ganeti") From patchwork Sat Mar 22 11:36:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40586 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 B405E27BBEA; Sat, 22 Mar 2025 11:38:34 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7B2AE27BBE2 for ; Sat, 22 Mar 2025 11:38:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBO-0002CD-Tp; Sat, 22 Mar 2025 07:38:30 -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 1tvxB2-0001mQ-43 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:08 -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 1tvxB1-00007x-Lg for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=KZ7oLLkXmt5hqfPyIHODxWcEeiUl8Vy7AV/4viyIeEc=; b=h36c1qe4aQ615uVW67CZ0ak0/uctpGTr8BXmi6GtyebcrkXdWzrdlpmPTtl3JQAt2D+jo1mFE7yjXlt7Rt81ghx2i11h4eMWF1LCsGuVp6UJglO5/7BO2A+AysuISJVsus+3iDde98kBycH7n+mWMd9uL8KLqlekMhTS4NverDdh+B2D2LocNnga/I/N7VZz8xPtI/mS/0afCC3TnH6vY7WrbjzZtbT7JxJsMzitQSxqRdtGJ9nkvDBye0LtBkEhIUzT08X8uOJbC6BDENSARIdYkh10EmUaoJRSLco731h9KWLmLXxYHesp1kuOtc7TFg+ljXwJbUxMmQn/vVndNg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxB1-0002Zc-H4 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 12/16] services: ganeti: Update to Shepherd 1.0 interface. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434679744 (code B ref 77041); Sat, 22 Mar 2025 11:38:07 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:47 +0000 Received: from localhost ([127.0.0.1]:41195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAh-0002X0-7u for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54254) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAZ-0002VL-Kq for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:39 -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 1tvxAU-0008VG-Bp; Sat, 22 Mar 2025 07:37:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=KZ7oLLkXmt5hqfPyIHODxWcEeiUl8Vy7AV/4viyIeEc=; b=EkigGbN6InrDFs9FLYVl tzfTEpV4Ng0pZMz4N4kTONHicV57+CdXhCcd5HttVMUI3oK2+7Aafxmw/2DSLfAgia4NPi3pNCvJo L554PCh0B2ps6oEHUAed6U6x3cZZ/4sVYVXyZF5k42kger/st1eDaqHN/W8S6pXPOLsecMyS3yzxu t4QWo5izpgXnhoZ2ztRS8GP2D9Wxx2GKZXoWXCCHvurSdcKWYpLeBojgFSzME2mwMaHDHtj3H8WfL 4p9m3+pBdkXuvMboI+2I8oz6/aFrwGsWU44tt42VkltT+/58AbaQbf+SOEaz0U//5Sl9Rguxn37af 9qTp51tXM7mhcw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:49 +0100 Message-ID: <2a37b6eecb6d9137fde541da20aacc24bd380dd3.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/ganeti.scm (shepherd-wconfd-force-start-action)[procedure]: Use ‘enable-service’ and ‘perform-service-action’ instead of ‘action’, which was deprecated in 0.10.x and replaced in 1.0. Change-Id: I2ba7d973b95f17f6ce093185fec7b246cf427be9 --- gnu/services/ganeti.scm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gnu/services/ganeti.scm b/gnu/services/ganeti.scm index ee72946c88..f905ab8395 100644 --- a/gnu/services/ganeti.scm +++ b/gnu/services/ganeti.scm @@ -329,18 +329,17 @@ (define shepherd-wconfd-force-start-action "Forcefully start wconfd even on non-master nodes (dangerous!).") (procedure #~(lambda _ (format #t "Forcefully starting the wconfd daemon...~%") - (action 'ganeti-wconfd 'enable) - (dynamic-wind - (lambda () - (false-if-exception - (call-with-output-file #$%wconfd-force-node-hint - (lambda (port) - (const #t))))) - (lambda () - (action 'ganeti-wconfd 'restart)) + (enable-service (lookup-service 'ganeti-wconfd)) + (call-with-output-file #$%wconfd-force-node-hint + (const #t)) + (catch #t (lambda () + (perform-service-action (lookup-service 'ganeti-wconfd) + 'restart) + (delete-file #$%wconfd-force-node-hint)) + (lambda _ (delete-file #$%wconfd-force-node-hint))) - #t)))) + #t)))) (define ganeti-wconfd-service (match-lambda From patchwork Sat Mar 22 11:36:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40593 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 56A0827BBEA; Sat, 22 Mar 2025 11:38:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9FBF627BBE2 for ; Sat, 22 Mar 2025 11:38:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBP-0002D3-2r; Sat, 22 Mar 2025 07:38:31 -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 1tvxB2-0001mc-Op for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:09 -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 1tvxB2-000089-5d; Sat, 22 Mar 2025 07:38:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=7v4wK2ppVQQ0rqCCLFhkZf8uHpvsjkFIbxXih6HV3HA=; b=Cu6X/hRMgswVs2a/DsBpiOKJ8WZUt+SYrJOLsygacNRLHpYTZwMvIRNWtb5yKSB8kLZhokSlz6Im3pT1DGmj3Jd/le13s/qwPA1wTaWiMbuvgP91JUV6f0my2343J9F2yeIm/JPal91py1TqEv8pe/LLPS+xsML6aJq89BxPhwkhuAmUE6+sGCiHxkZnN1Ts1pusTvVcOci5bBgOp5+e/lTAPvKZMpd/snJ9R4VHTVtA2hsOlm9IfBv+WwHD5+lJHOi2fRdeYUbPIzL6LbL1qK5LBv+8UNL9z3eqOqbQFgRSrUKJIckfLsHfZrwlNOXLbPfSNbdPGrx3w2LSjMo8Ew==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxB2-0002Zk-0A; Sat, 22 Mar 2025 07:38:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 13/16] services: ganeti: Produce Shepherd timers instead of mcron jobs. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434689751 (code B ref 77041); Sat, 22 Mar 2025 11:38:07 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:48 +0000 Received: from localhost ([127.0.0.1]:41197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAh-0002X9-Ls for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54270) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAb-0002VN-BX for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:42 -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 1tvxAW-0008VT-2I; Sat, 22 Mar 2025 07:37:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=7v4wK2ppVQQ0rqCCLFhkZf8uHpvsjkFIbxXih6HV3HA=; b=kfPQWuYP+Hb1sbYlNWIf CflY7riFA5Q17fT09E86145JBzvaxv6XN7+w3rbQfdHttlSrwHU17AZUMU4Z1mwWmPzHDjQ6YnPwQ v8Ncpa02jPgRnFLMICetS69NIyNoEG6/x8BDjEeUKCeQhmwkEdDLcFdDgVLHW5XFIQyAMio4bciga 1EH+sf7gUm+VfRX4kQITel9DyQm3jhzeX39BgzbHeS+XsEGEp8CWXx27ayQcl2UAXyfXmZyTEHQVi yylCa8GkCIIrNh5A23j3GWj8XAkN4TOM7bZoE0RqYCsfkVVTAX890hQU2LjzM1MkDaduFyv47HT98 k1pbveC/xyfO8A==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:50 +0100 Message-ID: <796377dee641cd4e4499d0afd4ed35abce4d799d.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/ganeti.scm ()[schedule]: Change default value to a cron string. (ganeti-timer): New procedure. (ganeti-watcher-jobs): Rename to… (ganeti-watcher-service): … this. Return Shepherd services. (ganeti-watcher-service-type)[extensions]: Adjust accordingly. (ganeti-cleaner-jobs): Rename to… (ganeti-cleaner-service): … this. Return Shepherd services. (ganeti-cleaner-service-type)[extensions]: Adjust accordingly. (ganeti-shepherd-services): Include the watcher and cleaner services. (ganeti-mcron-jobs): Remove. (ganeti-service-type)[extensions]: Adjust accordingly. * doc/guix.texi (Virtualization Services): Update ‘schedule’ documentation. Change-Id: Id209a3c50271203dc7190c4c6d0c0ffdf6c10875 --- doc/guix.texi | 7 ++- gnu/services/ganeti.scm | 116 +++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 64 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index df5378bce5..12eef9aa40 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -39874,8 +39874,11 @@ Virtualization Services @item @code{ganeti} (default: @code{ganeti}) The @code{ganeti} package to use for this service. -@item @code{schedule} (default: @code{'(next-second-from (next-minute (range 0 60 5)))}) -How often to run the script. The default is every five minutes. +@item @code{schedule} (default: @code{"*/5 * * * *"}) +When to run the script, expressed either as a string in traditional cron +syntax or as a gexp representing a Shepherd calendar event +(@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). The default is +every five minutes. @item @code{rapi-ip} (default: @code{#f}) This option needs to be specified only if the RAPI daemon is configured to use diff --git a/gnu/services/ganeti.scm b/gnu/services/ganeti.scm index f905ab8395..9cab6c110a 100644 --- a/gnu/services/ganeti.scm +++ b/gnu/services/ganeti.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020, 2022 Marius Bakke +;;; Copyright © 2025 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,14 +20,11 @@ (define-module (gnu services ganeti) #:use-module (gnu packages virtualization) #:use-module (gnu services) - #:use-module (gnu services mcron) #:use-module (gnu services shepherd) #:use-module (guix gexp) #:use-module (guix records) - #:use-module (srfi srfi-1) #:use-module (ice-9 match) - #:export (ganeti-noded-configuration ganeti-noded-configuration? ganeti-noded-configuration-ganeti @@ -644,9 +642,8 @@ (define-record-type* (ganeti ganeti-watcher-configuration-ganeti ;file-like (default ganeti)) (schedule ganeti-watcher-configuration-schedule ;list | string - (default '(next-second-from - ;; Run every five minutes. - (next-minute (range 0 60 5))))) + ;; Run every 5 minutes. + (default "*/5 * * * *")) (rapi-ip ganeti-watcher-configuration-rapi-ip ;#f | string (default #f)) (job-age ganeti-watcher-configuration-job-age ;integer @@ -660,36 +657,47 @@ (define ganeti-watcher-command (match-lambda (($ ganeti _ rapi-ip job-age verify-disks? debug?) - #~(lambda () - (system* #$(file-append ganeti "/sbin/ganeti-watcher") - #$@(if rapi-ip - #~((string-append "--rapi-ip=" #$rapi-ip)) - #~()) - #$(string-append "--job-age=" (number->string job-age)) - #$@(if verify-disks? - #~() - #~("--no-verify-disks")) - #$@(if debug? - #~("--debug") - #~())))))) + #~(#$(file-append ganeti "/sbin/ganeti-watcher") + #$@(if rapi-ip + #~((string-append "--rapi-ip=" #$rapi-ip)) + #~()) + #$(string-append "--job-age=" (number->string job-age)) + #$@(if verify-disks? + #~() + #~("--no-verify-disks")) + #$@(if debug? + #~("--debug") + #~()))))) -(define (ganeti-watcher-jobs config) +(define (ganeti-timer name schedule command) + "Return a Shepherd timer providing NAME and running COMMAND, a list-valued +gexp." + (shepherd-service + (provision (list name)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command '(#$@command)) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation "Periodically run a Ganeti maintenance job.") + (actions (list shepherd-trigger-action)))) + +(define (ganeti-watcher-service config) (match config (($ _ schedule) - (list - #~(job #$@(match schedule - ((? string?) - #~(#$schedule)) - ((? list?) - #~('#$schedule))) - #$(ganeti-watcher-command config) - "ganeti-watcher"))))) + (list (ganeti-timer 'ganeti-watcher + schedule + (ganeti-watcher-command config)))))) (define ganeti-watcher-service-type (service-type (name 'ganeti-watcher) (extensions - (list (service-extension mcron-service-type - ganeti-watcher-jobs))) + (list (service-extension shepherd-root-service-type + ganeti-watcher-service))) (default-value (ganeti-watcher-configuration)) (description "@command{ganeti-watcher} is a periodically run script that @@ -714,34 +722,23 @@ (define-record-type* ;; Run the node cleaner at 02:45 every day. (default "45 2 * * *"))) -(define ganeti-cleaner-jobs +(define ganeti-cleaner-service (match-lambda (($ ganeti master-schedule node-schedule) - (list - #~(job #$@(match master-schedule - ((? string?) - #~(#$master-schedule)) - ((? list?) - #~('#$master-schedule))) - (lambda () - (system* #$(file-append ganeti "/sbin/ganeti-cleaner") - "master")) - "ganeti master cleaner") - #~(job #$@(match node-schedule - ((? string?) - #~(#$node-schedule)) - ((? list?) - #~('#$node-schedule))) - (lambda () - (system* #$(file-append ganeti "/sbin/ganeti-cleaner") - "node")) - "ganeti node cleaner"))))) + (list (ganeti-timer 'ganeti-master-cleaner + master-schedule + #~(#$(file-append ganeti "/sbin/ganeti-cleaner") + "master")) + (ganeti-timer 'ganeti-node-cleaner + node-schedule + #~(#$(file-append ganeti "/sbin/ganeti-cleaner") + "node")))))) (define ganeti-cleaner-service-type (service-type (name 'ganeti-cleaner) (extensions - (list (service-extension mcron-service-type - ganeti-cleaner-jobs))) + (list (service-extension shepherd-root-service-type + ganeti-cleaner-service))) (default-value (ganeti-cleaner-configuration)) (description "@command{ganeti-cleaner} is a script that removes old files @@ -804,7 +801,8 @@ (define (ganeti-activation config) (define ganeti-shepherd-services (match-lambda - (($ _ noded confd wconfd luxid rapi kvmd mond metad) + (($ _ noded confd wconfd luxid rapi kvmd mond metad + watcher cleaner) (append (ganeti-noded-service noded) (ganeti-confd-service confd) (ganeti-wconfd-service wconfd) @@ -812,13 +810,9 @@ (define ganeti-shepherd-services (ganeti-rapi-service rapi) (ganeti-kvmd-service kvmd) (ganeti-mond-service mond) - (ganeti-metad-service metad))))) - -(define ganeti-mcron-jobs - (match-lambda - (($ _ _ _ _ _ _ _ _ _ watcher cleaner) - (append (ganeti-watcher-jobs watcher) - (ganeti-cleaner-jobs cleaner))))) + (ganeti-metad-service metad) + (ganeti-watcher-service watcher) + (ganeti-cleaner-service cleaner))))) (define-record-type* ganeti-os make-ganeti-os ganeti-os? @@ -1122,9 +1116,7 @@ (define ganeti-service-type (service-extension etc-service-type ganeti-etc-service) (service-extension profile-service-type - (compose list ganeti-configuration-ganeti)) - (service-extension mcron-service-type - ganeti-mcron-jobs))) + (compose list ganeti-configuration-ganeti)))) (default-value (ganeti-configuration (os %default-ganeti-os))) (description "Ganeti is a family of services that are designed to run From patchwork Sat Mar 22 11:36:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40598 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 23EE727BBEA; Sat, 22 Mar 2025 11:39:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D6EAF27BBE2 for ; Sat, 22 Mar 2025 11:39:13 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBO-0002A6-Do; Sat, 22 Mar 2025 07:38:30 -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 1tvxB4-0001nA-M8 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:12 -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 1tvxB2-00008K-Pg for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=1/8Zv4QX9VLRAfckrNt6hj0Ne4v3y5mtwwjSEHnjsnk=; b=d5Bv63WW8iA919HgmcUCpQ4g8Q0vn5cRRHepNN0oZ/8Jud2YfR8wxLtVjypO2ILq/RLPbhAnYbgm9qwu6hfU7NMLh2U+1sViB3CcpDm6NRMzE3P3d2r3nM38SL9IhJWFZE3QtgmKBQff2fzqSlfyH8kvKaNNusispP4tc1ZucojAjT4TSoGmqUGjNZAzQfyIkZ3WTyn/L+I3WnQSC2L+tje7uRv78gf4k18mccLwdG1uYf7EnHPMLVNd9cMnPhxa7iVGCNHHr//5LoTbORUGYBYj4zKPdq6rNNP608eCpg6Pqx+BVHo+2KOxKpR/+7Ca6ckLDjWkmbK+W8e6sgha8w==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxB2-0002Zs-Fp for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 14/16] services: virtual-build-machine: Turn GC job into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434699759 (code B ref 77041); Sat, 22 Mar 2025 11:38:08 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:49 +0000 Received: from localhost ([127.0.0.1]:41199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAi-0002XK-IB for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54272) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAc-0002VP-Af for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:42 -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 1tvxAX-0008Ve-22; Sat, 22 Mar 2025 07:37:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=1/8Zv4QX9VLRAfckrNt6hj0Ne4v3y5mtwwjSEHnjsnk=; b=akxcP05LrAu1Y9m65vC0 1HIikwXLPgQvxHIRltIUwy89Cn//IkiMGve1MtCtMfWU88byIfsljFc6X43RbwLG7yhNz23GiVXrw NMMP6nosSfJZsVgzd+YiCodF6zrs44mKJ9N2ob8yoV+aVFdqZ4eV+Ka7iwfWWvDDvigglNM9c7ytS e29uM64Q1zYVJm5iA6XDsop+VgkhKokyqnnlRmcZIE4b1rG21KpzJNoHl9RaFuHf7AQh0lHh5SkqM lm+kRLZxs4FM4p8ITmsz4siVX14Zkg/Dq5j8W/eyooEurEiOjJ81gXURYvnjPfoXuaxLhtPV3Ku4c 3dTY6xptKDiP/w==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:51 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/virtualization.scm (gc-service-type): New variable. (%virtual-build-machine-operating-system): Use instead of extending ‘mcron-service-type’. Change-Id: I56d7f9293f582269e5a34d91bf4f3edddfa844e0 --- gnu/services/virtualization.scm | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index 555c0be55e..90a0265a59 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -40,7 +40,6 @@ (define-module (gnu services virtualization) #:use-module (gnu services base) #:use-module (gnu services configuration) #:use-module (gnu services dbus) - #:use-module (gnu services mcron) #:use-module (gnu services shepherd) #:use-module (gnu services ssh) #:use-module (gnu services) @@ -1353,6 +1352,23 @@ (define %system-log-message-destination (else '("/dev/console"))))) +(define gc-service-type ;TODO: Factorize. + (shepherd-service-type + 'garbage-collection + (lambda _ + (shepherd-service + (provision '(gc)) + (requirement '(user-processes guix-daemon)) + (start #~(make-timer-constructor + (calendar-event #:minutes '(12)) + (command + '("/run/current-system/profile/bin/guix" "gc" "-F2G")) + #:wait-for-termination? #t)) + (stop #~(make-timer-constructor)) + (actions (list shepherd-trigger-action)))) + #t + (description "Periodically collect garbage."))) + (define %virtual-build-machine-operating-system (operating-system (host-name "build-machine") @@ -1385,9 +1401,7 @@ (define %virtual-build-machine-operating-system (openssh openssh-sans-x))) ;; Run GC once per hour. - (simple-service 'perdiodic-gc mcron-service-type - (list #~(job "12 * * * *" - "guix gc -F 2G"))) + (service gc-service-type) (modify-services %base-services ;; By default, the secret service introduces a From patchwork Sat Mar 22 11:36:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40597 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 6C90D27BBE9; Sat, 22 Mar 2025 11:39:03 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E877327BBE2 for ; Sat, 22 Mar 2025 11:39:02 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxBP-0002FJ-RA; Sat, 22 Mar 2025 07:38:31 -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 1tvxB8-0001qP-Sv for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:15 -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 1tvxB4-00008a-M9; Sat, 22 Mar 2025 07:38:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=R+pLjTM5mgdfIeQiOCzWOw88mhx3xEQaNcOS0HOnIWA=; b=lMFdmh0NYtKFyczOK/35cRiJ/SvfqPCaetQW6n9mKkFKDbjhh2ny34UwrNHJ/TS7eij5Dw4WQxGEK79YXsCXgRZ9axwOc8MmbN4lSHUU4Ry0VXIQI3HebhvX2USWBcQglUgIsxegnWrgourlPqsqSDmvrtdBcWiEkVzebF2M18GOiCSdXDAv7cQQJsKN6gVf2rqPyPdyGHkdTbRBE+m/VshX3pgt+sNGpcvDJu4c1FXNS/MXP+5xTDaD6qa0OOut9y6P3p2ay+rDbVfc47cbZm9xLcOjlQdkzzJzuBOrzKspHNDBRMRJdICCxOn7xSF7goO3P9LGiGuOY/LPYWvmug==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxB3-0002a0-2r; Sat, 22 Mar 2025 07:38:09 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 15/16] services: shepherd: Add =?utf-8?b?4oCY?= =?utf-8?b?c2hlcGhlcmQtdGltZXLigJku?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Luis Guilherme Coelho , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour X-Debbugs-Original-Xcc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434699766 (code B ref 77041); Sat, 22 Mar 2025 11:38:09 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:49 +0000 Received: from localhost ([127.0.0.1]:41201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAi-0002XM-Sq for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54284) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAd-0002VW-MM for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:44 -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 1tvxAY-0008Vr-55; Sat, 22 Mar 2025 07:37:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=R+pLjTM5mgdfIeQiOCzWOw88mhx3xEQaNcOS0HOnIWA=; b=LXhI9AS+6LtfgN5RD6zm DKpT9BZetwsOLMgVWHXGdURXh/TIzb+Rp6S7/YKatqfV0BoC7B9Qkp5HMgHkuaT8nrx9e5QRH7/PC 7Z6sRu8a1TRgWDs0uQM8Pc6aLPkyVEmCza+zuhML9aprGPI6rEaXZPzPFdKOGT1YJcHQVe4g4ZSIM WVrEfAAdGCBuv3z8CWdcJ9H1WXUVQ4fFrSy22da6xEI09fLg6yqXyLysQ0xnaGTrJ/CjzPIXtUzry lV1A8KLfolIU8GigrSPvlHhJ6TUaFaHAxZFJLEgZZ2dOlBVTn3wzZOTXPCNMTaOZO2Qx2rlnqjMBw 2hIfnSwuEfcVqA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:52 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/shepherd.scm (shepherd-timer): New procedure. * gnu/home/services/shepherd.scm: Re-export it. Suggested-by: Luis Guilherme Coelho Change-Id: I5f702d4119eee47381a7a1ac650b8ad3fc5e6cdd --- gnu/home/services/shepherd.scm | 3 ++- gnu/services/shepherd.scm | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm index 25f1641b32..b4d826f6bb 100644 --- a/gnu/home/services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -53,7 +53,8 @@ (define-module (gnu home services shepherd) shepherd-action shepherd-configuration-action - shepherd-trigger-action)) + shepherd-trigger-action + shepherd-timer)) (define-record-type* home-shepherd-configuration make-home-shepherd-configuration diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index e7e414b920..c8e01c9d83 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -72,6 +72,7 @@ (define-module (gnu services shepherd) shepherd-action-procedure shepherd-configuration-action + shepherd-timer shepherd-trigger-action %default-modules @@ -257,6 +258,31 @@ (define (shepherd-service-canonical-name service) "Return the 'canonical name' of SERVICE." (first (shepherd-service-provision service))) +(define %default-timer-documentation + "Periodically run a command.") ;no i18n since it gets in the shepherd process + +(define* (shepherd-timer provision schedule command + #:key + (requirement '()) + (documentation %default-timer-documentation)) + "Return a Shepherd service with the given PROVISION periodically running +COMMAND, a list-valued gexp, according to SCHEDULE, a string in Vixie cron +syntax or a gexp providing a Shepherd calendar event. DOCUMENTATION is the +string that appears when running 'herd doc SERVICE'." + (shepherd-service + (provision provision) + (requirement requirement) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command '(#$@command)) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation documentation) + (actions (list shepherd-trigger-action)))) + (define (assert-valid-graph services) "Raise an error if SERVICES does not define a valid shepherd service graph, for instance if a service requires a nonexistent service, or if more than one From patchwork Sat Mar 22 11:36:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40600 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 D487A27BBE2; Sat, 22 Mar 2025 11:39:20 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 24A1F27BBEB for ; Sat, 22 Mar 2025 11:39:20 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxC9-0003AC-8a; Sat, 22 Mar 2025 07:39:17 -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 1tvxBu-00030F-V1 for guix-patches@gnu.org; Sat, 22 Mar 2025 07:39:04 -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 1tvxBt-0000Jq-SZ; Sat, 22 Mar 2025 07:39:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=OwNCHcL/DSCY43ZGkUxSOWTuVU8NwUZzlF7xn5EKudY=; b=n9rdAXZUGDkyftWzobA0AF6w2Vlm59tW983u/ADQlrxJzZ0sHJMVLfc4rF5SZfp7SW997thFc/yp00olzg9zPLQeKTP7pIYWPj5+3Vd++BOwHNtoBka7p/QwhMDRbm15YegXYVW/BS1vEmXkAld6NEhC3mFPPny+cloDN6Rdd6gJPIIPBAvydkBBryIXvDlqVTc0THC1JXMQlDckaBijdGsvWeOweVTmV4eXmj+8c9V9gDpgwbb+UuEzlzv+Ri5zgGulfVU75ujF6hVwC9zCqIQ6wwEGreRz/ajgB6+BHUz0YMTXa+6/oqkf2RptucRANov6naWyzcHl+RovAL0YbQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxBt-0002bX-Lm; Sat, 22 Mar 2025 07:39:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 16/16] doc: Document Shepherd timers and recommend against mcron. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426435209977 (code B ref 77041); Sat, 22 Mar 2025 11:39:01 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:38:40 +0000 Received: from localhost ([127.0.0.1]:41229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxBX-0002aq-IW for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:38:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54296) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAe-0002Vd-HO for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:45 -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 1tvxAZ-0008WG-8O; Sat, 22 Mar 2025 07:37:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=OwNCHcL/DSCY43ZGkUxSOWTuVU8NwUZzlF7xn5EKudY=; b=ddhPlVasILnirU4Kq804 gh8GSdqJX1j3sdil++aSRNh7oipal6Pv/wvSNLe1BdllMMCsWD2U68XtpjA+NrUk5gPyAtASqb0G8 BXppOZA49WdUSyLOMZVfG62djXQEmkDMVG1uBFNjUys765MXeIvi6UyEo0qslviusogMaEUy1VEMg B1HfHt/Iquxky/F3+zOwp55DKQvNQ6bpP6q1zuyHZbUhw/hKDZQmTO1sGk1znsSgooDyCns2bmDCJ GNa+PtaCXC2wCcUOoTfa4LjKDx6gjPihxwYmaQd+slubw0FY1J5qbzF9rqN8ItAsRm/llBlb3/GJn okqv6qxyWDYJMA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:53 +0100 Message-ID: <521517bc62856586343fd55dad508a32cc3a29d1.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Scheduled Job Execution): Add intro. Add “Shepherd Timers” subsection; move previous documentation to “Mcron” subsection. Recommend use of Shepherd timers. (Mcron Home Service): Recommend Shepherd timers. (Shepherd Home Service): Document timers. Change-Id: I9dba68a0d062f5aeeae29ff725e1161f2bd3b291 --- doc/guix.texi | 168 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 159 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 12eef9aa40..4592523f81 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20849,14 +20849,123 @@ Scheduled Job Execution @subsection Scheduled Job Execution @cindex cron -@cindex mcron @cindex scheduling jobs -The @code{(gnu services mcron)} module provides an interface to +It is often useful to have system tasks run periodically. This can be +achieved by defining Shepherd @dfn{timers} or by using the historical +and somewhat less flexible mcron service. + +@subsubsection Shepherd Timers + +@cindex timers, Shepherd +@cindex Shepherd timers +The Shepherd supports running jobs periodically by defining +@dfn{timers}, a special kind of service. A Shepherd timer can be +defined like another Shepherd service, but with specific @code{start} +and @code{stop} methods (@pxref{Shepherd Services}): + +@lisp +;; Defining a timer, verbosely. +(shepherd-service + (provision '(updatedb)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + ;; Everyday at 3AM (using Vixie cron syntax). + (cron-string->calendar-event "0 3 * * *") + (command '(#$(file-append findutils "/bin/updatedb"))) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation "Periodically run 'updatedb'.") + (actions (list shepherd-trigger-action))) +@end lisp + +This is quite some boilerplate so you can instead use this equivalent +shorthand notation: + +@lisp +;; Equivalent timer definition, but shorter. +(shepherd-timer '(updatedb) "0 3 * * *" + #~(#$(file-append findutils "/bin/updatedb")) + #:requirement '(user-processes)) +@end lisp + +This procedure is defined as follows. + +@anchor{shepherd-timer-procedure} +@deffn {Procedure} shepherd-timer @var{provision} @var{schedule} @ + @var{command} [#:requirement '()] @ + [#:documentation %default-timer-documentation] +Return a Shepherd service with the given @var{provision} periodically +running @var{command}, a list-valued gexp, according to @var{schedule}, +a string in Vixie cron syntax or a gexp providing a Shepherd calendar +event. @var{documentation} is the string that appears when running +@code{herd doc @var{service}}. +@end deffn + +The example below shows how to define a timer and to add it to your +operating system configuration. + +@lisp +(use-modules (gnu)) +(use-service-modules shepherd) +(use-package-modules base) + +(define updatedb-timer + ;; Run 'updatedb' at 3AM everyday. + (shepherd-timer '(updatedb) + "0 3 * * *" ;Vixie cron syntax + #~(#$(file-append findutils "/bin/updatedb") + "--prunepaths=/tmp /var/tmp /gnu/store") + #:requirement '(user-processes))) + +(define garbage-collection-timer + ;; Run 'guix gc' everyday at 5AM. + (shepherd-timer '(garbage-collection) + #~(calendar-event #:hours '(5) #:minutes '(0)) + #~("/run/current-system/profile/bin/guix" + "gc" "-F" "10G") + #:requirement '(guix-daemon))) + +(operating-system + ;; @dots{} + + ;; Extend the Shepherd service with additional timers + ;; using 'simple-service'. + (services (cons (simple-service 'my-timers + shepherd-root-service-type + (list garbage-collection-timer + updatedb-timer)) + %base-services))) +@end lisp + +The resulting system contains these two services, which can be inspected +with @command{herd status}. They can also be triggered manually: + +@example +herd trigger garbage-collection +@end example + +@ref{Timers,,, shepherd, The GNU Shepherd Manual} for more information +on Shepherd timers. + +@anchor{mcron-service} +@subsubsection Mcron + +@cindex mcron +Alternatively, +the @code{(gnu services mcron)} module provides an interface to GNU@tie{}mcron, a daemon to run jobs at scheduled times (@pxref{Top,,, mcron, GNU@tie{}mcron}). GNU@tie{}mcron is similar to the traditional Unix @command{cron} daemon; the main difference is that it is -implemented in Guile Scheme, which provides a lot of flexibility when -specifying the scheduling of jobs and their actions. +implemented in Guile Scheme. It is overall less convenient than +Shepherd timers: individual jobs cannot depend on specific Shepherd +services, logging is coarse-grain (one file for all the jobs), jobs may +not be inspected, updated, or triggered manually. + +@quotation Note +For the reasons given above, we recommend using Shepherd timers rather +than mcron for your periodic tasks. +@end quotation The example below defines an operating system that runs the @command{updatedb} (@pxref{Invoking updatedb,,, find, Finding Files}) @@ -48610,18 +48719,23 @@ Shells Home Services @node Mcron Home Service @subsection Scheduled User's Job Execution -@cindex cron -@cindex mcron -@cindex scheduling jobs - +@cindex cron, per-user +@cindex mcron, per-user +@cindex scheduling jobs per-user The @code{(gnu home services mcron)} module provides an interface to GNU@tie{}mcron, a daemon to run jobs at scheduled times (@pxref{Top,,, mcron, GNU@tie{}mcron}). The information about system's mcron is -applicable here (@pxref{Scheduled Job Execution}), the only difference +applicable here (@pxref{mcron-service, mcron reference}), the only difference for home services is that they have to be declared in a @code{home-environment} record instead of an @code{operating-system} record. +@quotation Note +We recommend defining periodic tasks as Shepherd timers, which provide +more flexibility than mcron. @xref{Shepherd Home Service}, for more +info. +@end quotation + @defvar home-mcron-service-type This is the type of the @code{mcron} home service, whose value is a @code{home-mcron-configuration} object. It allows to manage scheduled @@ -48784,6 +48898,42 @@ Shepherd Home Service @end table @end deftp +@cindex timers, per-user +The Shepherd allows you to define @dfn{timers}, a special type of +service that performs a given task periodically. Just like you can +define timers at the system level (@pxref{Scheduled Job Execution}), you +can do so in your home environment. + +The example below defines a home environment where a Shepherd timer runs +the @command{mkid} command twice per day (@pxref{mkid invocation,,, +idutils, ID Database Utilities}). It does so by extending +@code{home-shepherd-service-type} with @code{simple-service}; the +Shepherd timer itself is produced by the @code{shepherd-timer} procedure +(@pxref{shepherd-timer-procedure, @code{shepherd-timer}}), which is +given the service name, a gexp specifying its schedule, and a gexp +specifying the command to run. + +@lisp +(use-modules (gnu) (guix) + (gnu home services shepherd) + (gnu packages idutils)) + +(define idutils-service + ;; Index my 'doc' directory everyday at 12:15PM and 7:15PM. + (simple-service + 'update-idutils-database home-shepherd-service-type + (list (shepherd-timer '(update-idutils-database) + #~(calendar-event #:hours '(12 19) + #:minutes '(15)) + #~(#$(file-append idutils "/bin/mkid") + "doc"))))) + +(home-environment + ;; @dots{} + (services (append (list idutils-service) + %base-home-services))) +@end lisp + @cindex log rotation, for user services The Shepherd also comes with a @dfn{log rotation service}, which compresses and then deletes old log files produced by services and