]> git.openstreetmap.org Git - chef.git/commitdiff
Switch matomo archiver to use a systemd timer
authorTom Hughes <tom@compton.nu>
Thu, 24 Nov 2022 22:36:54 +0000 (22:36 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 24 Nov 2022 22:37:15 +0000 (22:37 +0000)
cookbooks/matomo/metadata.rb
cookbooks/matomo/recipes/default.rb

index 6160ec17ec4c4f4ac94c5adfdb66f544c7c805d2..380cbbe430ac65face8029ebf8b5af4fb1ee7d46 100644 (file)
@@ -10,3 +10,4 @@ depends           "apache"
 depends           "geoipupdate"
 depends           "mysql"
 depends           "php"
+depends           "systemd"
index 2cbd469b6daf22fce16da80d72da9dd4c636b3ff..a14a76954bb9f80411020ff09d645b5d129737a9 100644 (file)
@@ -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