]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/matomo/recipes/default.rb
Switch matomo archiver to use a systemd timer
[chef.git] / cookbooks / matomo / recipes / default.rb
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