SHA256
1
0
forked from pool/matomo

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
This commit is contained in:
Eric Schirra 2018-11-20 14:54:10 +00:00 committed by Git OBS Bridge
parent d8922383f9
commit 10c3316671
10 changed files with 135 additions and 47 deletions

3
matomo-3.7.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1876d4c3cf03b65e1ffbeda9e876e006dd4aedea6e86875f5c22ec9c3873afa5
size 16437059

View File

@ -42,3 +42,9 @@ e) php
To prevent some critical issue, you must set the following in your php.ini file: To prevent some critical issue, you must set the following in your php.ini file:
always_populate_raw_post_data=-1 always_populate_raw_post_data=-1
After making this change, restart your web server 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

9
matomo-archive.cron Normal file
View File

@ -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

10
matomo-archive.service Normal file
View File

@ -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

10
matomo-archive.timer Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Auto-Archiving of matomo Reports
[Timer]
OnCalendar=*-*-* *:05:00
AccuracySec=12h
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -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 Fri Oct 19 10:41:59 UTC 2018 - ecsos@opensuse.org

10
matomo.logrotate Normal file
View File

@ -0,0 +1,10 @@
/var/log/matomo/matomo-archive.log
{
su wwwrun www
rotate 30
daily
missingok
notifempty
delaycompress
compress
}

View File

@ -1,3 +1,11 @@
# Output filters # Output filters
addFilter("hidden-file-or-dir") addFilter("hidden-file-or-dir")
addFilter("macro-in-comment") 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")

View File

