From 6a87f29688b46baa945304decaec7066de624d1f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 24 Nov 2022 22:36:54 +0000 Subject: [PATCH] Switch matomo archiver to use a systemd timer --- cookbooks/matomo/metadata.rb | 1 + cookbooks/matomo/recipes/default.rb | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cookbooks/matomo/metadata.rb b/cookbooks/matomo/metadata.rb index 6160ec17e..380cbbe43 100644 --- a/cookbooks/matomo/metadata.rb +++ b/cookbooks/matomo/metadata.rb @@ -10,3 +10,4 @@ depends "apache" depends "geoipupdate" depends "mysql" depends "php" +depends "systemd" diff --git a/cookbooks/matomo/recipes/default.rb b/cookbooks/matomo/recipes/default.rb index 2cbd469b6..a14a76954 100644 --- a/cookbooks/matomo/recipes/default.rb +++ b/cookbooks/matomo/recipes/default.rb @@ -199,8 +199,21 @@ apache_site "matomo.openstreetmap.org" do template "apache.erb" end -cron_d "matomo" do - minute "5" +systemd_service "matomo-archive" do + description "Matomo report archiving" + exec_start "/usr/bin/php /srv/matomo.openstreetmap.org/console core:archive --quiet --url=https://matomo.openstreetmap.org/" user "www-data" - command "/usr/bin/php /srv/matomo.openstreetmap.org/console core:archive --quiet --url=https://matomo.openstreetmap.org/" + sandbox true + memory_deny_write_execute false + restrict_address_families "AF_UNIX" + read_write_paths "/opt/matomo-#{version}/matomo/tmp" +end + +systemd_timer "matomo-archive" do + description "Matomo report archiving" + on_calendar "00:05" +end + +service "matomo-archive.timer" do + action [:enable, :start] end -- 2.43.2