mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 20:49:52 +03:00
php fpm: add systemd support
PHP FPM will now notify systemd when it's done initializing and ready to serve requests. Additionally ```systemctl status phpfpm``` will now show statistics such as: ``` Status: "Processes active: 0, idle: 8, Requests: 0, slow: 0, Traffic: 0req/sec" ```
This commit is contained in:
parent
a6de7142ce
commit
5a6626f47c
@ -7,8 +7,6 @@ let
|
|||||||
|
|
||||||
stateDir = "/run/phpfpm";
|
stateDir = "/run/phpfpm";
|
||||||
|
|
||||||
pidFile = "${stateDir}/phpfpm.pid";
|
|
||||||
|
|
||||||
mkPool = n: p: ''
|
mkPool = n: p: ''
|
||||||
[${n}]
|
[${n}]
|
||||||
listen = ${p.listen}
|
listen = ${p.listen}
|
||||||
@ -17,9 +15,8 @@ let
|
|||||||
|
|
||||||
cfgFile = pkgs.writeText "phpfpm.conf" ''
|
cfgFile = pkgs.writeText "phpfpm.conf" ''
|
||||||
[global]
|
[global]
|
||||||
pid = ${pidFile}
|
|
||||||
error_log = syslog
|
error_log = syslog
|
||||||
daemonize = yes
|
daemonize = no
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
|
|
||||||
${concatStringsSep "\n" (mapAttrsToList mkPool cfg.pools)}
|
${concatStringsSep "\n" (mapAttrsToList mkPool cfg.pools)}
|
||||||
@ -43,7 +40,7 @@ in {
|
|||||||
description = ''
|
description = ''
|
||||||
Extra configuration that should be put in the global section of
|
Extra configuration that should be put in the global section of
|
||||||
the PHP-FPM configuration file. Do not specify the options
|
the PHP-FPM configuration file. Do not specify the options
|
||||||
<literal>pid</literal>, <literal>error_log</literal> or
|
<literal>error_log</literal> or
|
||||||
<literal>daemonize</literal> here, since they are generated by
|
<literal>daemonize</literal> here, since they are generated by
|
||||||
NixOS.
|
NixOS.
|
||||||
'';
|
'';
|
||||||
@ -129,8 +126,8 @@ in {
|
|||||||
mkdir -p "${stateDir}"
|
mkdir -p "${stateDir}"
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
Type = "notify";
|
||||||
ExecStart = "${cfg.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${phpIni}";
|
ExecStart = "${cfg.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${phpIni}";
|
||||||
PIDFile = pidFile;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
, mysql, libxml2, readline, zlib, curl, postgresql, gettext
|
, mysql, libxml2, readline, zlib, curl, postgresql, gettext
|
||||||
, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype
|
, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype
|
||||||
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds
|
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds
|
||||||
, uwimap, pam, gmp, apacheHttpd, libiconv }:
|
, uwimap, pam, gmp, apacheHttpd, libiconv, systemd }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
@ -19,11 +19,12 @@ let
|
|||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
buildInputs = [ flex bison pkgconfig ];
|
buildInputs = [ flex bison pkgconfig systemd ];
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"EXTENSION_DIR=$(out)/lib/php/extensions"
|
"EXTENSION_DIR=$(out)/lib/php/extensions"
|
||||||
] ++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}";
|
] ++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}"
|
||||||
|
++ lib.optional stdenv.isLinux "--with-fpm-systemd";
|
||||||
|
|
||||||
flags = {
|
flags = {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user