From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOf4b-00074v-Dd for guix-patches@gnu.org; Fri, 01 Jun 2018 04:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOf4U-0004nK-U6 for guix-patches@gnu.org; Fri, 01 Jun 2018 04:06:09 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48871) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOf4U-0004n9-Pz for guix-patches@gnu.org; Fri, 01 Jun 2018 04:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fOf4U-00057O-IN for guix-patches@gnu.org; Fri, 01 Jun 2018 04:06:02 -0400 Subject: bug#31621: [PATCH 2/3] gnu: service: Add hpcguix-web. In-Reply-To: <20180528132450.12442-1-pierre-antoine.rouby@inria.fr> Resent-To: guix-patches@gnu.org Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180529085219.3eqr2xljbjtm7d7x@abyayala> <20180530094704.14910-1-pierre-antoine.rouby@inria.fr> Date: Fri, 01 Jun 2018 10:05:23 +0200 Message-ID: <871sdrc4os.fsf@inria.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Rouby Pierre-Antoine Cc: ng0@n0.is, 31621-done@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, (+Cc: Roel.) Rouby Pierre-Antoine skribis: > * gnu/service/web.scm (): New record-type. > (%hpcguix-web-accounts): New variable. > (%hpcguix-web-activation,hpcguix-web-shepherd-service, > hpcguix-web-service-type): New procedures. > * doc/guix.texi (Web Services): Add 'hpcguix-web'. I found the test ;-), sorry for the confusion. I squashed the test with the other commit (because they logically belong to the same change), and I applied it with the changes below. Thank you! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/guix.texi b/doc/guix.texi index 9b9ce0f77..3b5078741 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16163,30 +16163,32 @@ A simple setup for cat-avatar-generator can look like this: @subsubheading Hpcguix-web @cindex hpcguix-web -The @code{hpcguix-web} is web interface to @code{Guix} packages visualizations. +The @uref{hpcguix-web, https://github.com/UMCUGenetics/hpcguix-web/} +program is a customizable web interface to browse Guix packages, +initially designed for users of high-performance computing (HPC) +clusters. @defvr {Scheme Variable} hpcguix-web-service-type -A service type for @code{hpcguix-web}. +The service type for @code{hpcguix-web}. @end defvr @deftp {Data Type} hpcguix-web-configuration -Data Type for @code{hpcguix-web} service configuration. +Data type for the hpcguix-web service configuration. @table @asis @item @code{specs} -The @code{hpcguix-web} @code{gexp} service -@url{https://github.com/UMCUGenetics/hpcguix-web/blob/master/hpcweb-configuration.scm, -configuration} +A gexp (@pxref{G-Expressions}) specifying the hpcguix-web service +configuration. The main items available in this spec are: @table @asis @item @code{title-prefix} (default: @code{"hpcguix | "}) The page title prefix. @item @code{guix-command} (default: @code{"guix"}) -The @code{Guix} command. +The @command{guix} command. @item @code{package-filter-proc} (default: @code{(const #t)}) -Package filter. +A procedure specifying how to filter packages that are displayed. @item @code{package-page-extension-proc} (default: @code{(const '())}) Extension package for @code{hpcguix-web}. @@ -16194,17 +16196,26 @@ Extension package for @code{hpcguix-web}. @item @code{menu} (default: @code{'()}) Additional entry in page @code{menu}. @end table + +See the hpcguix-web repository for a +@uref{https://github.com/UMCUGenetics/hpcguix-web/blob/master/hpcweb-configuration.scm, +complete example}. + +@item @code{package} (default: @code{hpcguix-web}) +The hpcguix-web package to use. @end table @end deftp +A typical hpcguix-web service declaration looks like this: + @example -(services (cons* (service hpcguix-web-service-type - (hpcguix-web-configuration - (specs - #~(define site-config - (hpcweb-configuration - (title-prefix "Guix-HPC - ") - (menu '(("/about" "ABOUT")))))))) +(service hpcguix-web-service-type + (hpcguix-web-configuration + (specs + #~(define site-config + (hpcweb-configuration + (title-prefix "Guix-HPC - ") + (menu '(("/about" "ABOUT")))))))) @end example @node Certificate Services diff --git a/gnu/services/web.scm b/gnu/services/web.scm index d8acc9549..aae2f3db0 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -902,13 +902,15 @@ a webserver.") (root #~(string-append #$package "/share/web/cat-avatar-generator")))))) + (define-record-type* - hpcguix-web-configuration - make-hpcguix-web-configuration + hpcguix-web-configuration make-hpcguix-web-configuration hpcguix-web-configuration? + (package hpcguix-web-package (default hpcguix-web)) ; + ;; Specs is gexp of hpcguix-web configuration file - (specs hpcguix-web-configuration-specs)) + (specs hpcguix-web-configuration-specs)) (define %hpcguix-web-accounts (list (user-group @@ -922,7 +924,7 @@ a webserver.") (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) -(define (%hpcguix-web-activation config) +(define %hpcguix-web-activation #~(begin (use-modules (guix build utils)) (let ((home-dir "/var/cache/guix/web") @@ -932,7 +934,8 @@ a webserver.") (chmod home-dir #o755)))) (define (hpcguix-web-shepherd-service config) - (let* ((specs (hpcguix-web-configuration-specs config))) + (let ((specs (hpcguix-web-configuration-specs config)) + (hpcguix-web (hpcguix-web-package config))) (with-imported-modules (source-module-closure '((gnu build shepherd))) (shepherd-service @@ -940,25 +943,23 @@ a webserver.") (provision '(hpcguix-web)) (requirement '(networking)) (start #~(make-forkexec-constructor - (list (string-append #$hpcguix-web "/bin/run") + (list #$(file-append hpcguix-web "/bin/run") (string-append "--config=" #$(scheme-file "hpcguix-web.scm" specs))) #:user "hpcguix-web" #:group "hpcguix-web" #:environment-variables - (list (string-append "XDG_CACHE_HOME=" - "/var/cache")))) + (list "XDG_CACHE_HOME=/var/cache"))) (stop #~(make-kill-destructor)))))) (define hpcguix-web-service-type (service-type (name 'hpcguix-web) - (description - "Run hpcguix-web daemon @command{run}.") + (description "Run the hpcguix-web server.") (extensions (list (service-extension account-service-type (const %hpcguix-web-accounts)) (service-extension activation-service-type - %hpcguix-web-activation) + (const %hpcguix-web-activation)) (service-extension shepherd-root-service-type (compose list hpcguix-web-shepherd-service)))))) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 474a5bdb5..a6bf6efcf 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -286,7 +286,7 @@ HTTP-PORT, along with php-fpm." ;;; -;;; HPCGUIX-WEB +;;; hpcguix-web ;;; (define* (run-hpcguix-web-server-test name test-os) @@ -329,15 +329,14 @@ HTTP-PORT, along with php-fpm." (match (assq-ref response-parts 'running) ((pid) (number? pid)))))) marionette)) - + (test-equal "http-get" 200 - (let-values - (((response text) - (begin - (sleep 3) ; HACK wait service available - (http-get "http://localhost:8080")))) - (response-code response))) + (begin + (wait-for-tcp-port 5000 marionette) + (let-values (((response text) + (http-get "http://localhost:8080"))) + (response-code response)))) (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) @@ -360,5 +359,5 @@ HTTP-PORT, along with php-fpm." (define %test-hpcguix-web (system-test (name "hpcguix-web") - (description "Connect to a running HPCGUIX-WEB server.") + (description "Connect to a running hpcguix-web server.") (value (run-hpcguix-web-server-test name %hpcguix-web-os)))) --=-=-=--