mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
services: php-fpm: Add 'timezone' configuration.
* gnu/services/web.scm: (<php-fpm-configuration>)[timezone]: New record field. (default-php-fpm-config, php-fpm-shepherd-service, php-fpm-activation): Use this. * doc/guix.texi (Web Services): Document this.
This commit is contained in:
parent
6106d7cae4
commit
e517161d6b
2 changed files with 30 additions and 20 deletions
|
@ -17658,6 +17658,8 @@ Determines whether php errors and warning should be sent to clients
|
||||||
and displayed in their browsers.
|
and displayed in their browsers.
|
||||||
This is useful for local php development, but a security risk for public sites,
|
This is useful for local php development, but a security risk for public sites,
|
||||||
as error messages can reveal passwords and personal data.
|
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")})
|
@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.
|
This file will log the @code{stderr} outputs of php worker processes.
|
||||||
Can be set to @code{#f} to disable logging.
|
Can be set to @code{#f} to disable logging.
|
||||||
|
|
|
@ -142,6 +142,7 @@ (define-module (gnu services web)
|
||||||
php-fpm-configuration-log-file
|
php-fpm-configuration-log-file
|
||||||
php-fpm-configuration-process-manager
|
php-fpm-configuration-process-manager
|
||||||
php-fpm-configuration-display-errors
|
php-fpm-configuration-display-errors
|
||||||
|
php-fpm-configuration-timezone
|
||||||
php-fpm-configuration-workers-log-file
|
php-fpm-configuration-workers-log-file
|
||||||
php-fpm-configuration-file
|
php-fpm-configuration-file
|
||||||
|
|
||||||
|
@ -773,6 +774,8 @@ (define-record-type* <php-fpm-configuration> php-fpm-configuration
|
||||||
(default (php-fpm-dynamic-process-manager-configuration)))
|
(default (php-fpm-dynamic-process-manager-configuration)))
|
||||||
(display-errors php-fpm-configuration-display-errors
|
(display-errors php-fpm-configuration-display-errors
|
||||||
(default #f))
|
(default #f))
|
||||||
|
(timezone php-fpm-configuration-timezone
|
||||||
|
(default #f))
|
||||||
(workers-log-file php-fpm-configuration-workers-log-file
|
(workers-log-file php-fpm-configuration-workers-log-file
|
||||||
(default (string-append "/var/log/php"
|
(default (string-append "/var/log/php"
|
||||||
(version-major (package-version php))
|
(version-major (package-version php))
|
||||||
|
@ -827,7 +830,7 @@ (define php-fpm-accounts
|
||||||
(shell (file-append shadow "/sbin/nologin")))))))
|
(shell (file-append shadow "/sbin/nologin")))))))
|
||||||
|
|
||||||
(define (default-php-fpm-config socket user group socket-user socket-group
|
(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"
|
(apply mixed-text-file "php-fpm.conf"
|
||||||
(flatten
|
(flatten
|
||||||
"[global]\n"
|
"[global]\n"
|
||||||
|
@ -840,6 +843,10 @@ (define (default-php-fpm-config socket user group socket-user socket-group
|
||||||
"listen.owner =" socket-user "\n"
|
"listen.owner =" socket-user "\n"
|
||||||
"listen.group =" socket-group "\n"
|
"listen.group =" socket-group "\n"
|
||||||
|
|
||||||
|
(if timezone
|
||||||
|
(string-append "php_admin_value[date.timezone] = \"" timezone "\"\n")
|
||||||
|
"")
|
||||||
|
|
||||||
(match pm
|
(match pm
|
||||||
(($ <php-fpm-dynamic-process-manager-configuration>
|
(($ <php-fpm-dynamic-process-manager-configuration>
|
||||||
pm.max-children
|
pm.max-children
|
||||||
|
@ -879,7 +886,8 @@ (define (default-php-fpm-config socket user group socket-user socket-group
|
||||||
(define php-fpm-shepherd-service
|
(define php-fpm-shepherd-service
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <php-fpm-configuration> php socket user group socket-user socket-group
|
(($ <php-fpm-configuration> 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
|
(list (shepherd-service
|
||||||
(provision '(php-fpm))
|
(provision '(php-fpm))
|
||||||
(documentation "Run the php-fpm daemon.")
|
(documentation "Run the php-fpm daemon.")
|
||||||
|
@ -890,27 +898,27 @@ (define php-fpm-shepherd-service
|
||||||
#$(or file
|
#$(or file
|
||||||
(default-php-fpm-config socket user group
|
(default-php-fpm-config socket user group
|
||||||
socket-user socket-group pid-file log-file
|
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))
|
#:pid-file #$pid-file))
|
||||||
(stop #~(make-kill-destructor)))))))
|
(stop #~(make-kill-destructor)))))))
|
||||||
|
|
||||||
(define php-fpm-activation
|
(define (php-fpm-activation config)
|
||||||
(match-lambda
|
#~(begin
|
||||||
(($ <php-fpm-configuration> _ _ user _ _ _ _ log-file _ _ workers-log-file _)
|
(use-modules (guix build utils))
|
||||||
#~(begin
|
(let* ((user (getpwnam #$(php-fpm-configuration-user config)))
|
||||||
(use-modules (guix build utils))
|
(touch (lambda (file-name)
|
||||||
(let* ((user (getpwnam #$user))
|
(call-with-output-file file-name (const #t))))
|
||||||
(touch (lambda (file-name)
|
(workers-log-file
|
||||||
(call-with-output-file file-name (const #t))))
|
#$(php-fpm-configuration-workers-log-file config))
|
||||||
(init-log-file
|
(init-log-file
|
||||||
(lambda (file-name)
|
(lambda (file-name)
|
||||||
(when #$workers-log-file
|
(when workers-log-file
|
||||||
(when (not (file-exists? file-name))
|
(when (not (file-exists? file-name))
|
||||||
(touch file-name))
|
(touch file-name))
|
||||||
(chown file-name (passwd:uid user) (passwd:gid user))
|
(chown file-name (passwd:uid user) (passwd:gid user))
|
||||||
(chmod file-name #o660)))))
|
(chmod file-name #o660)))))
|
||||||
(init-log-file #$log-file)
|
(init-log-file #$(php-fpm-configuration-log-file config))
|
||||||
(init-log-file #$workers-log-file))))))
|
(init-log-file workers-log-file))))
|
||||||
|
|
||||||
|
|
||||||
(define php-fpm-service-type
|
(define php-fpm-service-type
|
||||||
|
|
Loading…
Reference in a new issue