From 95a2384f3e0c98cf1a83cf77387bd86bf53eb4c5 Mon Sep 17 00:00:00 2001 From: David Jennes Date: Sat, 28 Sep 2024 04:41:58 +0200 Subject: [PATCH] Matomo: try to fix scheduler issues --- matomo/Dockerfile | 3 +++ matomo/config/supervisor/conf.d/crond.conf | 11 +++++++++++ matomo/scripts/bootstrap.sh | 5 ++++- matomo/scripts/docker-entrypoint.sh | 5 ----- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 matomo/config/supervisor/conf.d/crond.conf diff --git a/matomo/Dockerfile b/matomo/Dockerfile index f024af7..8c33d79 100644 --- a/matomo/Dockerfile +++ b/matomo/Dockerfile @@ -17,6 +17,9 @@ COPY matomo/config/supervisor/conf.d/ /etc/supervisor/conf.d/ # - init COPY matomo/scripts/ / +# Configure cron +RUN echo "*/30 * * * * /usr/local/bin/php /var/www/html/console core:archive --verbose --no-interaction" > /etc/crontabs/www-data + # Clean Up WORKDIR /var/www/html EXPOSE 8080 diff --git a/matomo/config/supervisor/conf.d/crond.conf b/matomo/config/supervisor/conf.d/crond.conf new file mode 100644 index 0000000..3c55688 --- /dev/null +++ b/matomo/config/supervisor/conf.d/crond.conf @@ -0,0 +1,11 @@ +[program:php-fpm] +command=sh -c "crond -f || kill -s SIGQUIT $PPID" + +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +autorestart=false +startretries=0 +stopasgroup=true diff --git a/matomo/scripts/bootstrap.sh b/matomo/scripts/bootstrap.sh index 3fa8752..a7a613b 100755 --- a/matomo/scripts/bootstrap.sh +++ b/matomo/scripts/bootstrap.sh @@ -9,7 +9,7 @@ start_server() { # Start services /entrypoint.sh php-fpm & - nginx + nginx & sleep 2 } @@ -156,6 +156,9 @@ matomo_update_config() { "mail.encryption=\"$MATOMO_SMTP_ENCRYPTION\"" } +# Just in case, correct permissions +chown -R www-data:www-data . + # Only initialize if we do NOT have a config file if [ ! -f "$config_file" ]; then start_server diff --git a/matomo/scripts/docker-entrypoint.sh b/matomo/scripts/docker-entrypoint.sh index c94c242..a531439 100755 --- a/matomo/scripts/docker-entrypoint.sh +++ b/matomo/scripts/docker-entrypoint.sh @@ -8,7 +8,6 @@ set -euo pipefail if [ ! -e matomo.php ]; then tar cf - --one-file-system -C /usr/src/matomo . | tar xf - - chown -R www-data:www-data . fi @@ -19,10 +18,6 @@ fi if [ "$1" = 'serve' ]; then exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf -# Helper to run cron jobs -elif [ "$1" = 'scheduler' ]; then - exec php console core:archive --verbose --no-interaction - # Init script, for use in initContainers (for example) elif [ "$1" = 'init' ]; then exec /bootstrap.sh