From: Carlo Zancanaro <carlo@zancanaro.id.au>
To: Christopher Baines <mail@cbaines.net>
Cc: Andy Tai <atai@atai.org>, guix-devel@gnu.org, guix-sysadmin@gnu.org
Subject: [PATCH maintenance] hydra: services: Reload nginx when certbot updates certificates.
Date: Mon, 17 Jun 2024 21:03:50 +1000 [thread overview]
Message-ID: <20240617110421.28377-1-carlo@zancanaro.id.au> (raw)
In-Reply-To: <877ceo58mh.fsf@cbaines.net>
* hydra/modules/sysadmin/services.scm (%certbot-deploy-hook): New
variable.
(%certbot-job): Pass %certbot-deploy-hook to certbot invocation.
---
I think this patch should resolve the certificate issue more
permanently. I haven't tested it at all, but I mostly just stole it
from Guix's certbot service. I know it works there, so I'm just
assuming it will work here, too.
hydra/modules/sysadmin/services.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/hydra/modules/sysadmin/services.scm b/hydra/modules/sysadmin/services.scm
index 128b0c1..3d996f5 100644
--- a/hydra/modules/sysadmin/services.scm
+++ b/hydra/modules/sysadmin/services.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2023 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2023 Lars-Dominik Braun <ldb@leibniz-psychology.org>
;;; Copyright © 2024 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2024 Carlo Zancanaro <carlo@zancanaro.id.au>
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
@@ -616,11 +617,19 @@ to a selected directory.")
`(("nginx" ,(file-append nginx "/share/nginx/conf")))))
+(define %certbot-deploy-hook
+ ;; Reload nginx after a new certificate is deployed.
+ (with-imported-modules '((gnu services herd))
+ #~(begin
+ (use-modules (gnu services herd))
+ (with-shepherd-action 'nginx ('reload) result result))))
+
+
(define %certbot-job
;; Attempt to renew the Let's Encrypt certificate twice a week.
#~(job "30 0 * * 2,5"
(string-append #$certbot "/bin/certbot renew \
---webroot --webroot-path /var/www")))
+--webroot --webroot-path /var/www --deploy-hook " #$certbot-deploy-hook)))
\f
base-commit: 489fc437c7b3aa0af41a40d6090eb4c51ced0028
--
2.41.0
next prev parent reply other threads:[~2024-06-17 11:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-16 23:08 issues.guix.gnu.org certificate expired Andy Tai
2024-06-17 7:30 ` Christopher Baines
2024-06-17 11:03 ` Carlo Zancanaro [this message]
2024-06-17 13:26 ` [PATCH maintenance] hydra: services: Reload nginx when certbot updates certificates Ludovic Courtès
2024-06-17 23:35 ` Carlo Zancanaro
2024-06-18 12:46 ` Andreas Enge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240617110421.28377-1-carlo@zancanaro.id.au \
--to=carlo@zancanaro.id.au \
--cc=atai@atai.org \
--cc=guix-devel@gnu.org \
--cc=guix-sysadmin@gnu.org \
--cc=mail@cbaines.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).