Merge pull request #69342 from Kiwi/matomo-updates
Matomo (module, package) updates
This commit is contained in:
commit
722b99beb9
nixos
pkgs
@ -135,7 +135,8 @@ with lib;
|
|||||||
# piwik was renamed to matomo
|
# piwik was renamed to matomo
|
||||||
(mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
|
(mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
|
||||||
(mkRenamedOptionModule [ "services" "piwik" "webServerUser" ] [ "services" "matomo" "webServerUser" ])
|
(mkRenamedOptionModule [ "services" "piwik" "webServerUser" ] [ "services" "matomo" "webServerUser" ])
|
||||||
(mkRenamedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] [ "services" "matomo" "phpfpmProcessManagerConfig" ])
|
(mkRemovedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings")
|
||||||
|
(mkRemovedOptionModule [ "services" "matomo" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings")
|
||||||
(mkRenamedOptionModule [ "services" "piwik" "nginx" ] [ "services" "matomo" "nginx" ])
|
(mkRenamedOptionModule [ "services" "piwik" "nginx" ] [ "services" "matomo" "nginx" ])
|
||||||
|
|
||||||
# tarsnap
|
# tarsnap
|
||||||
|
@ -105,7 +105,7 @@ GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
|
|||||||
<para>
|
<para>
|
||||||
You can use other web servers by forwarding calls for
|
You can use other web servers by forwarding calls for
|
||||||
<filename>index.php</filename> and <filename>piwik.php</filename> to the
|
<filename>index.php</filename> and <filename>piwik.php</filename> to the
|
||||||
<literal>/run/phpfpm-matomo.sock</literal> fastcgi unix socket. You can use
|
<literal><link linkend="opt-services.phpfpm.pools._name_.socket">services.phpfpm.pools.<name>.socket</link></literal> fastcgi unix socket. You can use
|
||||||
the nginx configuration in the module code as a reference to what else
|
the nginx configuration in the module code as a reference to what else
|
||||||
should be configured.
|
should be configured.
|
||||||
</para>
|
</para>
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.matomo;
|
cfg = config.services.matomo;
|
||||||
|
fpm = config.services.phpfpm.pools.${pool};
|
||||||
|
|
||||||
user = "matomo";
|
user = "matomo";
|
||||||
dataDir = "/var/lib/${user}";
|
dataDir = "/var/lib/${user}";
|
||||||
deprecatedDataDir = "/var/lib/piwik";
|
deprecatedDataDir = "/var/lib/piwik";
|
||||||
|
|
||||||
pool = user;
|
pool = user;
|
||||||
# it's not possible to use /run/phpfpm/${pool}.sock because /run/phpfpm/ is root:root 0770,
|
|
||||||
# and therefore is not accessible by the web server.
|
|
||||||
phpSocket = "/run/phpfpm-${pool}.sock";
|
|
||||||
phpExecutionUnit = "phpfpm-${pool}";
|
phpExecutionUnit = "phpfpm-${pool}";
|
||||||
databaseService = "mysql.service";
|
databaseService = "mysql.service";
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ in {
|
|||||||
default = null;
|
default = null;
|
||||||
example = "lighttpd";
|
example = "lighttpd";
|
||||||
description = ''
|
description = ''
|
||||||
Name of the web server user that forwards requests to the ${phpSocket} fastcgi socket for Matomo if the nginx
|
Name of the web server user that forwards requests to <option>services.phpfpm.pools.<name>.socket</option> the fastcgi socket for Matomo if the nginx
|
||||||
option is not used. Either this option or the nginx option is mandatory.
|
option is not used. Either this option or the nginx option is mandatory.
|
||||||
If you want to use another webserver than nginx, you need to set this to that server's user
|
If you want to use another webserver than nginx, you need to set this to that server's user
|
||||||
and pass fastcgi requests to `index.php`, `matomo.php` and `piwik.php` (legacy name) to this socket.
|
and pass fastcgi requests to `index.php`, `matomo.php` and `piwik.php` (legacy name) to this socket.
|
||||||
@ -71,25 +69,6 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
phpfpmProcessManagerConfig = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = ''
|
|
||||||
; default phpfpm process manager settings
|
|
||||||
pm = dynamic
|
|
||||||
pm.max_children = 75
|
|
||||||
pm.start_servers = 10
|
|
||||||
pm.min_spare_servers = 5
|
|
||||||
pm.max_spare_servers = 20
|
|
||||||
pm.max_requests = 500
|
|
||||||
|
|
||||||
; log worker's stdout, but this has a performance hit
|
|
||||||
catch_workers_output = yes
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
Settings for phpfpm's process manager. You might need to change this depending on the load for Matomo.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
nginx = mkOption {
|
nginx = mkOption {
|
||||||
type = types.nullOr (types.submodule (
|
type = types.nullOr (types.submodule (
|
||||||
recursiveUpdate
|
recursiveUpdate
|
||||||
@ -233,15 +212,24 @@ in {
|
|||||||
else if (cfg.webServerUser != null) then cfg.webServerUser else "";
|
else if (cfg.webServerUser != null) then cfg.webServerUser else "";
|
||||||
in {
|
in {
|
||||||
${pool} = {
|
${pool} = {
|
||||||
listen = phpSocket;
|
inherit user;
|
||||||
extraConfig = ''
|
phpOptions = ''
|
||||||
listen.owner = ${socketOwner}
|
error_log = 'stderr'
|
||||||
listen.group = root
|
log_errors = on
|
||||||
listen.mode = 0600
|
|
||||||
user = ${user}
|
|
||||||
env[PIWIK_USER_PATH] = ${dataDir}
|
|
||||||
${cfg.phpfpmProcessManagerConfig}
|
|
||||||
'';
|
'';
|
||||||
|
settings = mapAttrs (name: mkDefault) {
|
||||||
|
"listen.owner" = socketOwner;
|
||||||
|
"listen.group" = "root";
|
||||||
|
"listen.mode" = "0660";
|
||||||
|
"pm" = "dynamic";
|
||||||
|
"pm.max_children" = 75;
|
||||||
|
"pm.start_servers" = 10;
|
||||||
|
"pm.min_spare_servers" = 5;
|
||||||
|
"pm.max_spare_servers" = 20;
|
||||||
|
"pm.max_requests" = 500;
|
||||||
|
"catch_workers_output" = true;
|
||||||
|
};
|
||||||
|
phpEnv.PIWIK_USER_PATH = dataDir;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -264,15 +252,15 @@ in {
|
|||||||
};
|
};
|
||||||
# allow index.php for webinterface
|
# allow index.php for webinterface
|
||||||
locations."= /index.php".extraConfig = ''
|
locations."= /index.php".extraConfig = ''
|
||||||
fastcgi_pass unix:${phpSocket};
|
fastcgi_pass unix:${fpm.socket};
|
||||||
'';
|
'';
|
||||||
# allow matomo.php for tracking
|
# allow matomo.php for tracking
|
||||||
locations."= /matomo.php".extraConfig = ''
|
locations."= /matomo.php".extraConfig = ''
|
||||||
fastcgi_pass unix:${phpSocket};
|
fastcgi_pass unix:${fpm.socket};
|
||||||
'';
|
'';
|
||||||
# allow piwik.php for tracking (deprecated name)
|
# allow piwik.php for tracking (deprecated name)
|
||||||
locations."= /piwik.php".extraConfig = ''
|
locations."= /piwik.php".extraConfig = ''
|
||||||
fastcgi_pass unix:${phpSocket};
|
fastcgi_pass unix:${fpm.socket};
|
||||||
'';
|
'';
|
||||||
# Any other attempt to access any php files is forbidden
|
# Any other attempt to access any php files is forbidden
|
||||||
locations."~* ^.+\\.php$".extraConfig = ''
|
locations."~* ^.+\\.php$".extraConfig = ''
|
||||||
|
@ -159,6 +159,7 @@ in
|
|||||||
#logstash = handleTest ./logstash.nix {};
|
#logstash = handleTest ./logstash.nix {};
|
||||||
mailcatcher = handleTest ./mailcatcher.nix {};
|
mailcatcher = handleTest ./mailcatcher.nix {};
|
||||||
mathics = handleTest ./mathics.nix {};
|
mathics = handleTest ./mathics.nix {};
|
||||||
|
matomo = handleTest ./matomo.nix {};
|
||||||
matrix-synapse = handleTest ./matrix-synapse.nix {};
|
matrix-synapse = handleTest ./matrix-synapse.nix {};
|
||||||
mediawiki = handleTest ./mediawiki.nix {};
|
mediawiki = handleTest ./mediawiki.nix {};
|
||||||
memcached = handleTest ./memcached.nix {};
|
memcached = handleTest ./memcached.nix {};
|
||||||
|
43
nixos/tests/matomo.nix
Normal file
43
nixos/tests/matomo.nix
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{ system ? builtins.currentSystem, config ? { }
|
||||||
|
, pkgs ? import ../.. { inherit system config; } }:
|
||||||
|
|
||||||
|
with import ../lib/testing.nix { inherit system pkgs; };
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
matomoTest = package:
|
||||||
|
makeTest {
|
||||||
|
machine = { config, pkgs, ... }: {
|
||||||
|
services.matomo = {
|
||||||
|
package = package;
|
||||||
|
enable = true;
|
||||||
|
nginx = {
|
||||||
|
forceSSL = false;
|
||||||
|
enableACME = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.mysql = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.mysql;
|
||||||
|
};
|
||||||
|
services.nginx.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
startAll;
|
||||||
|
$machine->waitForUnit("mysql.service");
|
||||||
|
$machine->waitForUnit("phpfpm-matomo.service");
|
||||||
|
$machine->waitForUnit("nginx.service");
|
||||||
|
$machine->succeed("curl -sSfL http://localhost/ | grep '<title>Matomo[^<]*Installation'");
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
matomo = matomoTest pkgs.matomo // {
|
||||||
|
name = "matomo";
|
||||||
|
meta.maintainers = with maintainers; [ florianjacob kiwi mmilata ];
|
||||||
|
};
|
||||||
|
matomo-beta = matomoTest pkgs.matomo-beta // {
|
||||||
|
name = "matomo-beta";
|
||||||
|
meta.maintainers = with maintainers; [ florianjacob kiwi mmilata ];
|
||||||
|
};
|
||||||
|
}
|
@ -1,12 +1,30 @@
|
|||||||
{ stdenv, fetchurl, makeWrapper, php }:
|
{ stdenv, fetchurl, makeWrapper, php }:
|
||||||
|
|
||||||
|
let
|
||||||
|
versions = {
|
||||||
|
matomo = {
|
||||||
|
version = "3.11.0";
|
||||||
|
sha256 = "1fbnmmzzsi3dfm9qm30wypxjcazl37mryaik9mlrb19hnp2md40q";
|
||||||
|
};
|
||||||
|
|
||||||
|
matomo-beta = {
|
||||||
|
version = "3.12.0";
|
||||||
|
beta = 3;
|
||||||
|
sha256 = "1n7b8cag7rpi6y4145cll2irz3in4668jkiicy06wm5nq6lb4bdf";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
common = pname: {version, sha256, beta ? null}:
|
||||||
|
let fullVersion = version + stdenv.lib.optionalString (beta != null) "-b${toString beta}";
|
||||||
|
name = "${pname}-${fullVersion}";
|
||||||
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "matomo";
|
inherit name;
|
||||||
version = "3.11.0";
|
version = fullVersion;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://builds.matomo.org/matomo-${version}.tar.gz";
|
url = "https://builds.matomo.org/matomo-${version}.tar.gz";
|
||||||
sha256 = "1fbnmmzzsi3dfm9qm30wypxjcazl37mryaik9mlrb19hnp2md40q";
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
@ -53,6 +71,7 @@ stdenv.mkDerivation rec {
|
|||||||
license = licenses.gpl3Plus;
|
license = licenses.gpl3Plus;
|
||||||
homepage = https://matomo.org/;
|
homepage = https://matomo.org/;
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
maintainers = [ maintainers.florianjacob ];
|
maintainers = with maintainers; [ florianjacob kiwi ];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
in stdenv.lib.mapAttrs common versions
|
||||||
|
@ -15480,7 +15480,9 @@ in
|
|||||||
|
|
||||||
shiori = callPackage ../servers/web-apps/shiori { };
|
shiori = callPackage ../servers/web-apps/shiori { };
|
||||||
|
|
||||||
matomo = callPackage ../servers/web-apps/matomo { };
|
inherit (callPackages ../servers/web-apps/matomo {})
|
||||||
|
matomo
|
||||||
|
matomo-beta;
|
||||||
|
|
||||||
axis2 = callPackage ../servers/http/tomcat/axis2 { };
|
axis2 = callPackage ../servers/http/tomcat/axis2 { };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user