From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 19 09:28:19 2018 Received: (at submit) by debbugs.gnu.org; 19 Sep 2018 13:28:20 +0000 Received: from localhost ([127.0.0.1]:45255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2cWh-0000sS-PS for submit@debbugs.gnu.org; Wed, 19 Sep 2018 09:28:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47599) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2cWg-0000sD-Pb for submit@debbugs.gnu.org; Wed, 19 Sep 2018 09:28:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2cWZ-0006mn-LM for submit@debbugs.gnu.org; Wed, 19 Sep 2018 09:28:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42568) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2cWZ-0006mY-G6 for submit@debbugs.gnu.org; Wed, 19 Sep 2018 09:28:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2cWY-0005oF-Ks for guix-patches@gnu.org; Wed, 19 Sep 2018 09:28:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2cWV-0006hx-Cv for guix-patches@gnu.org; Wed, 19 Sep 2018 09:28:10 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:59841) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2cWV-0006g7-5x for guix-patches@gnu.org; Wed, 19 Sep 2018 09:28:07 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id AE99621FAD for ; Wed, 19 Sep 2018 09:28:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 19 Sep 2018 09:28:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:date:from:message-id:mime-version :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=MctPc3 J2B1odmxEfrHo9kDQipnVpqzri97pUG43QtOI=; b=r+cJZ/4fnyI3n3yPCVsR8S 7EAmxP4RyYhI7VkjUPN6Me2fsZz+UW2n9FbhAHI4KFc4IcxgJ/fblkiuZjLgjBue n5uHP7ZR2ZQ6MntSQfhw70N0NY8rnK0egNN7n4jFrorACgAlpmF2YRN6J1e3ve4W NytBlNadALV8uF8CSRqzFTPrN+PRqQtTF5Q9zin9MMULPKb4WV6NE5LErjEld4xj Mn80OQLueC8TiwjXs9W0c46RdmoNotcIvJ69s3YX9R+9V2wUwVEDffExBdyxR57K 9QWSACi5LEN3+16yIX/Iv6rkBEuYhUnwgNyh3FhX3JIzXS2ro7986BqVIqlMcWKw == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=MctPc3J2B1odmxEfrHo9kDQipnVpqzri97pUG43Qt OI=; b=YDnDxr0d2T2aMByS1SFmRoOfi8TYdxQtHjjnTNyK2EFqQBKWSCiKa/6kq zAt0d794Ln97w8Pgd2vbCGAvIo8N1CXj9BfVGUfFzey8J/85EOwmX/Y97Z9qZEKR VNt1t5MThXPMfJidqoGjIy7wOtGJ5up2xXtV1BRWJWWk22tSb5pi3os4tdk/RHBa F93+WNMD410q6w68CAIzTBQ8wCCM3fuPZFSWv/8N3JTYyZbWkc5eEDzCWgO6aGqt d1hz2//i8iEvhE/4bz+EkVnjkNrT2nShJ4OQNqwP8UlvM2HtyoSZRI9Xwhfafotf JAw9qUrCmMRviluVnfY+t0EXasELw== X-ME-Proxy: X-ME-Sender: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id E956D102DE for ; Wed, 19 Sep 2018 09:28:04 -0400 (EDT) From: Marius Bakke To: guix-patches@gnu.org Subject: [PATCH 0/2] Varnish service Date: Wed, 19 Sep 2018 15:28:03 +0200 Message-Id: <20180919132803.12511-1-mbakke@fastmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) These patches adds a service for the Varnish HTTP proxy. Marius Bakke (2): gnu: varnish: Use absolute file name of "rm". services: Add Varnish service. doc/guix.texi | 82 +++++++++++++++++++++++++++++++++ gnu/packages/web.scm | 4 +- gnu/services/web.scm | 107 ++++++++++++++++++++++++++++++++++++++++++- gnu/tests/web.scm | 41 +++++++++++++++++ 4 files changed, 232 insertions(+), 2 deletions(-) -- 2.19.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 19 09:30:33 2018 Received: (at 32771) by debbugs.gnu.org; 19 Sep 2018 13:30:33 +0000 Received: from localhost ([127.0.0.1]:45266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2cYp-0000ya-59 for submit@debbugs.gnu.org; Wed, 19 Sep 2018 09:30:33 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2cYn-0000yO-AX for 32771@debbugs.gnu.org; Wed, 19 Sep 2018 09:30:29 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id EF97C21AAD for <32771@debbugs.gnu.org>; Wed, 19 Sep 2018 09:30:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 19 Sep 2018 09:30:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:date:from:message-id:mime-version :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=DmvVOu JevN/RvnrQ8NzpvA+NNP+1duEzK21UqMfgnkE=; b=RJpSRUYJfc8v5HuWycxxCR gsTqU8hiXAjpBzQutww94BWAyKlV9ppdS+wE7YNSRj0zuYjc6xo0LIPy+5BC3oAj o/DyLgpW8zOCFrqnseAvpuYTjRw515DUXyLN/uBsnkW3wcAFA6pACfYoS89hw7Na ER90NSXD2lGHSw4GoGsIjd425chk588an3Gmy9XXjpsdniOP0T1B/AmlPWCxcvBj AcoMphr3PEqHiABcajWfXf2HFKffAuLgUk72mrATUsr7CAa1C0LFbWC2oxrjemZw 52LNJjFLwrsQzoTXvpYMpJI8/F+kIYIPPGU5DDjzpnkBvcfQA72u2ds41UrTnoqw == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=DmvVOuJevN/RvnrQ8NzpvA+NNP+1duEzK21UqMfgn kE=; b=FaEw3vvqqgVf06uFuE/avCiReMRnxySfu8ggthxUrMddG5xbZ6lTvtsZ8 yo9th3JqlbO54ZFU8vhCu4iENz8I6dG7J8VwWIsQw7qVhPZEkHAknOTFK4+kkRS0 Pg8BZwJifoeXLF7F4HjsB2v6VVKAGWzi2ne32cmPFvuUPXBAiPDMtYtagWabYCcC f9otLIRuT1SWr8f+x110MH/EBTVyRSpU4N7sMY3X8ulFWmXhH3ufLyTccHz4ou06 QReoGlWDBbPpgyOk21bx2F5b3Y6tb6d/2g/7UASvOEqoAAdbnbm4Ki4tz4jHgn7T zT7vXg0hI7sClTL3lnuGGPvgNv9hg== X-ME-Proxy: X-ME-Sender: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 6558E102D3 for <32771@debbugs.gnu.org>; Wed, 19 Sep 2018 09:30:28 -0400 (EDT) From: Marius Bakke To: 32771@debbugs.gnu.org Subject: [PATCH 1/2] gnu: varnish: Use absolute file name of "rm". Date: Wed, 19 Sep 2018 15:30:26 +0200 Message-Id: <20180919133027.12799-1-mbakke@fastmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 32771 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/packages/web.scm (varnish)[arguments]: Rename 'patch-bin-sh-phase to 'use-absolute-file-names and add substitution. --- gnu/packages/web.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index b6bee57f9..26c2e9128 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -5019,12 +5019,14 @@ deployments.") "--localstatedir=/var") #:phases (modify-phases %standard-phases - (add-after 'unpack 'patch-/bin/sh + (add-after 'unpack 'use-absolute-file-names (lambda _ (substitute* '("bin/varnishtest/vtc_varnish.c" "bin/varnishtest/vtc_process.c" "bin/varnishd/mgt/mgt_vcc.c") (("/bin/sh") (which "sh"))) + (substitute* "bin/varnishd/mgt/mgt_shmem.c" + (("rm -rf") (string-append (which "rm") " -rf"))) #t)) (add-before 'install 'patch-Makefile (lambda _ -- 2.19.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 19 09:30:39 2018 Received: (at 32771) by debbugs.gnu.org; 19 Sep 2018 13:30:39 +0000 Received: from localhost ([127.0.0.1]:45268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2cYs-0000yr-7r for submit@debbugs.gnu.org; Wed, 19 Sep 2018 09:30:39 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42421) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2cYo-0000yZ-Qk for 32771@debbugs.gnu.org; Wed, 19 Sep 2018 09:30:31 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B740F21AAD for <32771@debbugs.gnu.org>; Wed, 19 Sep 2018 09:30:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 19 Sep 2018 09:30:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=bNOORh3ZyVkeClJeWPFDSC8jt6TVS ehoYjW96uDit+M=; b=D6/5F7r5YRjRa0Rmf9Pl9MwjbO5Egi7U9Pq+Gd0yRnUST NnHsaVEARsmUE1ZcjOeNPXPuNcV9uDzdzFxcLmnvPkdwhzrMkCcfMqjMIll5x1RY Iy3Cl2rkVVU7JeyWvPn4Odb4Hbgtzprm0HCA4JDXsxFR42qHImge0SSmGqC6Gc/w 2uD77cnsBg4LpE0ZdQR8uw7Xsx3sHkL0L3zNCbkTZEX0tu/Z0gngebnYlO4qRKpE HmliVqcC8aDDQjTwnimIr5NkRaB6sqqMW8RN7qI5rcbucrCd1EJjLILP/vuj0Gxt rkJy1bzoT/LQxJfLAR5+BG2mOivimvNXHg7aI/ZiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=bNOORh 3ZyVkeClJeWPFDSC8jt6TVSehoYjW96uDit+M=; b=U8d8iUr2sYCta5xNklhIxu 2XBPBlexsSgVyqLy7UO3YcWDl4tc9tDsh+if0iUK/i+7okqgr7N4hehSRZkMpbJk /Ma6BG+RsgbqfZ46sKT7cuYxF0fZaYyJ8lwVFh35Zss0hedGLJS5Kb/nva9I7Erw gNsgrBk2shcYGS0fPbyH+YCBJibFzGu8xCPimT4czZ01Fc1+Uk1WmhCfWaqCdWuL NPTglw2T+Ry+cixKEvVq3cEUbykWEL8hMX5iDEkbiM8gH8mSRZl11n7jRnVJ4YWt dP2ntrWehIh+CruOAcgq/YNhFyMZuBVZj5Cop6quXE8Z2MokW1Qq6inUKS9rSYWg == X-ME-Proxy: X-ME-Sender: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 1296C102DD for <32771@debbugs.gnu.org>; Wed, 19 Sep 2018 09:30:29 -0400 (EDT) From: Marius Bakke To: 32771@debbugs.gnu.org Subject: [PATCH 2/2] services: Add Varnish service. Date: Wed, 19 Sep 2018 15:30:27 +0200 Message-Id: <20180919133027.12799-2-mbakke@fastmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180919133027.12799-1-mbakke@fastmail.com> References: <20180919133027.12799-1-mbakke@fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 32771 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/services/web.scm (): New record type. (%varnish-accounts, %varnish-activation, varnish-service-type): New variables. (varnish-shepherd-service): New procedure. * gnu/tests/web.scm (%varnish-vcl, %varnish-os): New variables. (%test-varnish): New test. * doc/guix.texi (Web Services): Document it. --- doc/guix.texi | 82 +++++++++++++++++++++++++++++++++ gnu/services/web.scm | 107 ++++++++++++++++++++++++++++++++++++++++++- gnu/tests/web.scm | 41 +++++++++++++++++ 3 files changed, 229 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 8987b20fa..543b7d4f7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16709,6 +16709,88 @@ body of a named location block cannot contain location blocks. @end table @end deftp +@subsubheading Varnish Cache +@cindex Varnish +Varnish is a fast cache server that sits in between web applications +and end users. It proxies requests from clients and caches the +accessed URLs such that multiple requests for the same resource only +creates one request to the back-end. + +@defvr {Scheme Variable} varnish-service-type +A service type for the Varnish daemon. +@end defvr + +@deftp {Data Type} varnish-configuration +Data type representing the @code{varnish} service configuration. +This type has the following parameters: + +@table @asis +@item @code{package} (default: @code{varnish}) +The Varnish package to use. + +@item @code{name} (default: @code{"default"}) +A name for this Varnish instance. Varnish will create a directory in +@file{/var/varnish/} with this name and keep temporary files there. If +the name starts with a forward slash, it is interpreted as an absolute +directory name. + +Pass the @code{-n} argument to other Varnish programs to connect to the +named instance, e.g. @command{varnishncsa -n default}. + +@item @code{backend} (default: @code{"localhost:8080"}) +The backend to use. This option has no effect if @code{vcl} is set. + +@item @code{vcl} (default: #f) +The @dfn{VCL} (Varnish Configuration Language) program to run. If this +is @code{#f}, Varnish will proxy @code{backend} using the default +configuration. Otherwise this must be a file-like object with valid +VCL syntax. + +@c Varnish does not support HTTPS, so keep this URL to avoid confusion. +For example, to mirror @url{http://www.gnu.org,www.gnu.org} with VCL you +can do something along these lines: + +@example +(define %gnu-mirror + (plain-file + "gnu.vcl" + "vcl 4.1; +backend gnu @{ .host = "www.gnu.org"; @}")) + +(operating-system + ... + (services (cons (service varnish-service-type + (varnish-configuration + (listen '(":80")) + (vcl %gnu-mirror))) + %base-services))) +@end example + +The configuration of an already running Varnish instance can be inspected +and changed using the @command{varnishadm} program. + +Consult the @url{https://varnish-cache.org/docs/,Varnish User Guide} and +@url{https://book.varnish-software.com/4.0/,Varnish Book} for +comprehensive documentation on Varnish and its configuration language. + +@item @code{listen} (default: @code{'("localhost:80")}) +List of addresses Varnish will listen on. + +@item @code{storage} (default: @code{'()}) +List of storage backends that will be available in VCL. The first backend +becomes the default. If left empty, Varnish will choose +@code{'("malloc,unlimited")}. + +@item @code{parameters} (default: @code{'()}) +List of run-time parameters in the form @code{'(("parameter" . "value"))}. + +@item @code{extra-options} (default: @code{'()}) +Additional arguments to pass to the @command{varnishd} process. + +@end table +@end deftp + +@subsubheading FastCGI @cindex fastcgi @cindex fcgiwrap FastCGI is an interface between the front-end and the back-end of a web diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 1c38e7d8d..52358acce 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; Copyright © 2017 Christopher Baines +;;; Copyright © 2018 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -190,7 +191,21 @@ tailon-configuration-config-file tailon-configuration-package - tailon-service-type)) + tailon-service-type + + + varnish-configuration + varnish-configuration? + varnish-configuration-package + varnish-configuration-name + varnish-configuration-backend + varnish-configuration-vcl + varnish-configuration-listen + varnish-configuration-storage + varnish-configuration-parameters + varnish-configuration-extra-options + + varnish-service-type)) ;;; Commentary: ;;; @@ -1162,3 +1177,93 @@ files.") (files (append (tailon-configuration-file-files old-config-file) files)))))))) (default-value (tailon-configuration)))) + + +;;; +;;; Varnish +;;; + +(define-record-type* + varnish-configuration make-varnish-configuration + varnish-configuration? + (package varnish-configuration-package ; + (default varnish)) + (name varnish-configuration-name ;string + (default "default")) + (backend varnish-configuration-backend ;string + (default "localhost:8080")) + (vcl varnish-configuration-vcl ;#f | + (default #f)) + (listen varnish-configuration-listen ;list of strings + (default '("localhost:80"))) + (storage varnish-configuration-storage ;list of strings + (default '())) + (parameters varnish-configuration-parameters ;list of pairs + (default '())) + (extra-options varnish-configuration-extra-options ;list of strings + (default '()))) + +(define %varnish-accounts + (list (user-group + (name "varnish") + (system? #t)) + (user-account + (name "varnish") + (group "varnish") + (system? #t) + (comment "Varnish Cache User") + (home-directory "/var/varnish") + (shell (file-append shadow "/sbin/nologin"))))) + +(define %varnish-activation + #~(begin + (use-modules (guix build utils)) + (let ((home-dir "/var/varnish") + (user (getpwnam "varnish"))) + (mkdir-p home-dir) + (chown home-dir (passwd:uid user) (passwd:gid user)) + (chmod home-dir #o755)))) + +(define varnish-shepherd-service + (match-lambda + (($ package name backend vcl listen storage + parameters extra-options) + (list (shepherd-service + (provision (list (symbol-append 'varnish- (string->symbol name)))) + (documentation (string-append "The Varnish Web Accelerator" + " (" name ")")) + (requirement '(networking)) + (start #~(make-forkexec-constructor + (list #$(file-append package "/sbin/varnishd") + "-n" #$name + #$@(if vcl + #~("-f" #$vcl) + #~("-b" #$backend)) + #$@(append-map (lambda (a) (list "-a" a)) listen) + #$@(append-map (lambda (s) (list "-s" s)) storage) + #$@(append-map (lambda (p) + (list "-p" (format #f "~a=~a" + (car p) (cdr p)))) + parameters) + #$@extra-options) + ;; Varnish will drop privileges to the "varnish" user when + ;; it exists. Not passing #:user here allows the service + ;; to bind to ports < 1024. + #:pid-file (if (string-prefix? "/" #$name) + (string-append #$name "/_.pid") + (string-append "/var/varnish/" #$name "/_.pid")))) + (stop #~(make-kill-destructor))))))) + +(define varnish-service-type + (service-type + (name 'varnish) + (description "Run the Varnish cache server.") + (extensions + (list (service-extension account-service-type + (const %varnish-accounts)) + (service-extension activation-service-type + (const %varnish-activation)) + (service-extension shepherd-root-service-type + varnish-shepherd-service))) + (default-value + (varnish-configuration)))) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 45fcb668f..bcc919137 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -32,6 +32,7 @@ #:use-module (guix store) #:export (%test-httpd %test-nginx + %test-varnish %test-php-fpm %test-hpcguix-web %test-tailon)) @@ -168,6 +169,46 @@ HTTP-PORT." #:log-file "/var/log/nginx/access.log")))) +;;; +;;; Varnish +;;; + +(define %varnish-vcl + (mixed-text-file + "varnish-test.vcl" + "vcl 4.0; +backend dummy { .host = \"127.1.1.1\"; } +sub vcl_recv { return(synth(200, \"OK\")); } +sub vcl_synth { + synthetic(\"" %index.html-contents "\"); + set resp.http.Content-Type = \"text/plain\"; + return(deliver); +}")) + +(define %varnish-os + (simple-operating-system + (dhcp-client-service) + ;; Pretend to be a web server that serves %index.html-contents. + (service varnish-service-type + (varnish-configuration + (name "/tmp/server") + ;; Use a small VSL buffer to fit in the test VM. + (parameters '(("vsl_space" . "4M"))) + (vcl %varnish-vcl))) + ;; Proxy the "server" using the builtin configuration. + (service varnish-service-type + (varnish-configuration + (parameters '(("vsl_space" . "4M"))) + (backend "localhost:80") + (listen '(":8080")))))) + +(define %test-varnish + (system-test + (name "varnish") + (description "Test the Varnish Cache server.") + (value (run-webserver-test "varnish-default" %varnish-os)))) + + ;;; ;;; PHP-FPM ;;; -- 2.19.0 From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 22 13:06:30 2018 Received: (at 32771) by debbugs.gnu.org; 22 Sep 2018 17:06:30 +0000 Received: from localhost ([127.0.0.1]:49814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3lMU-0007MQ-Ba for submit@debbugs.gnu.org; Sat, 22 Sep 2018 13:06:30 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:49072 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3lMS-0007MH-4J for 32771@debbugs.gnu.org; Sat, 22 Sep 2018 13:06:28 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 64FAE165DB; Sat, 22 Sep 2018 18:06:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (127.103.9.51.dyn.plus.net [51.9.103.127]) by mira.cbaines.net (Postfix) with ESMTPSA id 12657165DB; Sat, 22 Sep 2018 18:06:27 +0100 (BST) Received: from phact (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 6d512544; Sat, 22 Sep 2018 17:06:26 +0000 (UTC) References: <20180919132803.12511-1-mbakke@fastmail.com> <20180919133027.12799-1-mbakke@fastmail.com> User-agent: mu4e 1.0; emacs 26.1 From: Christopher Baines To: Marius Bakke Subject: Re: [bug#32771] [PATCH 1/2] gnu: varnish: Use absolute file name of "rm". In-reply-to: <20180919133027.12799-1-mbakke@fastmail.com> Date: Sat, 22 Sep 2018 18:06:20 +0100 Message-ID: <87wordwjg3.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 32771 Cc: 32771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Marius Bakke writes: > * gnu/packages/web.scm (varnish)[arguments]: Rename 'patch-bin-sh-phase to > 'use-absolute-file-names and add substitution. > --- > gnu/packages/web.scm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm > index b6bee57f9..26c2e9128 100644 > --- a/gnu/packages/web.scm > +++ b/gnu/packages/web.scm > @@ -5019,12 +5019,14 @@ deployments.") > "--localstatedir=/var") > #:phases > (modify-phases %standard-phases > - (add-after 'unpack 'patch-/bin/sh > + (add-after 'unpack 'use-absolute-file-names > (lambda _ > (substitute* '("bin/varnishtest/vtc_varnish.c" > "bin/varnishtest/vtc_process.c" > "bin/varnishd/mgt/mgt_vcc.c") > (("/bin/sh") (which "sh"))) > + (substitute* "bin/varnishd/mgt/mgt_shmem.c" > + (("rm -rf") (string-append (which "rm") " -rf"))) > #t)) > (add-before 'install 'patch-Makefile > (lambda _ This applies and varnish builds, so this looks good to me :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlumdoxfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XeNUA//TLku23LFLqn4t7H4+3z1bw0iwvb5oaQYpNYKdRqrFl0GmVZjf1BqvK4E SKvzZWgYtIh81yFlnm9MGfOh/gI0t8YNDFpbpGobgUJJKm59FYrI++pE08oiUY8t zBH3mNUUqcp33d3aCN0KfwaVW9nGSeDi0LM4oz75wcK46vfq/93ufAPTotgLl0D8 lcyTpYSgJtoHr8sV9FmaLTl1UnYVxheR2YFwLdPfbm5EN09PdDTJ0sgahjG3R3I+ cAxFikRYUFgHWOPHTIp9ZdID/W//wYIAfq3uifybs9u2x8WwJ0Nq2R/DhSiV0Yx9 KbcDjloAGELstmPD1b1w7DWIhxEDU1FKyG9PS7pxRM3TQS+P7fbaXeh4tPicjCrZ 8YXHGz2urY8zGjY3mzJUwQEAClwQ3FhKk7NViz+kouTReK5Nlx/vWoUy++GSKeHN ZFMOmENxkWvp0OqNawudm9sqRDYNEN0ZB0Wz28J33c7U4z0JK6szxGWkSRHo6R1n mDWMhA7vfBikCf4JRym3f5+45NAQtkdTvCHOjzlezUtHRgSMFrVtm/lm2mgBIyy/ Z6dua7AoeLC6JtpfucDIBmEfUYKDPWR4FNytVO4MTCZbhLFqNlf2hjiSxAABXHVV rtTA61+iwzrX0F+HqHgfg1mBaJUSvd5kmWteFV6yvaJutZwHGdY= =keJO -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 22 15:53:17 2018 Received: (at 32771) by debbugs.gnu.org; 22 Sep 2018 19:53:17 +0000 Received: from localhost ([127.0.0.1]:49904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3nxt-0002vt-8y for submit@debbugs.gnu.org; Sat, 22 Sep 2018 15:53:17 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:49108 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3nxr-0002vk-Ni for 32771@debbugs.gnu.org; Sat, 22 Sep 2018 15:53:16 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 0F6FE165DF; Sat, 22 Sep 2018 20:53:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (127.103.9.51.dyn.plus.net [51.9.103.127]) by mira.cbaines.net (Postfix) with ESMTPSA id 8F2D2165DD; Sat, 22 Sep 2018 20:53:14 +0100 (BST) Received: from phact (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id bd55d00e; Sat, 22 Sep 2018 19:53:14 +0000 (UTC) References: <20180919133027.12799-1-mbakke@fastmail.com> <20180919133027.12799-2-mbakke@fastmail.com> User-agent: mu4e 1.0; emacs 26.1 From: Christopher Baines To: Marius Bakke Subject: Re: [bug#32771] [PATCH 2/2] services: Add Varnish service. In-reply-to: <20180919133027.12799-2-mbakke@fastmail.com> Date: Sat, 22 Sep 2018 20:53:11 +0100 Message-ID: <87va6xwbq0.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 32771 Cc: 32771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hey Marius, I've not got much experience with Varnish, but this patch applies, and the system test passes :) Marius Bakke writes: > +@subsubheading Varnish Cache > +@cindex Varnish > +Varnish is a fast cache server that sits in between web applications > +and end users. It proxies requests from clients and caches the > +accessed URLs such that multiple requests for the same resource only > +creates one request to the back-end. > + > +@defvr {Scheme Variable} varnish-service-type > +A service type for the Varnish daemon. > +@end defvr Given there are not other service types for Varnish in Guix, "The service type ..." would probably be clearer here, or just "Service type ...". > +@deftp {Data Type} varnish-configuration > +Data type representing the @code{varnish} service configuration. > +This type has the following parameters: > + > +@table @asis > +@item @code{package} (default: @code{varnish}) > +The Varnish package to use. > + > +@item @code{name} (default: @code{"default"}) > +A name for this Varnish instance. Varnish will create a directory in > +@file{/var/varnish/} with this name and keep temporary files there. If > +the name starts with a forward slash, it is interpreted as an absolute > +directory name. Most services in Guix use /var/lib for data, would this work for Varnish? Also, I wonder if you'd considered supporing running multiple instances of varnishd, I guess the "name" might come in useful then. > +@c Varnish does not support HTTPS, so keep this URL to avoid confusion. > +For example, to mirror @url{http://www.gnu.org,www.gnu.org} with VCL you > +can do something along these lines: Does "@c" mean a comment? > +(define %varnish-accounts > + (list (user-group > + (name "varnish") > + (system? #t)) > + (user-account > + (name "varnish") > + (group "varnish") > + (system? #t) > + (comment "Varnish Cache User") > + (home-directory "/var/varnish") > + (shell (file-append shadow "/sbin/nologin"))))) > + > +(define %varnish-activation > + #~(begin > + (use-modules (guix build utils)) > + (let ((home-dir "/var/varnish") > + (user (getpwnam "varnish"))) > + (mkdir-p home-dir) > + (chown home-dir (passwd:uid user) (passwd:gid user)) > + (chmod home-dir #o755)))) Is this necessary, as I think the users home directory might be automatically created? Anyway, this looks pretty much good to me. Thanks, Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlumnadfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XfG6w/+J1m1//2ShTG/uLPKv6f9C7p9M00wFEz/1otwsoZaV8ftRZw5lkEVR5Jr AXnqRQrlGPymsdy4vqnPfa/bQECPLaDUlOUPRRdwaUa710zK03vDNUxJ9KyjneLu QOHfC5WMqAvoTvbmVua1uModX4n/4epdoMVQRhNkzLaH/IeWFJ8qveZMo2LSEr4I 59YNQT2/40OuhKuDkHQSI0ghPiKGOFKr/vnR01/nTjIuQx8JW1cAbnLRa8IzuqYp NS8Pio9hzzq6e3Dvy4pyv4t81REXiUg+uQcncTPFqDS6Hn2fr3UgTE5eaUshP72f FAZCCSoK9l29FaWKHKS9NzfO60Ib4xxSMflDsn9q1IenxAxfmY6qFe01yMTmTJIs vTSEfJQzO9SZpDsqPJ3lXJPCrvBB7XP/r5zeMTHQPuDCMsgnnbGN5H2MB9VuBHYi jjYl6b8fulwKP/Apr4flN1GF7prdM9dJQwHfUaB1UsY901pHhJNPJsfc88wSWhkn N9EvpT5XDDS/fNj5J320k7MXvIY0redLOzjXTh9y5bHP6z19yl0vkGgz+ZNYoDjN 063lsrlX+KjR3FjLmPKue9qDH6S6tYHBIZujPgifukU5ASouvg4/cvM+rUzvgfyY p44SVFKEIgo7gssVSh/ZpzULw3CrZi5ZqX9atuN0KvbS9vp6yKs= =t5w+ -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 25 18:52:56 2018 Received: (at 32771-done) by debbugs.gnu.org; 25 Sep 2018 22:52:56 +0000 Received: from localhost ([127.0.0.1]:54179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4wCO-0007xf-Cl for submit@debbugs.gnu.org; Tue, 25 Sep 2018 18:52:56 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:49781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4wCM-0007xX-00 for 32771-done@debbugs.gnu.org; Tue, 25 Sep 2018 18:52:54 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id CC41121AD0; Tue, 25 Sep 2018 18:52:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 25 Sep 2018 18:52:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=osKH+SiFcUGNkMz7w21hKmKtfvLbXXemBtyPyEY/iHU=; b=qifVUcPu oaezuTwY5XPjDKw4VKNQaFhCmoxoVpSIGfIR3RwmepYhCx/tP7ZqRXv1niIohmFC YU2w02YAW9RnxXtBg+BnI3B3LqM5OZ+O6ZlP+K056TO5Q1UOdLMejEY5dAv+s8FO SUpdInqpYADiUbaI1HolJEWvfqqVLUlk/csJRuWP4BmLBIEJopKpRa5YBJZqLcvv Hsq6kVqsPuDNwv5i1TpotjiFvHvPz8H+XG4YvJVOdEsVxbXwjrDlWDJcZk870+kf 5x1RMMiutqXQbed9IdMHEMNHItFx8Vcw15aCCDiW5LCL7HIF+N4fF4SAD79uTEv+ rdQZf5XJc9JxrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=osKH+SiFcUGNkMz7w21hKmKtfvLbX XemBtyPyEY/iHU=; b=Bfl3dFtq/X7Q29HuiKXSv5jfLfL1spMmhm6Zti2BqfcQm B2LMuKQWIi0kq1orkHUUImHxDy6kVcdtnsN5Xuyi4P8tjJ5R2fQuYzmeotn5FnQ5 zsK8OrSTV1StcA+Id83uL4puCV579zBlaPeMhlSkw+XDsdPQ2ryGBtYRSGKEB5TH a3ZzgAMX3eTTHZhDKWv/j1Ety2l54t6x08/0LJ7kpvOZjeFwsTCggJnEyt7BfzZe 3qoLgeUPQdAj88J8N6DNduJw2SBtL9hMVR0PeznLMr3uo4oeiLEtauLLCjCcDFO6 FxiLFm6WmtRjKG04NtMLQOO8ml5Wg12dpJun7RPMQ== X-ME-Proxy: X-ME-Sender: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 0D77FE44DF; Tue, 25 Sep 2018 18:52:52 -0400 (EDT) From: Marius Bakke To: Christopher Baines Subject: Re: [bug#32771] [PATCH 2/2] services: Add Varnish service. In-Reply-To: <87va6xwbq0.fsf@cbaines.net> References: <20180919133027.12799-1-mbakke@fastmail.com> <20180919133027.12799-2-mbakke@fastmail.com> <87va6xwbq0.fsf@cbaines.net> User-Agent: Notmuch/0.27 (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Wed, 26 Sep 2018 00:52:51 +0200 Message-ID: <87ftxxkx4s.fsf@fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 32771-done Cc: 32771-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Christopher Baines writes: > Hey Marius, > > I've not got much experience with Varnish, but this patch applies, and > the system test passes :) > > Marius Bakke writes: > >> +@subsubheading Varnish Cache >> +@cindex Varnish >> +Varnish is a fast cache server that sits in between web applications >> +and end users. It proxies requests from clients and caches the >> +accessed URLs such that multiple requests for the same resource only >> +creates one request to the back-end. >> + >> +@defvr {Scheme Variable} varnish-service-type >> +A service type for the Varnish daemon. >> +@end defvr > > Given there are not other service types for Varnish in Guix, "The > service type ..." would probably be clearer here, or just "Service type > ...". Just "Service type ..." is better, thanks! >> +@deftp {Data Type} varnish-configuration >> +Data type representing the @code{varnish} service configuration. >> +This type has the following parameters: >> + >> +@table @asis >> +@item @code{package} (default: @code{varnish}) >> +The Varnish package to use. >> + >> +@item @code{name} (default: @code{"default"}) >> +A name for this Varnish instance. Varnish will create a directory in >> +@file{/var/varnish/} with this name and keep temporary files there. If >> +the name starts with a forward slash, it is interpreted as an absolute >> +directory name. > > Most services in Guix use /var/lib for data, would this work for > Varnish? Probably, although I didn't bother trying it. Those files are temporary anyway, perhaps /var/cache/varnish would be better? But, I think the upstream default is OK. > Also, I wonder if you'd considered supporing running multiple instances > of varnishd, I guess the "name" might come in useful then. If you read the system test closely, you'll notice it does actually run multiple instances, one proxying the other, and testing different aspects of the service definition :-) >> +@c Varnish does not support HTTPS, so keep this URL to avoid confusion. >> +For example, to mirror @url{http://www.gnu.org,www.gnu.org} with VCL you >> +can do something along these lines: > > Does "@c" mean a comment? Yes. >> +(define %varnish-accounts >> + (list (user-group >> + (name "varnish") >> + (system? #t)) >> + (user-account >> + (name "varnish") >> + (group "varnish") >> + (system? #t) >> + (comment "Varnish Cache User") >> + (home-directory "/var/varnish") >> + (shell (file-append shadow "/sbin/nologin"))))) >> + >> +(define %varnish-activation >> + #~(begin >> + (use-modules (guix build utils)) >> + (let ((home-dir "/var/varnish") >> + (user (getpwnam "varnish"))) >> + (mkdir-p home-dir) >> + (chown home-dir (passwd:uid user) (passwd:gid user)) >> + (chmod home-dir #o755)))) > > Is this necessary, as I think the users home directory might be > automatically created? You are correct! I removed the activation script. > Anyway, this looks pretty much good to me. Thank you very much for reviewing :-) Pushed as 3b97a1779f3b65d582b8edc8c154b6414314b946. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAluqvEMACgkQoqBt8qM6 VPrVGQgAj8D3Iup04bl81PMDHY4UGleSUu3E9PGe3v7ZpOmIuxopMcpr1vMSbtsc uqy6rMjDTcKR3GUmE3+00c38fV0GsbGYIP0L7PceUM1ek1ZsCu+R3T3RE5m2Q4HL cxX0/j1oOfKiWblhXXSkQYp8oq5f5KlDrRXRUHgpydo9a4GKrsMTid+gOSMstW/i zS0AcA4LrwO7y8Rec5I+0qinx6hBdJtCQSkjuv6QQ5x0KUBRbyOw3N1CiRcRULMi +pqAQ/df+DjFTtgoxnCNHk27ibHeQ7UkgUfRrO4mPXMunn2YomLrDX8msgggMgWz E1S6x7fI/+Jsx8MjP4yAYZ1Lx4ZoBA== =4ivn -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 28 15:35:47 2018 Received: (at 32771-done) by debbugs.gnu.org; 28 Sep 2018 19:35:47 +0000 Received: from localhost ([127.0.0.1]:57974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5yYE-00087E-Vm for submit@debbugs.gnu.org; Fri, 28 Sep 2018 15:35:47 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:53034 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5yYC-000874-IK for 32771-done@debbugs.gnu.org; Fri, 28 Sep 2018 15:35:46 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id EE63E1662C; Fri, 28 Sep 2018 20:35:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id DD597164FF; Fri, 28 Sep 2018 20:35:42 +0100 (BST) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 84294c07; Fri, 28 Sep 2018 19:35:42 +0000 (UTC) References: <20180919133027.12799-1-mbakke@fastmail.com> <20180919133027.12799-2-mbakke@fastmail.com> <87va6xwbq0.fsf@cbaines.net> <87ftxxkx4s.fsf@fastmail.com> User-agent: mu4e 1.0; emacs 26.1 From: Christopher Baines To: Marius Bakke Subject: Re: [bug#32771] [PATCH 2/2] services: Add Varnish service. In-reply-to: <87ftxxkx4s.fsf@fastmail.com> Date: Fri, 28 Sep 2018 20:35:40 +0100 Message-ID: <87in2pjtyr.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 32771-done Cc: 32771-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Marius Bakke writes: > Christopher Baines writes: > >> Also, I wonder if you'd considered supporing running multiple instances >> of varnishd, I guess the "name" might come in useful then. > > If you read the system test closely, you'll notice it does actually run > multiple instances, one proxying the other, and testing different > aspects of the service definition :-) Huh, I made this comment based off the service itself. I didn't quite realise you could just have multiple services of the same type without handling that explicitly in the service type. >>> +@c Varnish does not support HTTPS, so keep this URL to avoid confusion. >>> +For example, to mirror @url{http://www.gnu.org,www.gnu.org} with VCL you >>> +can do something along these lines: >> >> Does "@c" mean a comment? > > Yes. Ah, I think I get it now. I was reading this comment as being the whole block, but now I see it's only the line about the use of HTTP. >>> +(define %varnish-accounts >>> + (list (user-group >>> + (name "varnish") >>> + (system? #t)) >>> + (user-account >>> + (name "varnish") >>> + (group "varnish") >>> + (system? #t) >>> + (comment "Varnish Cache User") >>> + (home-directory "/var/varnish") >>> + (shell (file-append shadow "/sbin/nologin"))))) >>> + >>> +(define %varnish-activation >>> + #~(begin >>> + (use-modules (guix build utils)) >>> + (let ((home-dir "/var/varnish") >>> + (user (getpwnam "varnish"))) >>> + (mkdir-p home-dir) >>> + (chown home-dir (passwd:uid user) (passwd:gid user)) >>> + (chmod home-dir #o755)))) >> >> Is this necessary, as I think the users home directory might be >> automatically created? > > You are correct! I removed the activation script. Great :) >> Anyway, this looks pretty much good to me. > > Thank you very much for reviewing :-) > > Pushed as 3b97a1779f3b65d582b8edc8c154b6414314b946. Awesome :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAluugoxfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XfCOw/7BuxOrxqrh1evSm4/vCC2FpLFZVo2avDqnVTYmuVFBKXDPrsywLbFpdjY gurRQhd8DRlitvo9ZBUdcMAqDezYH2tjK2zeTUE+OdxbrbHnh04qLFm22KNEPbFJ nyH+z69+On6UZ6fEhy/gAuxNA1kkOXgQIJoBvtpc/XmoRECeMFt/4cIbGebeVnzU rj4WCI2bYguoku3jljt6C+fwGmZREuyJJl27G4HjXSFyAFFVuCoGkLTs9bXR8E3E KYMyq63u9c0WJxj9Tv3iWubZGx4thVq8bulx1WXO3+dBmg2Fvcki3B6GKuKiSBDW I5WxOhPJiSKp62lTFV7FPTDbV8TIkF0dHdfoWUNnW4On3DcjG1Gk2eywWfOCGFxo JebmWC/+CzwWCc9hxCxl1o8oEJzPyvrMiPIDmewYSxDMTP7TDacqeKauBW3g3RGT ezxAgSTqZV59/j46K369ClSDu0ATpNw22x2SVnPJAsM/zubQo8DAiJLRpFkTax4l i9CR7UZpxMKXzBWnz8uOVxfQRzsTAxB+YSF1fyTGKaAndt6vnyIMCu1LjTjyFVn3 il/GvJEndGIfYU+w7rL7VKqQjoOcCZMlqJPRpmadyBY3rTsPY4F0ozqW5mVb6aPS KvSW1MR/ei9i6ekRbEg/2PGbboaf4qlOiA5n003nSN3PP+hMg1U= =wDcq -----END PGP SIGNATURE----- --=-=-=-- From unknown Sat Aug 16 18:41:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 27 Oct 2018 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator