From 10c3316671e2e8c0cad134f363be0d5dabfe945987282972065bdf4530904010 Mon Sep 17 00:00:00 2001 From: Eric Schirra Date: Tue, 20 Nov 2018 14:54:10 +0000 Subject: [PATCH] Accepting request 650512 from home:ecsos:server - Update to 3.7.0 This is an update and security release. Detail changelog see: https://matomo.org/changelog/matomo-3-7-0/ - Remove verification for systemd - Add systemd-timer for auto archiving of reports. Now you can use cron or systemd.timer. - Add core:update during update of package - Add logrotate - Add rpmlintrc - Upgrade README.SUSE OBS-URL: https://build.opensuse.org/request/show/650512 OBS-URL: https://build.opensuse.org/package/show/network:utilities/matomo?expand=0&rev=14 --- matomo-3.7.0.tar.gz | 3 ++ matomo-README.SUSE | 6 +++ matomo-archive.cron | 9 ++++ matomo-archive.service | 10 ++++ matomo-archive.timer | 10 ++++ matomo.changes | 18 +++++++ matomo.logrotate | 10 ++++ matomo.rpmlintrc | 10 +++- matomo.spec | 103 ++++++++++++++++++++++++----------------- piwik.zip | 3 -- 10 files changed, 135 insertions(+), 47 deletions(-) create mode 100644 matomo-3.7.0.tar.gz create mode 100644 matomo-archive.cron create mode 100644 matomo-archive.service create mode 100644 matomo-archive.timer create mode 100644 matomo.logrotate delete mode 100644 piwik.zip diff --git a/matomo-3.7.0.tar.gz b/matomo-3.7.0.tar.gz new file mode 100644 index 0000000..cb6b260 --- /dev/null +++ b/matomo-3.7.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1876d4c3cf03b65e1ffbeda9e876e006dd4aedea6e86875f5c22ec9c3873afa5 +size 16437059 diff --git a/matomo-README.SUSE b/matomo-README.SUSE index e7051c2..813fa80 100644 --- a/matomo-README.SUSE +++ b/matomo-README.SUSE @@ -42,3 +42,9 @@ e) php To prevent some critical issue, you must set the following in your php.ini file: always_populate_raw_post_data=-1 After making this change, restart your web server + +f) auto archiving +For autoarchiving you have two options. +With cron or with systemd.timer. +For cron you must uncomment the line in /etc/cron.d/matomo-archive +For systemd.timer you must start and enable matomo-archive.timer diff --git a/matomo-archive.cron b/matomo-archive.cron new file mode 100644 index 0000000..431e9fe --- /dev/null +++ b/matomo-archive.cron @@ -0,0 +1,9 @@ +# +# cron for matomo Auto-Archiving of Your Reports +# + +# without CLI +#5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log + +# with CLI +5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/console core:archive --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log diff --git a/matomo-archive.service b/matomo-archive.service new file mode 100644 index 0000000..595151a --- /dev/null +++ b/matomo-archive.service @@ -0,0 +1,10 @@ +[Unit] +Description=Auto-Archiving of matomo Reports + +[Service] +Type=oneshot +User=wwwrun +Group=www +ExecStart=/bin/bash -ce "/usr/bin/php /srv/www/matomo/console core:archive --url=http://localhost/matomo/ >> /var/log/matomo/matomo-archive.log 2>&1" +#StandardOutput=file:/var/log/matomo/matomo-archive.log +#StandardError=file:/var/log/matomo/matomo-archive.log diff --git a/matomo-archive.timer b/matomo-archive.timer new file mode 100644 index 0000000..db4e8d0 --- /dev/null +++ b/matomo-archive.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Auto-Archiving of matomo Reports + +[Timer] +OnCalendar=*-*-* *:05:00 +AccuracySec=12h +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/matomo.changes b/matomo.changes index 781bac0..2a63f45 100644 --- a/matomo.changes +++ b/matomo.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Tue Nov 20 06:49:47 UTC 2018 - ecsos@opensuse.org + +- Update to 3.7.0 + This is an update and security release. + Detail changelog see: https://matomo.org/changelog/matomo-3-7-0/ + +------------------------------------------------------------------- +Sat Nov 17 11:23:15 UTC 2018 - ecsos@opensuse.org + +- Remove verification for systemd +- Add systemd-timer for auto archiving of reports. + Now you can use cron or systemd.timer. +- Add core:update during update of package +- Add logrotate +- Add rpmlintrc +- Upgrade README.SUSE + ------------------------------------------------------------------- Fri Oct 19 10:41:59 UTC 2018 - ecsos@opensuse.org diff --git a/matomo.logrotate b/matomo.logrotate new file mode 100644 index 0000000..5d90364 --- /dev/null +++ b/matomo.logrotate @@ -0,0 +1,10 @@ +/var/log/matomo/matomo-archive.log +{ +su wwwrun www +rotate 30 +daily +missingok +notifempty +delaycompress +compress +} diff --git a/matomo.rpmlintrc b/matomo.rpmlintrc index 0336a27..a7e0659 100644 --- a/matomo.rpmlintrc +++ b/matomo.rpmlintrc @@ -1,3 +1,11 @@ # Output filters addFilter("hidden-file-or-dir") -addFilter("macro-in-comment") \ No newline at end of file +addFilter("macro-in-comment") +addFilter("suse-missing-rclink matomo-archive") +addFilter("non-etc-or-var-file-marked-as-conffile /usr/lib/systemd/system/matomo-archive.service") +addFilter("non-etc-or-var-file-marked-as-conffile /usr/lib/systemd/system/matomo-archive.timer") +addFilter("zero-length /srv/www/matomo/plugins/Morpheus/stylesheets/base/font.css") +addFilter("pem-certificate") +addFilter("non-conffile-in-etc /etc/matomo/environment/dev.php") +addFilter("non-conffile-in-etc /etc/matomo/environment/test.php") +addFilter("non-conffile-in-etc /etc/matomo/environment/ui-test.php") diff --git a/matomo.spec b/matomo.spec index 9c93901..04f9592 100644 --- a/matomo.spec +++ b/matomo.spec @@ -30,41 +30,47 @@ %define ap_grp nogroup %endif -%if 0%{?suse_version} >= 1210 -%define has_systemd 1 -%endif - Name: matomo -Version: 3.6.1 +Version: 3.7.0 Release: 0 Summary: Web analytics platform -License: GPL-2.0-only +License: GPL-3.0-or-later Group: Productivity/Networking/Web/Utilities Url: http://matomo.org/ -Source0: http://builds.matomo.org/piwik.zip -Source1: %{name}.conf -Source2: %{name}-README.SUSE +Source0: http://builds.matomo.org/%{name}-%{version}.tar.gz +Source2: %{name}.conf +Source3: %{name}.logrotate +Source4: %{name}-README.SUSE +Source10: %{name}-archive.cron +Source11: %{name}-archive.service +Source12: %{name}-archive.timer Source99: %{name}.rpmlintrc BuildArch: noarch +Requires(post): shadow +Requires(post): user(wwwrun) +Requires(post): group(www) BuildRequires: apache2-devel BuildRequires: cron BuildRequires: fdupes +BuildRequires: logrotate BuildRequires: mariadb -%if 0%{?has_systemd} +BuildRequires: php-json +BuildRequires: php-mbstring +BuildRequires: php-pdo BuildRequires: systemd -%{?systemd_requires} -%else -PreReq: %insserv_prereq -%endif BuildRequires: unzip Requires: apache2 Requires: cron +Requires: logrotate Requires: mariadb Requires: mod_php_any >= 5.5.9 Requires: php-curl Requires: php-gd Requires: php-json +Requires: php-mbstring Requires: php-mysql +Requires: php-pdo +%{?systemd_requires} Recommends: php-geoip Recommends: apache2-mod_geoip @@ -76,8 +82,8 @@ insights into a website's visitors and marketing campaigns, so the strategy and online experience of visitors may be optimized. %prep -%setup -q -n piwik -install -m644 %{SOURCE2} README.SUSE +%setup -q -n matomo +install -m644 %{SOURCE4} README.SUSE # remove unwanted files find . -type f -name .htaccess -delete find . -type f -name .travis.sh -delete @@ -87,8 +93,7 @@ find . -type f "(" -name "*.c" -o -name "*.h" ")" -delete find . -type f -exec sed -i -e 's|\/usr\/bin\/env php|\/usr\/bin\/php|g' {} \; %build -#%%configure -#make %%{?_smp_mflags} +# nothing to build %install # make directories @@ -99,56 +104,68 @@ install -d -m0755 %{buildroot}/%{_defaultdocdir}/%{name} mv *SUSE %{buildroot}/%{_defaultdocdir}/%{name} mv LEGALNOTICE %{buildroot}/%{_defaultdocdir}/%{name} mv LICENSE %{buildroot}/%{_defaultdocdir}/%{name} - mv "misc/How to install Matomo.html" %{buildroot}/%{_defaultdocdir}/%{name} mv *md %{buildroot}/%{_defaultdocdir}/%{name} cp -dR * %{buildroot}/%{ap_serverroot}/%{name} # install matomo.conf to apache conf.d -install -D -m0640 %{SOURCE1} %{buildroot}/%{ap_sysconfdir}/conf.d/%{name}.conf +install -D -m0640 %{SOURCE2} %{buildroot}/%{ap_sysconfdir}/conf.d/%{name}.conf +# install logrotate +install -D -m0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name} # move config to etc/matomo and make symlink mv %{buildroot}/%{ap_serverroot}/%{name}/config/* \ - %{buildroot}/%{_sysconfdir}/%{name} + %{buildroot}/%{_sysconfdir}/%{name} rm -d %{buildroot}/%{ap_serverroot}/%{name}/config ln -s %{_sysconfdir}/%{name} %{buildroot}/%{ap_serverroot}/%{name}/config -# install cronscript -install -d -m0755 %{buildroot}/%{_sysconfdir}/cron.d -install -d -m0755 %{buildroot}/var/log/%{name} -cat >>%{buildroot}%{_sysconfdir}/cron.d/%{name}-archive < /var/log/%{name}/%{name}-archive.log -# with CLI -5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/console core:archive --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log -EOF +# install cronscript and systemd-timer +install -d -m 0755 %{buildroot}/%{_sysconfdir}/cron.d +install -d -m 0755 %{buildroot}/var/log/%{name} +install -D -m 0644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}-archive +install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-archive.service +install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-archive.timer +sed -i -e 's|@ap_serverroot@|%{ap_serverroot}|g' %{buildroot}%{_unitdir}/%{name}-archive.service %fdupes %{buildroot}/%{_prefix} %fdupes %{buildroot}/srv +%pre +%service_add_pre matomo-archive.timer +%service_add_pre matomo-archive.service + %post chown -R %{ap_usr}:%{ap_grp} %{ap_serverroot}/%{name} -%if 0%{?has_systemd} +%service_add_post matomo-archive.timer +%service_add_post matomo-archive.service %service_add_post apache2.service -%else -%restart_on_update apache2 -%endif -# TODO -#if [ "$1" = 2 ]; then -# %%{_bindir}/php %%{ap_serverroot}/%%{name}/console core:update -#fi +# Update matomo if this is an upgrade $1 == 2 +echo "matomo: Update matomo:core..." +if [ $1 -gt 1 ]; then + su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'Tracker.record_statistics="0"'" + su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'General.maintenance_mode="1"'" + su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console core:update --yes" || : + su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'General.maintenance_mode="0"'" + su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'Tracker.record_statistics="1"'" + : +fi + +%preun +%service_del_preun matomo-archive.timer +%service_del_preun matomo-archive.service %postun -%if 0%{?has_systemd} +%service_del_postun matomo-archive.timer +%service_del_postun matomo-archive.service %service_del_postun apache2.service -%else -%restart_on_update apache2 -%endif %files %defattr(-,root,root,-) #%%doc README.SUSE CHANGELOG.md CONTRIBUTING.md LEGALNOTICE README.md SECURITY.md %dir %{_defaultdocdir}/%{name} %{_defaultdocdir}/%{name}/* -%config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive %config(noreplace) %{ap_sysconfdir}/conf.d/%{name}.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive +%config(noreplace) %{_unitdir}/%{name}-archive.service +%config(noreplace) %{_unitdir}/%{name}-archive.timer %dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name} %dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/environment %defattr(640,%{ap_usr},%{ap_grp},750) diff --git a/piwik.zip b/piwik.zip deleted file mode 100644 index b440740..0000000 --- a/piwik.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a0e1e8b310b79ea60b282cdf1ca504f5b5c105209f52add82ca73e391052c1cf -size 19560142