From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSRPy-00079u-PL for guix-patches@gnu.org; Thu, 29 Nov 2018 13:52:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSRPv-0001rk-Mc for guix-patches@gnu.org; Thu, 29 Nov 2018 13:52:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:50855) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSRPv-0001rg-Hl for guix-patches@gnu.org; Thu, 29 Nov 2018 13:52:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gSRPv-00029c-DX for guix-patches@gnu.org; Thu, 29 Nov 2018 13:52:03 -0500 Subject: [bug#33549] [PATCH 4/6] services: php-fpm: Add 'timezone' configuration. Resent-Message-ID: From: Oleg Pykhalov Date: Thu, 29 Nov 2018 21:50:40 +0300 Message-Id: <20181129185042.6050-4-go.wigust@gmail.com> In-Reply-To: <20181129185042.6050-1-go.wigust@gmail.com> References: <20181129185042.6050-1-go.wigust@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 33549@debbugs.gnu.org * gnu/services/web.scm: ()[timezone]: New record field. (default-php-fpm-config, php-fpm-shepherd-service, php-fpm-activation): Use this. * doc/guix.texi (Web Services): Document this. --- doc/guix.texi | 2 ++ gnu/services/web.scm | 48 ++++++++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 7b8f7acd29..d83071b432 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17608,6 +17608,8 @@ Determines whether php errors and warning should be sent to clients and displayed in their browsers. This is useful for local php development, but a security risk for public sites, as error messages can reveal passwords and personal data. +@item @code{timezone} (default @code{#f}) +Specifies @code{php_admin_value[date.timezone]} parameter. @item @code{workers-logfile} (default @code{(string-append "/var/log/php" (version-major (package-version php)) "-fpm.www.log")}) This file will log the @code{stderr} outputs of php worker processes. Can be set to @code{#f} to disable logging. diff --git a/gnu/services/web.scm b/gnu/services/web.scm index fcf453c248..d71fed20ed 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -142,6 +142,7 @@ php-fpm-configuration-log-file php-fpm-configuration-process-manager php-fpm-configuration-display-errors + php-fpm-configuration-timezone php-fpm-configuration-workers-log-file php-fpm-configuration-file @@ -773,6 +774,8 @@ of index files." (default (php-fpm-dynamic-process-manager-configuration))) (display-errors php-fpm-configuration-display-errors (default #f)) + (timezone php-fpm-configuration-timezone + (default #f)) (workers-log-file php-fpm-configuration-workers-log-file (default (string-append "/var/log/php" (version-major (package-version php)) @@ -827,7 +830,7 @@ of index files." (shell (file-append shadow "/sbin/nologin"))))))) (define (default-php-fpm-config socket user group socket-user socket-group - pid-file log-file pm display-errors workers-log-file) + pid-file log-file pm display-errors timezone workers-log-file) (apply mixed-text-file "php-fpm.conf" (flatten "[global]\n" @@ -840,6 +843,10 @@ of index files." "listen.owner =" socket-user "\n" "listen.group =" socket-group "\n" + (if timezone + (string-append "php_admin_value[date.timezone] = \"" timezone "\"\n") + "") + (match pm (($ pm.max-children @@ -879,7 +886,8 @@ of index files." (define php-fpm-shepherd-service (match-lambda (($ php socket user group socket-user socket-group - pid-file log-file pm display-errors workers-log-file file) + pid-file log-file pm display-errors + timezone workers-log-file file) (list (shepherd-service (provision '(php-fpm)) (documentation "Run the php-fpm daemon.") @@ -890,27 +898,27 @@ of index files." #$(or file (default-php-fpm-config socket user group socket-user socket-group pid-file log-file - pm display-errors workers-log-file))) + pm display-errors timezone workers-log-file))) #:pid-file #$pid-file)) (stop #~(make-kill-destructor))))))) -(define php-fpm-activation - (match-lambda - (($ _ _ user _ _ _ _ log-file _ _ workers-log-file _) - #~(begin - (use-modules (guix build utils)) - (let* ((user (getpwnam #$user)) - (touch (lambda (file-name) - (call-with-output-file file-name (const #t)))) - (init-log-file - (lambda (file-name) - (when #$workers-log-file - (when (not (file-exists? file-name)) - (touch file-name)) - (chown file-name (passwd:uid user) (passwd:gid user)) - (chmod file-name #o660))))) - (init-log-file #$log-file) - (init-log-file #$workers-log-file)))))) +(define (php-fpm-activation config) + #~(begin + (use-modules (guix build utils)) + (let* ((user (getpwnam #$(php-fpm-configuration-user config))) + (touch (lambda (file-name) + (call-with-output-file file-name (const #t)))) + (workers-log-file + #$(php-fpm-configuration-workers-log-file config)) + (init-log-file + (lambda (file-name) + (when workers-log-file + (when (not (file-exists? file-name)) + (touch file-name)) + (chown file-name (passwd:uid user) (passwd:gid user)) + (chmod file-name #o660))))) + (init-log-file #$(php-fpm-configuration-log-file config)) + (init-log-file workers-log-file)))) (define php-fpm-service-type -- 2.19.1