[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#31621] [PATCH 2/3] gnu: service: Add hpcguix-web.
From: |
Rouby Pierre-Antoine |
Subject: |
[bug#31621] [PATCH 2/3] gnu: service: Add hpcguix-web. |
Date: |
Wed, 30 May 2018 11:47:04 +0200 |
* 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 address@hidden
Copyright @copyright{} 2017 address@hidden
Copyright @copyright{} 2018 Rutger address@hidden
Copyright @copyright{} 2018 Oleg address@hidden
-Copyright @copyright{} 2018 Mike Gerwitz
+Copyright @copyright{} 2018 Mike address@hidden
+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
address@hidden Hpcguix-web
+
address@hidden hpcguix-web
+The @code{hpcguix-web} is web interface to @code{Guix} packages visualizations.
+
address@hidden {Scheme Variable} hpcguix-web-service-type
+A service type for @code{hpcguix-web}.
address@hidden defvr
+
address@hidden {Data Type} hpcguix-web-configuration
+Data Type for @code{hpcguix-web} service configuration.
+
address@hidden @asis
address@hidden @code{specs}
+The @code{hpcguix-web} @code{gexp} service
address@hidden://github.com/UMCUGenetics/hpcguix-web/blob/master/hpcweb-configuration.scm,
+configuration}
+
address@hidden @asis
address@hidden @code{title-prefix} (default: @code{"hpcguix | "})
+The page title prefix.
+
address@hidden @code{guix-command} (default: @code{"guix"})
+The @code{Guix} command.
+
address@hidden @code{package-filter-proc} (default: @code{(const #t)})
+Package filter.
+
address@hidden @code{package-page-extension-proc} (default: @code{(const '())})
+Extension package for @code{hpcguix-web}.
+
address@hidden @code{menu} (default: @code{'()})
+Additional entry in page @code{menu}.
address@hidden table
address@hidden table
address@hidden deftp
+
address@hidden
+(services (cons* (service hpcguix-web-service-type
+ (hpcguix-web-configuration
+ (specs
+ #~(define site-config
+ (hpcweb-configuration
+ (title-prefix "Guix-HPC - ")
+ (menu '(("/about" "ABOUT"))))))))
address@hidden 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 <address@hidden>
;;; Copyright © 2017 nee <address@hidden>
;;; Copyright © 2017 Clément Lassieur <address@hidden>
+;;; Copyright © 2018 Pierre-Antoine Rouby <address@hidden>
;;;
;;; 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