From: Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr>
To: 31621@debbugs.gnu.org
Cc: Rouby Pierre-Antoine <pierre-antoine.rouby@inria.fr>
Subject: [bug#31621] [PATCH 2/3] gnu: service: Add hpcguix-web.
Date: Tue, 29 May 2018 10:31:43 +0200 [thread overview]
Message-ID: <20180529083143.3654-1-pierre-antoine.rouby@inria.fr> (raw)
In-Reply-To: <20180528132800.12488-1-pierre-antoine.rouby@inria.fr>
* 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.
---
gnu/services/web.scm | 71 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 1 deletion(-)
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-29 8:32 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 [this message]
2018-05-29 8:52 ` Nils Gillmann
2018-05-30 7:25 ` Pierre-Antoine Rouby
2018-05-30 9:47 ` Rouby Pierre-Antoine
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180529083143.3654-1-pierre-antoine.rouby@inria.fr \
--to=pierre-antoine.rouby@inria.fr \
--cc=31621@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.