Skip to content

Commit

Permalink
feat: multiple matomo archiver
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgarel authored and root committed Apr 18, 2024
1 parent 3cdf395 commit 305c018
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
4 changes: 4 additions & 0 deletions confs/matomo/matomo/archive-2.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ENV file called by matomo-archive@main.service
# This is for website archiving of openfoodfacts.org
MATOMO_OPTIONS="--force-idsites=2 --concurrent-archivers=0"

4 changes: 4 additions & 0 deletions confs/matomo/matomo/archive-5.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ENV file called by matomo-archive@main.service
# This is for generating archive of mobile app
MATOMO_OPTIONS="--force-idsites=5 --concurrent-archivers=0"

4 changes: 4 additions & 0 deletions confs/matomo/matomo/archive-main.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ENV file called by matomo-archive@main.service
# This is for main archive generation, that is excluding specific high traffic services
MATOMO_OPTIONS="--skip-idsites 5,2 --concurrent-archivers=0"

11 changes: 0 additions & 11 deletions confs/matomo/systemd/matomo-archive.timer

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=Archive matomo requests
Description=Archive matomo requests (for %i parameters)
Requires=mariadb.service

# email on failure
Expand All @@ -12,10 +12,12 @@ Environment=TZ=UTC
Type=oneshot
User=www-data
Group=www-data
ExecStart=/usr/bin/php /var/www/html/matomo/console core:archive --url=http://analytics.openfoodfacts.org/ -n --ignore-warn
StandardOutput=append:/var/log/matomo/matomo-archive.log
StandardError=append:/var/log/matomo/matomo-archive-err.log
# defines MATOMO_OPTIONS thanks to specific environment
EnvironmentFile=/etc/matomo/archive-%i.env
ExecStart=/usr/bin/php /var/www/html/matomo/console core:archive --url=http://analytics.openfoodfacts.org/ -n --ignore-warn ${MATOMO_OPTIONS}
StandardOutput=append:/var/log/matomo/matomo-archive-%i.log
StandardError=append:/var/log/matomo/matomo-archive-%i-err.log
# place a timeout for bad cases as this process sometimes hangs
# note: we have to use TimeoutStartSec as it's a Type=oneshot service
TimeoutStartSec=5h
TimeoutStartSec=5h40m

13 changes: 13 additions & 0 deletions confs/matomo/systemd/matomo-archive@.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Run Matomo archive process every 6h

[Timer]
# every 6h
OnBootSec=5m
# relaunch every 6h after activating
# this is correlated to a 5h40 timeout in the service
OnUnitActiveSec=6h

[Install]
WantedBy=timers.target

0 comments on commit 305c018

Please sign in to comment.