git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/matomo: fix deprecation warnings

Fixes the phpfpm deprecation warnings about listen and extraConfig by using fpm.socket and settings. Removes phpfpmProcessManagerConfig.

commit6ea626d3e25629420fb1dc6f717cbebf861c9895 authorRobert Djubek <envy1988@gmail.com> dateTue 24 Sep 2019, 08:03 (7 years ago) parentc833fb3
3 files changed+25−36
nixos/modules/rename.nix+2−1 nixos/modules/services/web-apps/matomo-doc.xml+1−1 nixos/modules/services/web-apps/matomo.nix+22−34
nixos/modules/rename.nix+2−1
@@ -135,7 +135,8 @@ with lib;
135135 # piwik was renamed to matomo
136136 (mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
137137 (mkRenamedOptionModule [ "services" "piwik" "webServerUser" ] [ "services" "matomo" "webServerUser" ])
138− (mkRenamedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] [ "services" "matomo" "phpfpmProcessManagerConfig" ])
138+ (mkRemovedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings")
139+ (mkRemovedOptionModule [ "services" "matomo" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings")
139140 (mkRenamedOptionModule [ "services" "piwik" "nginx" ] [ "services" "matomo" "nginx" ])
140141
141142 # tarsnap
nixos/modules/services/web-apps/matomo-doc.xml+1−1
@@ -105,7 +105,7 @@ GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
105105 <para>
106106 You can use other web servers by forwarding calls for
107107 <filename>index.php</filename> and <filename>piwik.php</filename> to the
108− <literal>/run/phpfpm-matomo.sock</literal> fastcgi unix socket. You can use
108+ <literal><link linkend="opt-services.phpfpm.pools._name_.socket">services.phpfpm.pools.&lt;name&gt;.socket</link></literal> fastcgi unix socket. You can use
109109 the nginx configuration in the module code as a reference to what else
110110 should be configured.
111111 </para>
nixos/modules/services/web-apps/matomo.nix+22−34
@@ -2,15 +2,13 @@
22with lib;
33let
44 cfg = config.services.matomo;
5+ fpm = config.services.phpfpm.pools.${pool};
56
67 user = "matomo";
78 dataDir = "/var/lib/${user}";
89 deprecatedDataDir = "/var/lib/piwik";
910
1011 pool = user;
11− # it's not possible to use /run/phpfpm/${pool}.sock because /run/phpfpm/ is root:root 0770,
12− # and therefore is not accessible by the web server.
13− phpSocket = "/run/phpfpm-${pool}.sock";
1412 phpExecutionUnit = "phpfpm-${pool}";
1513 databaseService = "mysql.service";
1614
@@ -50,7 +48,7 @@ in {
5048 default = null;
5149 example = "lighttpd";
5250 description = ''
53− Name of the web server user that forwards requests to the ${phpSocket} fastcgi socket for Matomo if the nginx
51+ Name of the web server user that forwards requests to <option>services.phpfpm.pools.&lt;name&gt;.socket</option> the fastcgi socket for Matomo if the nginx
5452 option is not used. Either this option or the nginx option is mandatory.
5553 If you want to use another webserver than nginx, you need to set this to that server's user
5654 and pass fastcgi requests to `index.php`, `matomo.php` and `piwik.php` (legacy name) to this socket.
@@ -71,25 +69,6 @@ in {
7169 '';
7270 };
7371
74− phpfpmProcessManagerConfig = mkOption {
75− type = types.str;
76− default = ''
77− ; default phpfpm process manager settings
78− pm = dynamic
79− pm.max_children = 75
80− pm.start_servers = 10
81− pm.min_spare_servers = 5
82− pm.max_spare_servers = 20
83− pm.max_requests = 500
84−
85− ; log worker's stdout, but this has a performance hit
86− catch_workers_output = yes
87− '';
88− description = ''
89− Settings for phpfpm's process manager. You might need to change this depending on the load for Matomo.
90− '';
91− };
92−
9372 nginx = mkOption {
9473 type = types.nullOr (types.submodule (
9574 recursiveUpdate
@@ -233,15 +212,24 @@ in {
233212 else if (cfg.webServerUser != null) then cfg.webServerUser else "";
234213 in {
235214 ${pool} = {
236− listen = phpSocket;
237− extraConfig = ''
238− listen.owner = ${socketOwner}
239− listen.group = root
240− listen.mode = 0600
241− user = ${user}
242− env[PIWIK_USER_PATH] = ${dataDir}
243− ${cfg.phpfpmProcessManagerConfig}
215+ inherit user;
216+ phpOptions = ''
217+ error_log = 'stderr'
218+ log_errors = on
244219 '';
220+ settings = mapAttrs (name: mkDefault) {
221+ "listen.owner" = socketOwner;
222+ "listen.group" = "root";
223+ "listen.mode" = "0660";
224+ "pm" = "dynamic";
225+ "pm.max_children" = 75;
226+ "pm.start_servers" = 10;
227+ "pm.min_spare_servers" = 5;
228+ "pm.max_spare_servers" = 20;
229+ "pm.max_requests" = 500;
230+ "catch_workers_output" = true;
231+ };
232+ phpEnv.PIWIK_USER_PATH = dataDir;
245233 };
246234 };
247235
@@ -264,15 +252,15 @@ in {
264252 };
265253 # allow index.php for webinterface
266254 locations."= /index.php".extraConfig = ''
267− fastcgi_pass unix:${phpSocket};
255+ fastcgi_pass unix:${fpm.socket};
268256 '';
269257 # allow matomo.php for tracking
270258 locations."= /matomo.php".extraConfig = ''
271− fastcgi_pass unix:${phpSocket};
259+ fastcgi_pass unix:${fpm.socket};
272260 '';
273261 # allow piwik.php for tracking (deprecated name)
274262 locations."= /piwik.php".extraConfig = ''
275− fastcgi_pass unix:${phpSocket};
263+ fastcgi_pass unix:${fpm.socket};
276264 '';
277265 # Any other attempt to access any php files is forbidden
278266 locations."~* ^.+\\.php$".extraConfig = ''