From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id YE7kCE4QiGYrxgAA62LTzQ:P1 (envelope-from ) for ; Fri, 05 Jul 2024 15:25:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id YE7kCE4QiGYrxgAA62LTzQ (envelope-from ) for ; Fri, 05 Jul 2024 17:25:02 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=wolfsden.cz header.s=mail header.b=s+EVNq5T; dkim=pass header.d=wolfsden.cz header.s=mail header.b="Etx/gDkS"; dmarc=pass (policy=none) header.from=wolfsden.cz; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1720193102; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=s9RWK/2PqYgVc++ECioBmw7LGrNdQOwAicZvg2mCIj4=; b=YWZ329h0vJYbdcPDLYoRQWgJnMxUPKM5NaPmGhFaM/whsRVtNzg5XEFTi+Is4xw2jJhs6N ylkp/dBOUE6FH1j8rPY58QH/vXHWtLqnrefqRHoVFDuT90sZhzHeDJOSPpEAwskxjysU3v YzPGYAgMYaspAqfCkiCLg6CECjJyYGQub+WzSDRQo99ZaEu6Gd5JmaEqjdJy5gU/PZbN4O farcDQDt6ywdKLRHko9xRQsgqwbrAveJ5bM9wfoc8BhMpGjCsN4283wgZWYNnUK9Vgeh1m oaa61yZDaev/YKqVVGOICYJYZnTbTU+bwGMjNaN0K6EHv3VkU9g3u2jF6Ca8QA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1720193102; a=rsa-sha256; cv=none; b=EXMzRdWlla91SlwtEz6pl4H1nXGcWV42qwXkxuWmU890MIyGb2335ajC8vr6ixAIReG+7V OIFKe1Q6ndXeS78EqHGnkH6C0foxzJRrQRhsyBEqYh1x8q0loaAeWzmqrt9vvb/HS4TLgS nRO24qpLiI/lairhbz9L9YoDQVz6Uf6vwdB31LsMVIIlHQSJw0vLYMJZIgr6KqXs/OYFOM JPCEFcFe7C9Ar6LrXEgNN1FLaB0HD3S03bEoAJ4QLntd5d5K8/RtOZbE9m1wIs2+ojEO6f kNw2YmIR2i4JTFcN3LSYALP6LPYrkxwt+6d6bCSY/P3cDwYmzy82/hW1ph0Hjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=wolfsden.cz header.s=mail header.b=s+EVNq5T; dkim=pass header.d=wolfsden.cz header.s=mail header.b="Etx/gDkS"; dmarc=pass (policy=none) header.from=wolfsden.cz; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E6DED33E85 for ; Fri, 5 Jul 2024 17:25:01 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPknK-0000HZ-T8; Fri, 05 Jul 2024 11:24:19 -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 <~@wolfsden.cz>) id 1sPknI-0000HE-Gf for guix-devel@gnu.org; Fri, 05 Jul 2024 11:24:16 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sPknF-0004ME-6c for guix-devel@gnu.org; Fri, 05 Jul 2024 11:24:16 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 616572B0EC6; Fri, 5 Jul 2024 15:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1720193050; bh=0toPoiu1h3rJvW7k/3TeKuappHHl53HEJpgGdfX9iNc=; h=Date:From:To:Subject; b=s+EVNq5TQjvju1oa737uUS1C2iBLhGK3OtYVg8aqGmy0d8Q3Kz+cedQGCGGR230AI mkRIhIBoo8dC64vssDZP9bmcVZtm4XdV5DWGdGl5g3dOlzWH1RqlHT6C4RR/eQDk4/ YnnORxjO8b4tFl63kycdNq4aPfYY6GCAqPsJjahgveNweflS+MgUloD2mQjeuGMwm3 VjANobo35Daz5n9CQNCrD46fvHc/7PhRCTQiBC5fVW0QiViAxfCRFG0/AN/HILSUnU 1V36SyHR+8tnEtz01S10O6WHTfdO9/47gVq35fgnWBgmS7xi5BgWsJ9pkusptKajkJ SuxegdTBVJEodcHRmnhFi252lSMRsFgQs9QIBaJFrBC3Plr+ZOI4Nmh8ZGZqwekZ54 rGoB5syaXlLJhfreKstUYqswDSOLI2ZkV5U+2T5va9sO+4tAmpwo9mCtFoQj/XKDhq THMgtcPeBCEE+LnIW7QtqznoUSRM2eQ1OoQAn82oATm9vF9IGlCK19P9SA/N8YNi/8 lleFnbVrXolhPFVoLfxcqPFO0ONkJP9nytk9roY/sIh7jTb9BEpBZMX6v8symisN5z eEVihH7EfwJEr1ixnIttC6daVmS4CjrsvwUXXUgWsbsT5H3qxKJS3wyL+D9SHuc3w5 ib44Wfxtojdv0ZvwtJCLeC7Q= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 7DC422B188D for ; Fri, 5 Jul 2024 15:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1720193049; bh=0toPoiu1h3rJvW7k/3TeKuappHHl53HEJpgGdfX9iNc=; h=Date:From:To:Subject; b=Etx/gDkSJISoXcZoCd+4xrRWaCOO3xSpkZDHF139TX4wyT62fkRUBOraoM858YS4f q24xgTH8dxPEhaAF2W5D0we9nmPMUKg5Axq03eknYiNi7rgTRDUiTablcwYBzKKGcr adEQgUYB3rP57qfeqyawoF+7og0TrrQdrmr9Fv4iSvo23vwsk9TLyS7K4MATp71Huj FSNuEkqu6q4UGTg0vIP7dJHPEOH4Zg2JGgBkUCim7xjsIjjjM0InWHw4EbTf2wovNd tu3nNTs1rav3P+k2bYOwm7Fx+s8sjxwwDDOW+NK08xFJoeaC0fuJZd9IgA8IFEbqNb Zv+CHO3Ek4awZa2EbGBukBsRYEHeZvJxE3Z667y7n8sL26lOzKimUnsST+Syt89Gkp 2dINJASHh5sbAG/wqlN7BV9oaf00u6QWHeE+4vY+mbDyEZP0edq+/jbs4lul992tep KSwA2iyRIx2kdG1tQuSVLVFXiZHiKq+3QUpfIO2lmuw3Pcjgko/h12DK2uWDMTQRTz cx1qp4jS1HO4OieEx3tf8D96rwt1+sn18ou1kZ19/wPsnPPqqyo0psr81HTDD1/yFC NCtCv9aHqjf9E0TxF/o6h7poCZEbmHLTBfeifjElwn+y8MqKehtwaY1mY0vjhrHomn JMbFvRu6XjbB5C2yVsIGRZRo= Date: Fri, 5 Jul 2024 17:24:08 +0200 From: Tomas Volf <~@wolfsden.cz> To: guix-devel@gnu.org Subject: How to invoke shepherd action from shepherd action? Message-ID: Mail-Followup-To: guix-devel@gnu.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="S6VGZug7y4hkLkMJ" Content-Disposition: inline Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: E6DED33E85 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -10.57 X-Spam-Score: -10.57 X-TUID: 7918KniNYVuf --S6VGZug7y4hkLkMJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, I am currently in the process of writing a new service, and I have run into bit of a wall. I need to invoke shepherd action after my one-shot service finishes. The code (relevant bits) for my service is pretty simple: (define (acme-client-shepherd-services config) (let* ((config-file (serialize-acme-client-configuration config)) (package (acme-client-configuration-package config)) (reload-hook (acme-client-configuration-reload-hook config)) (requirement (acme-client-configuration-requirement config)) (handles (map acme-client-domain-handle (acme-client-configuration-domains config)))) (list (shepherd-service (provision '(acme-client-initial)) (requirement requirement) (documentation "Invoke right away to provision certificates immediately.") (one-shot? #t) (start #~(lambda _ (let* ((renew-cert #$(renew-cert config)) (renew-res (map (lambda (handle) (or (renew-cert handle) (begin (sleep 15) (renew-cert handle)) (begin (sleep 15) (renew-cert handle)))) '#$handles))) (when (memq 'change (pk renew-res)) (pk (#$reload-hook))) ((@ (srfi srfi-1) every) identity renew-res)))) (actions (list (shepherd-configuration-action config-file))))))) Now the problem is with the `reload-hook'. I tried two approaches (the following is a snippet from define-configuration/no-serialization for acme-client-configuration): 1. with-shepherd-action (reload-hook (gexp (with-imported-modules '((gnu services herd)) #~(begin ((@ (gnu services herd) with-shepherd-action) 'nginx ('reload) result result)))) "Hook to invoke after certificate change. The default is to reload nginx.") This just hangs the shepherd for ever. Even `herd status' no longer works. Only recovery I found was hard reboot. 2. invoke (reload-hook (gexp (with-imported-modules '((guix build utils)) #~((@ (guix build utils) invoke) ;; There probably is more elegant way to get the current shepherd. #$(file-append (shepherd-configuration-shepherd (shepherd-configuration)) "/bin/herd") "reload" "nginx"))) This does work, but the round-trip via separate binary (and the way to figure it out) is hardly elegant. Could someone advice me on how the typical pattern for this should look? Preferably while staying inside Guile (so no invoke). Thanks and have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --S6VGZug7y4hkLkMJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmaIEBgACgkQL7/ufbZ/ walH+hAAsAEnFfSdQyDqpAZWRdEv8xs++QfdGA75D5qK4fooZP6Mldf++9I0b2ix GvNmNeiEFHdV18DlW2pbFJ6zK+38ohYJQwy8oWc4v42cdj1k7DPfHcLvNwaRh9/O 0O9CslBSDMkuEeNNYzk0aIKYVaFsHGMTFxgFYYdH25+683VvEM9rKfs0SMXWWYcN S+n+u3quE2DycEI9T0wXmGJ2IV1VDtEiIx4k2JMcO6jIsoUltSvgBAJglhz4PfSx cHXUDL+cqXEE0NG6hicHqKXwTzkHC0vtWc2g6n5B24yuGj9k1BUAq59fwrsfp04a aF4rzyMBjsBbvWqOP7JvEH7fT6SajfAH3GmS6PBO23zgrPJQNvr5TqE5sWoorfxr S0HLJxz6BWOeJnnk5/TaqjG/OURdpYES0nqBogMi4Q34dfH999huLxCrVve33nQY w2s2qnNnLCnMPr5O8eR+ZlwAqvwx0eFHRZTcLOwd3HiqSqS39dGQ6V3oVlQOjiXN eZaOwZQmydMXxZIjr97UTE02nqHouHhdQzRSgFTKOQg3mzi8QINkC+2GCtkgoO6J p7CvW57pXZHyHOEOs10McxATXardpuJbzHxlc6viiV+kNOeRub1NQMCQhesU5mUd xxXOpNLU+z0a9BNO6dAk6j8K1/fOi2lZfMM1X/NVtK+q7b3d8D0= =8/xz -----END PGP SIGNATURE----- --S6VGZug7y4hkLkMJ--