Merge pull request #142803 from mkg20001/matomoplugins

authored by

Maciej Krüger and committed by
GitHub
f096b712 1ffd57e9

+26 -11
+17 -3
nixos/modules/services/web-apps/matomo.nix
··· 24 (mkRemovedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings") 25 (mkRemovedOptionModule [ "services" "matomo" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings") 26 (mkRenamedOptionModule [ "services" "piwik" "nginx" ] [ "services" "matomo" "nginx" ]) 27 ]; 28 29 options = { ··· 77 ''; 78 }; 79 80 - periodicArchiveProcessingUrl = mkOption { 81 type = types.str; 82 default = "${user}.${fqdn}"; 83 example = "matomo.yourdomain.org"; ··· 170 fi 171 chown -R ${user}:${user} ${dataDir} 172 chmod -R ug+rwX,o-rwx ${dataDir} 173 ''; 174 script = '' 175 # Use User-Private Group scheme to protect Matomo data, but allow administration / backup via 'matomo' group ··· 202 UMask = "0007"; 203 CPUSchedulingPolicy = "idle"; 204 IOSchedulingClass = "idle"; 205 - ExecStart = "${cfg.package}/bin/matomo-console core:archive --url=https://${cfg.periodicArchiveProcessingUrl}"; 206 }; 207 }; 208 ··· 258 # References: 259 # https://fralef.me/piwik-hardening-with-nginx-and-php-fpm.html 260 # https://github.com/perusio/piwik-nginx 261 - "${user}.${fqdn}" = mkMerge [ cfg.nginx { 262 # don't allow to override the root easily, as it will almost certainly break Matomo. 263 # disadvantage: not shown as default in docs. 264 root = mkForce "${cfg.package}/share";
··· 24 (mkRemovedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings") 25 (mkRemovedOptionModule [ "services" "matomo" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings") 26 (mkRenamedOptionModule [ "services" "piwik" "nginx" ] [ "services" "matomo" "nginx" ]) 27 + (mkRenamedOptionModule [ "services" "matomo" "periodicArchiveProcessingUrl" ] [ "services" "matomo" "hostname" ]) 28 ]; 29 30 options = { ··· 78 ''; 79 }; 80 81 + hostname = mkOption { 82 type = types.str; 83 default = "${user}.${fqdn}"; 84 example = "matomo.yourdomain.org"; ··· 171 fi 172 chown -R ${user}:${user} ${dataDir} 173 chmod -R ug+rwX,o-rwx ${dataDir} 174 + 175 + if [ -e ${dataDir}/current-package ]; then 176 + CURRENT_PACKAGE=$(readlink ${dataDir}/current-package) 177 + NEW_PACKAGE=${cfg.package} 178 + if [ "$CURRENT_PACKAGE" != "$NEW_PACKAGE" ]; then 179 + # keeping tmp arround between upgrades seems to bork stuff, so delete it 180 + rm -rf ${dataDir}/tmp 181 + fi 182 + elif [ -e ${dataDir}/tmp ]; then 183 + # upgrade from 4.4.1 184 + rm -rf ${dataDir}/tmp 185 + fi 186 + ln -sfT ${cfg.package} ${dataDir}/current-package 187 ''; 188 script = '' 189 # Use User-Private Group scheme to protect Matomo data, but allow administration / backup via 'matomo' group ··· 216 UMask = "0007"; 217 CPUSchedulingPolicy = "idle"; 218 IOSchedulingClass = "idle"; 219 + ExecStart = "${cfg.package}/bin/matomo-console core:archive --url=https://${cfg.hostname}"; 220 }; 221 }; 222 ··· 272 # References: 273 # https://fralef.me/piwik-hardening-with-nginx-and-php-fpm.html 274 # https://github.com/perusio/piwik-nginx 275 + "${cfg.hostname}" = mkMerge [ cfg.nginx { 276 # don't allow to override the root easily, as it will almost certainly break Matomo. 277 # disadvantage: not shown as default in docs. 278 root = mkForce "${cfg.package}/share";
+9 -8
pkgs/servers/web-apps/matomo/default.nix
··· 3 let 4 versions = { 5 matomo = { 6 - version = "4.4.1"; 7 - sha256 = "0y8ljdj97znvd3hkkr7s6s9k8m93agw3z9cfw1azzaxgc46akfcl"; 8 }; 9 10 matomo-beta = { 11 - version = "4.4.1"; 12 # `beta` examples: "b1", "rc1", null 13 - # TOOD when updating: use null if stable version is >= latest beta or release candidate 14 - beta = null; 15 - sha256 = "0y8ljdj97znvd3hkkr7s6s9k8m93agw3z9cfw1azzaxgc46akfcl"; 16 }; 17 }; 18 common = pname: { version, sha256, beta ? null }: ··· 74 "misc/composer/clean-xhprof.sh" 75 "misc/cron/archive.sh" 76 "plugins/Installation/FormDatabaseSetup.php" 77 - "vendor/leafo/lessphp/package.sh" 78 "vendor/pear/archive_tar/sync-php4" 79 "vendor/szymach/c-pchart/coverage.sh" 80 - # drupal_test.sh does not exist in 3.12.0-b3; added for 3.13.0 81 "vendor/twig/twig/drupal_test.sh" 82 ]; 83 ··· 92 length="$(wc -c "$f" | cut -d' ' -f1)" 93 hash="$(md5sum "$f" | cut -d' ' -f1)" 94 sed -i "s:\\(\"$f\"[^(]*(\\).*:\\1\"$length\", \"$hash\"),:g" config/manifest.inc.php 95 fi 96 done 97 popd > /dev/null
··· 3 let 4 versions = { 5 matomo = { 6 + version = "4.5.0"; 7 + sha256 = "sha256-OyjdzY+ENYxOTVjDLjj2unJbpaGODIH2I5Acmt45HDA="; 8 }; 9 10 matomo-beta = { 11 + version = "4.6.0"; 12 # `beta` examples: "b1", "rc1", null 13 + # when updating: use null if stable version is >= latest beta or release candidate 14 + beta = "b2"; 15 + sha256 = "sha256-7p/ZPtr5a/tBjrM27ILF3rNfxDIWuzWKCXNom3HlyL8="; 16 }; 17 }; 18 common = pname: { version, sha256, beta ? null }: ··· 74 "misc/composer/clean-xhprof.sh" 75 "misc/cron/archive.sh" 76 "plugins/Installation/FormDatabaseSetup.php" 77 "vendor/pear/archive_tar/sync-php4" 78 "vendor/szymach/c-pchart/coverage.sh" 79 + "vendor/matomo/matomo-php-tracker/run_tests.sh" 80 "vendor/twig/twig/drupal_test.sh" 81 ]; 82 ··· 91 length="$(wc -c "$f" | cut -d' ' -f1)" 92 hash="$(md5sum "$f" | cut -d' ' -f1)" 93 sed -i "s:\\(\"$f\"[^(]*(\\).*:\\1\"$length\", \"$hash\"),:g" config/manifest.inc.php 94 + else 95 + echo "INFO(files-to-fix): $f does not exist in this version" 96 fi 97 done 98 popd > /dev/null