From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNaMP-0004ei-LZ for guix-patches@gnu.org; Tue, 29 May 2018 04:52:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNaMM-0001mH-IV for guix-patches@gnu.org; Tue, 29 May 2018 04:52:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45227) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNaMM-0001m1-DQ for guix-patches@gnu.org; Tue, 29 May 2018 04:52:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fNaMM-0000qR-2y for guix-patches@gnu.org; Tue, 29 May 2018 04:52:02 -0400 Subject: [bug#31621] [PATCH 2/3] gnu: service: Add hpcguix-web. Resent-Message-ID: Date: Tue, 29 May 2018 08:52:19 +0000 From: Nils Gillmann Message-ID: <20180529085219.3eqr2xljbjtm7d7x@abyayala> References: <20180528132450.12442-1-pierre-antoine.rouby@inria.fr> <20180528132800.12488-1-pierre-antoine.rouby@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180528132800.12488-1-pierre-antoine.rouby@inria.fr> 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: 31621@debbugs.gnu.org Hi Rouby, thanks for your patch series. The service of it seems not to be documented. Could you write a little documentation for it so people will know how to use it? That's so far the first and only review I have time for right now. Rouby Pierre-Antoine transcribed 4.0K bytes: > * gnu/service/web.scm (): New record-type. > --- > 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 > ;;; Copyright © 2017 nee > ;;; Copyright © 2017 Clément Lassieur > +;;; Copyright © 2018 Pierre-Antoine Rouby > ;;; > ;;; 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 > + 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 > > > >