@ -30,41 +30,47 @@
%define ap_grp nogroup %define ap_grp nogroup
%endif %endif
%if 0%{?suse_version} >= 1210
%define has_systemd 1
%endif
Name: matomo Name: matomo
Version: 3.6.1 Version: 3.7.0
Release: 0 Release: 0
Summary: Web analytics platform Summary: Web analytics platform
License: GPL-2.0-only License: GPL-3.0-or-later
Group: Productivity/Networking/Web/Utilities Group: Productivity/Networking/Web/Utilities
Url: http://matomo.org/ Url: http://matomo.org/
Source0: http://builds.matomo.org/piwik.zip Source0: http://builds.matomo.org/%{name}-%{version}.tar.gz
Source1: %{name}.conf Source2: %{name}.conf
Source2: %{name}-README.SUSE Source3: %{name}.logrotate
Source4: %{name}-README.SUSE
Source10: %{name}-archive.cron
Source11: %{name}-archive.service
Source12: %{name}-archive.timer
Source99: %{name}.rpmlintrc Source99: %{name}.rpmlintrc
BuildArch: noarch BuildArch: noarch
Requires(post): shadow
Requires(post): user(wwwrun)
Requires(post): group(www)
BuildRequires: apache2-devel BuildRequires: apache2-devel
BuildRequires: cron BuildRequires: cron
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: logrotate
BuildRequires: mariadb BuildRequires: mariadb
%if 0%{?has_systemd} BuildRequires: php-json
BuildRequires: php-mbstring
BuildRequires: php-pdo
BuildRequires: systemd BuildRequires: systemd
%{?systemd_requires}
%else
PreReq: %insserv_prereq
%endif
BuildRequires: unzip BuildRequires: unzip
Requires: apache2 Requires: apache2
Requires: cron Requires: cron
Requires: logrotate
Requires: mariadb Requires: mariadb
Requires: mod_php_any >= 5.5.9 Requires: mod_php_any >= 5.5.9
Requires: php-curl Requires: php-curl
Requires: php-gd Requires: php-gd
Requires: php-json Requires: php-json
Requires: php-mbstring
Requires: php-mysql Requires: php-mysql
Requires: php-pdo
%{?systemd_requires}
Recommends: php-geoip Recommends: php-geoip
Recommends: apache2-mod_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. strategy and online experience of visitors may be optimized.
%prep %prep
%setup -q -n piwik %setup -q -n matomo
install -m644 %{SOURCE2} README.SUSE install -m644 %{SOURCE4} README.SUSE
# remove unwanted files # remove unwanted files
find . -type f -name .htaccess -delete find . -type f -name .htaccess -delete
find . -type f -name .travis.sh -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' {} \; find . -type f -exec sed -i -e 's|\/usr\/bin\/env php|\/usr\/bin\/php|g' {} \;
%build %build
#%%configure # nothing to build
#make %%{?_smp_mflags}
%install %install
# make directories # make directories
@ -99,56 +104,68 @@ install -d -m0755 %{buildroot}/%{_defaultdocdir}/%{name}
mv *SUSE %{buildroot}/%{_defaultdocdir}/%{name} mv *SUSE %{buildroot}/%{_defaultdocdir}/%{name}
mv LEGALNOTICE %{buildroot}/%{_defaultdocdir}/%{name} mv LEGALNOTICE %{buildroot}/%{_defaultdocdir}/%{name}
mv LICENSE %{buildroot}/%{_defaultdocdir}/%{name} mv LICENSE %{buildroot}/%{_defaultdocdir}/%{name}
mv "misc/How to install Matomo.html" %{buildroot}/%{_defaultdocdir}/%{name} mv "misc/How to install Matomo.html" %{buildroot}/%{_defaultdocdir}/%{name}
mv *md %{buildroot}/%{_defaultdocdir}/%{name} mv *md %{buildroot}/%{_defaultdocdir}/%{name}
cp -dR * %{buildroot}/%{ap_serverroot}/%{name} cp -dR * %{buildroot}/%{ap_serverroot}/%{name}
# install matomo.conf to apache conf.d # 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 # move config to etc/matomo and make symlink
mv %{buildroot}/%{ap_serverroot}/%{name}/config/* \ mv %{buildroot}/%{ap_serverroot}/%{name}/config/* \
%{buildroot}/%{_sysconfdir}/%{name} %{buildroot}/%{_sysconfdir}/%{name}
rm -d %{buildroot}/%{ap_serverroot}/%{name}/config rm -d %{buildroot}/%{ap_serverroot}/%{name}/config
ln -s %{_sysconfdir}/%{name} %{buildroot}/%{ap_serverroot}/%{name}/config ln -s %{_sysconfdir}/%{name} %{buildroot}/%{ap_serverroot}/%{name}/config
# install cronscript # install cronscript and systemd-timer
install -d -m0755 %{buildroot}/%{_sysconfdir}/cron.d install -d -m 0755 %{buildroot}/%{_sysconfdir}/cron.d
install -d -m0755 %{buildroot}/var/log/%{name} install -d -m 0755 %{buildroot}/var/log/%{name}
cat >>%{buildroot}%{_sysconfdir}/cron.d/%{name}-archive <<EOF install -D -m 0644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}-archive
# without CLI install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-archive.service
#5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-archive.timer
# with CLI sed -i -e 's|@ap_serverroot@|%{ap_serverroot}|g' %{buildroot}%{_unitdir}/%{name}-archive.service
5 * * * * wwwrun %{_bindir}/php %{ap_serverroot}/%{name}/console core:archive --url=http://localhost/matomo/ > /var/log/%{name}/%{name}-archive.log
EOF
%fdupes %{buildroot}/%{_prefix} %fdupes %{buildroot}/%{_prefix}
%fdupes %{buildroot}/srv %fdupes %{buildroot}/srv
%pre
%service_add_pre matomo-archive.timer
%service_add_pre matomo-archive.service
%post %post
chown -R %{ap_usr}:%{ap_grp} %{ap_serverroot}/%{name} 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 %service_add_post apache2.service
%else # Update matomo if this is an upgrade $1 == 2
%restart_on_update apache2 echo "matomo: Update matomo:core..."
%endif if [ $1 -gt 1 ]; then
# TODO su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'Tracker.record_statistics="0"'"
#if [ "$1" = 2 ]; then su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'General.maintenance_mode="1"'"
# %%{_bindir}/php %%{ap_serverroot}/%%{name}/console core:update su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console core:update --yes" || :
#fi 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 %postun
%if 0%{?has_systemd} %service_del_postun matomo-archive.timer
%service_del_postun matomo-archive.service
%service_del_postun apache2.service %service_del_postun apache2.service
%else
%restart_on_update apache2
%endif
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
#%%doc README.SUSE CHANGELOG.md CONTRIBUTING.md LEGALNOTICE README.md SECURITY.md #%%doc README.SUSE CHANGELOG.md CONTRIBUTING.md LEGALNOTICE README.md SECURITY.md
%dir %{_defaultdocdir}/%{name} %dir %{_defaultdocdir}/%{name}
%{_defaultdocdir}/%{name}/* %{_defaultdocdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive
%config(noreplace) %{ap_sysconfdir}/conf.d/%{name}.conf %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}
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/environment %dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/environment
%defattr(640,%{ap_usr},%{ap_grp},750) %defattr(640,%{ap_usr},%{ap_grp},750)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a0e1e8b310b79ea60b282cdf1ca504f5b5c105209f52add82ca73e391052c1cf
size 19560142