From 601691e7ea07c999d60993464b27d4cba2621f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 22 Dec 2021 12:42:36 +0100 Subject: [PATCH] hydra: web: Provide all-in-one 'guix-web-site-service-type'. * hydra/modules/sysadmin/web.scm (guix-static-web-sites) (guix-web-site-service-type): New variables. * hydra/nginx/berlin.scm (%berlin-servers): Remove GUIX.GNU.ORG-NGINX-SERVER. * hydra/website.scm (website-services): Remove 'static-web-site-service-type' instance for guix.gnu.org and use 'guix-web-site-service-type' instead. * hydra/bayfront.scm : Extend STATIC-WEB-SITE-SERVICE-TYPE for hpc.guix.info. --- hydra/bayfront.scm | 5 +-- hydra/modules/sysadmin/web.scm | 65 +++++++++++++++++++++++++++++++++- hydra/nginx/berlin.scm | 2 -- hydra/website.scm | 50 +------------------------- 4 files changed, 68 insertions(+), 54 deletions(-) diff --git a/hydra/bayfront.scm b/hydra/bayfront.scm index 98ac363..30ed485 100644 --- a/hydra/bayfront.scm +++ b/hydra/bayfront.scm @@ -915,8 +915,9 @@ access_log /var/log/nginx/bordeaux.access.log;")) (address (list gnu-ns1-ip4))))))) ;; Runnning hpc.guix.info. - (service static-web-site-service-type - (list guix-hpc-web-site)) + (simple-service 'guix-hpc-web-site + static-web-site-service-type + (list guix-hpc-web-site)) ;; hpcguix-web as it can be seen at ;; . diff --git a/hydra/modules/sysadmin/web.scm b/hydra/modules/sysadmin/web.scm index ff59a77..f9c7570 100644 --- a/hydra/modules/sysadmin/web.scm +++ b/hydra/modules/sysadmin/web.scm @@ -37,6 +37,7 @@ #:use-module (gnu services shepherd) #:use-module (gnu services web) #:use-module (gnu system shadow) + #:use-module (sysadmin nginx) #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:export (build-program @@ -46,6 +47,7 @@ static-web-site-service-type + guix-web-site-service-type gwl-web-service-type)) (define guix-extensions @@ -219,7 +221,6 @@ that's built with Haunt or similar." (compose concatenate) (extend append) (extensions - ;; TODO: Extend nginx directly from here? (list (service-extension mcron-service-type static-web-site-mcron-jobs) (service-extension account-service-type @@ -231,6 +232,68 @@ that's built with Haunt or similar." taken from a Git repository.") (default-value '()))) + +;;; +;;; GNU Guix web site at guix.gnu.org. +;;; + +(define guix-static-web-sites + ;; TODO: Add the manual of Cuirass. + (list (static-web-site-configuration + (git-url + "https://git.savannah.gnu.org/git/guix/guix-artwork.git") + (directory "/srv/guix.gnu.org") + (build-file "website/.guix.scm")) + + ;; Manual for the latest stable release. + (static-web-site-configuration + (git-url "https://git.savannah.gnu.org/git/guix.git") + (git-ref '(branch . "version-1.3.0")) + (period (* 24 3600)) ;check once per day + (directory "/srv/guix-manual") + (build-file "doc/build.scm") + (environment-variables '(("GUIX_MANUAL_VERSION" . "1.3.0") + ("GUIX_WEB_SITE_URL" . "/")))) + + ;; Manual for 'master'. + (static-web-site-configuration + (git-url "https://git.savannah.gnu.org/git/guix.git") + (directory "/srv/guix-manual-devel") + + ;; XXX: Use a different cache directory to work around the fact that + ;; (guix git) would use a same-named checkout directory for 'master' + ;; and for the branch above. Since both mcron jobs run at the same + ;; time, they would end up using one branch or the other, in a + ;; non-deterministic way. + (cache-directory "guix-master-manual") + + (build-file "doc/build.scm") + (environment-variables '(("GUIX_WEB_SITE_URL" . "/")))) + + ;; Cookbook for 'master'. + (static-web-site-configuration + (git-url "https://git.savannah.gnu.org/git/guix.git") + (directory "/srv/guix-cookbook") + + ;; XXX: Use a different cache directory (see above). + (cache-directory "guix-cookbook-master") + + (build-file "doc/build.scm") + (environment-variables '(("GUIX_MANUAL" . "guix-cookbook") + ("GUIX_WEB_SITE_URL" . "/")))))) + +(define guix-web-site-service-type + (service-type + (name 'guix-web-site) + (extensions + (list (service-extension static-web-site-service-type + (const guix-static-web-sites)) + (service-extension nginx-service-type + (const (list guix.gnu.org-nginx-server))))) + (description + "This service provides the web site of the GNU Guix project.") + (default-value #t))) + ;;; ;;; Guix Worflow Language. diff --git a/hydra/nginx/berlin.scm b/hydra/nginx/berlin.scm index 5cf3681..ecdbb13 100644 --- a/hydra/nginx/berlin.scm +++ b/hydra/nginx/berlin.scm @@ -295,8 +295,6 @@ PUBLISH-URL." (list "gzip_static always; gunzip on;\n" "access_log /var/log/nginx/disarchive.access.log;"))) - guix.gnu.org-nginx-server - (nginx-server-configuration (listen '("443 ssl")) (server-name '("issues.guix.gnu.org")) diff --git a/hydra/website.scm b/hydra/website.scm index 9979384..429f875 100644 --- a/hydra/website.scm +++ b/hydra/website.scm @@ -2,55 +2,7 @@ "Return the list of Guix website services." (list ;; Runnning guix.gnu.org. - (service static-web-site-service-type - (list (static-web-site-configuration - (git-url - "https://git.savannah.gnu.org/git/guix/guix-artwork.git") - (directory "/srv/guix.gnu.org") - (build-file "website/.guix.scm")) - - ;; Manual for the latest stable release. - (static-web-site-configuration - (git-url "https://git.savannah.gnu.org/git/guix.git") - (git-ref '(branch . "version-1.3.0")) - (period (* 24 3600)) ;check once per day - (directory "/srv/guix-manual") - (build-file "doc/build.scm") - (environment-variables - '(("GUIX_MANUAL_VERSION" . "1.3.0") - ("GUIX_WEB_SITE_URL" . "/")))) - - ;; Manual for 'master'. - (static-web-site-configuration - (git-url "https://git.savannah.gnu.org/git/guix.git") - (directory "/srv/guix-manual-devel") - - ;; XXX: Use a different cache directory to work around - ;; the fact that (guix git) would use a same-named - ;; checkout directory for 'master' and for the branch - ;; above. Since both mcron jobs run at the same time, - ;; they would end up using one branch or the other, in - ;; a non-deterministic way. - (cache-directory "guix-master-manual") - - (build-file "doc/build.scm") - (environment-variables - '(("GUIX_WEB_SITE_URL" . "/")))) - - ;; Cookbook for 'master'. - (static-web-site-configuration - (git-url "https://git.savannah.gnu.org/git/guix.git") - (directory "/srv/guix-cookbook") - - ;; XXX: Use a different cache directory (see above). - (cache-directory "guix-cookbook-master") - - (build-file "doc/build.scm") - (environment-variables - '(("GUIX_MANUAL" . "guix-cookbook") - ("GUIX_WEB_SITE_URL" . "/")))))) - - ;; TODO: Add the manuals of Cuirass and GWL. + (service guix-web-site-service-type) ;; The bootstrappable.org web site. (service static-web-site-service-type