From: Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr>
To: ng0@n0.is
Cc: 31621@debbugs.gnu.org,
Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr>
Subject: [bug#31621] [PATCH 2/3] gnu: service: Add hpcguix-web.
Date: Wed, 30 May 2018 11:47:04 +0200 [thread overview]
Message-ID: <20180530094704.14910-1-pierre-antoine.rouby@inria.fr> (raw)
In-Reply-To: <20180529085219.3eqr2xljbjtm7d7x@abyayala>
* gnu/service/web.scm (<hpcguix-web-configuration>): 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'.
---
doc/guix.texi | 50 ++++++++++++++++++++++++++++++-
gnu/services/web.scm | 71 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 119 insertions(+), 2 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5129b998b..6c91dd5a7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47,7 +47,8 @@ Copyright @copyright{} 2017, 2018 Arun Isaac@*
Copyright @copyright{} 2017 nee@*
Copyright @copyright{} 2018 Rutger Helling@*
Copyright @copyright{} 2018 Oleg Pykhalov@*
-Copyright @copyright{} 2018 Mike Gerwitz
+Copyright @copyright{} 2018 Mike Gerwitz@*
+Copyright @copyright{} 2018 Pierre-Antoine Rouby
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -16135,6 +16136,53 @@ A simple setup for cat-avatar-generator can look like this:
%base-services))
@end example
+@subsubheading Hpcguix-web
+
+@cindex hpcguix-web
+The @code{hpcguix-web} is web interface to @code{Guix} packages visualizations.
+
+@defvr {Scheme Variable} hpcguix-web-service-type
+A service type for @code{hpcguix-web}.
+@end defvr
+
+@deftp {Data Type} hpcguix-web-configuration
+Data Type for @code{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}
+
+@table @asis
+@item @code{title-prefix} (default: @code{"hpcguix | "})
+The page title prefix.
+
+@item @code{guix-command} (default: @code{"guix"})
+The @code{Guix} command.
+
+@item @code{package-filter-proc} (default: @code{(const #t)})
+Package filter.
+
+@item @code{package-page-extension-proc} (default: @code{(const '())})
+Extension package for @code{hpcguix-web}.
+
+@item @code{menu} (default: @code{'()})
+Additional entry in page @code{menu}.
+@end table
+@end table
+@end deftp
+
+@example
+(services (cons* (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
@subsubsection Certificate Services
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index b336a8dd3..d8acc9549 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2017 nee <nee-git@hidamari.blue>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,11 +26,14 @@
(define-module (gnu services web)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
+ #:use-module (gnu system pam)
#:use-module (gnu system shadow)
#:use-module (gnu packages admin)
#:use-module (gnu packages web)
#:use-module (gnu packages php)
+ #:use-module (gnu packages guile)
#:use-module (guix records)
+ #:use-module (guix modules)
#:use-module (guix gexp)
#:use-module ((guix utils) #:select (version-major))
#:use-module ((guix packages) #:select (package-version))
@@ -155,7 +159,11 @@
php-fpm-service-type
nginx-php-location
- cat-avatar-generator-service))
+ cat-avatar-generator-service
+
+ hpcguix-web-configuration
+ hpcguix-web-configuration?
+ hpcguix-web-service-type))
;;; Commentary:
;;;
@@ -893,3 +901,64 @@ a webserver.")
(nginx-server-configuration-locations configuration)))
(root #~(string-append #$package
"/share/web/cat-avatar-generator"))))))
+
+(define-record-type* <hpcguix-web-configuration>
+ hpcguix-web-configuration
+ make-hpcguix-web-configuration
+ hpcguix-web-configuration?
+
+ ;; Specs is gexp of hpcguix-web configuration file
+ (specs hpcguix-web-configuration-specs))
+
+(define %hpcguix-web-accounts
+ (list (user-group
+ (name "hpcguix-web")
+ (system? #t))
+ (user-account
+ (name "hpcguix-web")
+ (group "hpcguix-web")
+ (system? #t)
+ (comment "hpcguix-web")
+ (home-directory "/var/empty")
+ (shell (file-append shadow "/sbin/nologin")))))
+
+(define (%hpcguix-web-activation config)
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((home-dir "/var/cache/guix/web")
+ (user (getpwnam "hpcguix-web")))
+ (mkdir-p home-dir)
+ (chown home-dir (passwd:uid user) (passwd:gid user))
+ (chmod home-dir #o755))))
+
+(define (hpcguix-web-shepherd-service config)
+ (let* ((specs (hpcguix-web-configuration-specs config)))
+ (with-imported-modules (source-module-closure
+ '((gnu build shepherd)))
+ (shepherd-service
+ (documentation "hpcguix-web daemon")
+ (provision '(hpcguix-web))
+ (requirement '(networking))
+ (start #~(make-forkexec-constructor
+ (list (string-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"))))
+ (stop #~(make-kill-destructor))))))
+
+(define hpcguix-web-service-type
+ (service-type
+ (name 'hpcguix-web)
+ (description
+ "Run hpcguix-web daemon @command{run}.")
+ (extensions
+ (list (service-extension account-service-type
+ (const %hpcguix-web-accounts))
+ (service-extension activation-service-type
+ %hpcguix-web-activation)
+ (service-extension shepherd-root-service-type
+ (compose list hpcguix-web-shepherd-service))))))
--
2.17.0
next prev parent reply other threads:[~2018-05-30 9:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-28 13:24 [bug#31621] [PATCH 1/3] gnu: Add hpcguix-web Rouby Pierre-Antoine
2018-05-28 13:28 ` [bug#31621] [PATCH 2/3] gnu: service: " Rouby Pierre-Antoine
2018-05-29 8:31 ` Rouby Pierre-Antoine
2018-05-29 8:52 ` Nils Gillmann
2018-05-30 7:25 ` Pierre-Antoine Rouby
2018-05-30 9:47 ` Rouby Pierre-Antoine [this message]
2018-05-31 16:12 ` Ludovic Courtès
2018-05-28 13:28 ` [bug#31621] [PATCH 3/3] gnu: tests: " Rouby Pierre-Antoine
2018-05-29 8:57 ` [bug#31621] [PATCH 1/3] gnu: " Nils Gillmann
2018-05-30 9:41 ` Rouby Pierre-Antoine
2018-05-31 16:09 ` Ludovic Courtès
2018-05-31 22:38 ` Roel Janssen
2018-06-01 8:05 ` bug#31621: [PATCH 2/3] gnu: service: " Ludovic Courtès
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=20180530094704.14910-1-pierre-antoine.rouby@inria.fr \
--to=pierre-antoine.rouby@inria.fr \
--cc=31621@debbugs.gnu.org \
--cc=ng0@n0.is \
/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).