summaryrefslogtreecommitdiff
path: root/gnu/services/web.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@igalia.com>2017-04-27 10:08:36 +0200
committerLudovic Courtès <ludo@gnu.org>2017-07-26 11:00:04 +0200
commita5130d10fa39fa9a05edfe6934b2c88a33ec906f (patch)
tree82d929b9bbc6d03d123fef7968bf0faeb6d5ac23 /gnu/services/web.scm
parent1cae188e61bb1e8a896bee2ac9bbe066f2f6e92d (diff)
downloadpatches-a5130d10fa39fa9a05edfe6934b2c88a33ec906f.tar
patches-a5130d10fa39fa9a05edfe6934b2c88a33ec906f.tar.gz
gnu: Add fcgiwrap service.
* doc/guix.texi (Web Services): Add documentation. * gnu/services/web.scm (<fcgiwrap-configuration>): New record type. (fcgiwrap-accounts, fcgiwrap-shepherd-service): New service extensions. (fcgiwrap-service-type): New service type. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services/web.scm')
-rw-r--r--gnu/services/web.scm58
1 files changed, 57 insertions, 1 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index f85b412159..c605d76866 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -41,7 +41,11 @@
nginx-named-location-configuration
nginx-named-location-configuration?
nginx-service
- nginx-service-type))
+ nginx-service-type
+
+ fcgiwrap-configuration
+ fcgiwrap-configuration?
+ fcgiwrap-service-type))
;;; Commentary:
;;;
@@ -305,3 +309,55 @@ files in LOG-DIRECTORY, and stores temporary runtime files in RUN-DIRECTORY."
(server-blocks server-list)
(upstream-blocks upstream-list)
(file config-file))))
+
+(define-record-type* <fcgiwrap-configuration> fcgiwrap-configuration
+ make-fcgiwrap-configuration
+ fcgiwrap-configuration?
+ (package fcgiwrap-configuration-package ;<package>
+ (default fcgiwrap))
+ (socket fcgiwrap-configuration-socket
+ (default "tcp:127.0.0.1:9000"))
+ (user fcgiwrap-configuration-user
+ (default "fcgiwrap"))
+ (group fcgiwrap-configuration-group
+ (default "fcgiwrap")))
+
+(define fcgiwrap-accounts
+ (match-lambda
+ (($ <fcgiwrap-configuration> package socket user group)
+ (filter identity
+ (list
+ (and (equal? group "fcgiwrap")
+ (user-group
+ (name "fcgiwrap")
+ (system? #t)))
+ (and (equal? user "fcgiwrap")
+ (user-account
+ (name "fcgiwrap")
+ (group group)
+ (system? #t)
+ (comment "Fcgiwrap Daemon")
+ (home-directory "/var/empty")
+ (shell (file-append shadow "/sbin/nologin")))))))))
+
+(define fcgiwrap-shepherd-service
+ (match-lambda
+ (($ <fcgiwrap-configuration> package socket user group)
+ (list (shepherd-service
+ (provision '(fcgiwrap))
+ (documentation "Run the fcgiwrap daemon.")
+ (requirement '(networking))
+ (start #~(make-forkexec-constructor
+ '(#$(file-append package "/sbin/fcgiwrap")
+ "-s" #$socket)
+ #:user #$user #:group #$group))
+ (stop #~(make-kill-destructor)))))))
+
+(define fcgiwrap-service-type
+ (service-type (name 'fcgiwrap)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ fcgiwrap-shepherd-service)
+ (service-extension account-service-type
+ fcgiwrap-accounts)))
+ (default-value (fcgiwrap-configuration))))