SHA256
1
0
forked from pool/matomo

Accepting request 855711 from home:ecsos:server

- Put apache configuration files in separate subpackages.
- Update cron, service, lograte files with apache macros.

OBS-URL: https://build.opensuse.org/request/show/855711
OBS-URL: https://build.opensuse.org/package/show/network:utilities/matomo?expand=0&rev=87
This commit is contained in:
Eric Schirra 2020-12-14 10:42:45 +00:00 committed by Git OBS Bridge
parent 1e6c73f8b0
commit f490eea24a
5 changed files with 39 additions and 18 deletions

View File

@ -3,7 +3,7 @@
#
# without CLI
#-5 * * * * wwwrun /usr/bin/php @apache_serverroot@/matomo/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log
#-5 * * * * @APACHE_USER@ /usr/bin/php @APACHE_SERVERROOT@/matomo/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log
# with CLI
-5 * * * * wwwrun /usr/bin/php @apache_serverroot@/matomo/console core:archive --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log
-5 * * * * @APACHE_USER@ /usr/bin/php @APACHE_SERVERROOT@/matomo/console core:archive --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log

View File

@ -3,8 +3,8 @@ Description=Auto-Archiving of matomo Reports
[Service]
Type=oneshot
User=wwwrun
Group=www
ExecStart=/bin/bash -ce "/usr/bin/php @apache_serverroot@/matomo/console core:archive --url=http://localhost/matomo/ >> /var/log/matomo/matomo-archive.log 2>&1"
User=@APACHE_USER@
Group=@APACHE_GROUP@
ExecStart=/bin/bash -ce "/usr/bin/php @APACHE_SERVERROOT@/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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Dec 14 10:02:54 UTC 2020 - ecsos <ecsos@opensuse.org>
- Put apache configuration files in separate subpackages.
- Update cron, service, lograte files with apache macros.
-------------------------------------------------------------------
Wed Dec 9 06:34:40 UTC 2020 - ecsos <ecsos@opensuse.org>

View File

@ -1,6 +1,6 @@
/var/log/matomo/matomo-archive.log
{
su wwwrun www
su @APACHE_USER@ @APACHE_GROUP@
rotate 30
daily
missingok

View File

@ -46,7 +46,6 @@ Requires(pre): group(www)
%else
Requires(pre): aaa_base
%endif
BuildRequires: apache2-devel
BuildRequires: apache-rpm-macros
BuildRequires: cron
BuildRequires: fdupes
@ -54,11 +53,9 @@ BuildRequires: logrotate
BuildRequires: mariadb
BuildRequires: unzip
BuildRequires: pkgconfig(systemd)
Requires: apache2
Requires: nodejs
Requires: python3
Requires: logrotate
Requires: mod_php_any >= 7.2.5
Requires: php-ctype
Requires: php-curl
Requires: php-dom
@ -79,7 +76,6 @@ Requires(pre): php
%{?systemd_requires}
Recommends: php-geoip
Recommends: php-openssl
Recommends: apache2-mod_geoip
Recommends: mariadb
Recommends: cron
Conflicts: piwik
@ -89,6 +85,18 @@ Matomo, formerly Piwik, is a web analytics platform that gives
insights into a website's visitors and marketing campaigns, so the
strategy and online experience of visitors may be optimized.
%package apache
Summary: Apache configuration for %{name}
Group: Productivity/Networking/Web/Utilities
BuildRequires: apache2
Requires: apache2
Requires: mod_php_any >= 7.2.5
Recommends: apache2-mod_geoip
Supplements: packageand(apache2:%name)
%description apache
This subpackage contains the Apache configuration files
%prep
%setup -q -n %{name}
%patch1 -p1
@ -146,6 +154,8 @@ sed -e 's|__matomo_web__|%{apache_serverroot}/%{name}|g' \
%{SOURCE2} > %{buildroot}/%{apache_sysconfdir}/conf.d/%{name}.conf
# install logrotate
install -D -m0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
sed -i -e 's|@APACHE_USER@|%{apache_user}|g' %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
sed -i -e 's|@APACHE_GROUP@|%{apache_group}|g' %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
# move config to etc/matomo and make symlink
mv %{buildroot}/%{apache_serverroot}/%{name}/config/* \
%{buildroot}/%{_sysconfdir}/%{name}
@ -158,8 +168,11 @@ install -D -m 0644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}-archiv
install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-archive.service
install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-archive.timer
install -D -m 0644 %{SOURCE14} %{buildroot}%{_tmpfilesdir}/%{name}.conf
sed -i -e 's|@apache_serverroot@|%{apache_serverroot}|g' %{buildroot}%{_sysconfdir}/cron.d/%{name}-archive
sed -i -e 's|@apache_serverroot@|%{apache_serverroot}|g' %{buildroot}%{_unitdir}/%{name}-archive.service
sed -i -e 's|@APACHE_USER@|%{apache_user}|g' %{buildroot}%{_sysconfdir}/cron.d/%{name}-archive
sed -i -e 's|@APACHE_SERVERROOT@|%{apache_serverroot}|g' %{buildroot}%{_sysconfdir}/cron.d/%{name}-archive
sed -i -e 's|@APACHE_USER@|%{apache_user}|g' %{buildroot}%{_unitdir}/%{name}-archive.service
sed -i -e 's|@APACHE_GROUP@|%{apache_group}|g' %{buildroot}%{_unitdir}/%{name}-archive.service
sed -i -e 's|@APACHE_SERVERROOT@|%{apache_serverroot}|g' %{buildroot}%{_unitdir}/%{name}-archive.service
# install changes for mariadb
install -D -m0644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/my.cnf.d/%{name}.my.cnf
@ -177,11 +190,11 @@ install -D -m0644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/my.cnf.d/%{name}.my.cn
if [ $1 -gt 1 ]; then
# Update matomo if this is an upgrade $1 == 2
echo "matomo: Update matomo:core..."
su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'Tracker.record_statistics="0"'" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'General.maintenance_mode="1"'" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console core:update --yes" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'General.maintenance_mode="0"'" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'Tracker.record_statistics="1"'" || :
su %{apache_user} -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'Tracker.record_statistics="0"'" || :
su %{apache_user} -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'General.maintenance_mode="1"'" || :
su %{apache_user} -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console core:update --yes" || :
su %{apache_user} -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'General.maintenance_mode="0"'" || :
su %{apache_user} -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'Tracker.record_statistics="1"'" || :
:
fi
@ -195,7 +208,6 @@ fi
%defattr(-,root,root,-)
%dir %{_defaultdocdir}/%{name}
%{_defaultdocdir}/%{name}/*
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive
%config(noreplace) %{_sysconfdir}/my.cnf.d/%{name}.my.cnf
@ -235,4 +247,7 @@ fi
%attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/matomo/matomo-php-tracker/run_tests.sh
%{apache_serverroot}/%{name}/*
%files apache
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%changelog