From 2c14ff343bef51d3dd0d9b5e6012cad9272ea6ce Mon Sep 17 00:00:00 2001 From: Gavin Morris Date: Fri, 26 Jan 2024 14:39:07 -0500 Subject: [PATCH 1/3] Matomo upgrade to 5.x --- matomo/Dockerfile | 8 +++--- matomo/Dockerfile-e | 63 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 matomo/Dockerfile-e diff --git a/matomo/Dockerfile b/matomo/Dockerfile index 89487d27..b6ba7796 100644 --- a/matomo/Dockerfile +++ b/matomo/Dockerfile @@ -3,15 +3,15 @@ FROM nginx ARG TARGETARCH -ARG MATOMO_VERSION="4.16.0" +ARG MATOMO_VERSION="5.0.1" ARG MATOMO_FILE="${MATOMO_VERSION}.tar.gz" ARG MATOMO_URL="https://builds.matomo.org/matomo-${MATOMO_FILE}" -ARG MATOMO_SHA256="385653e35f795935b0d97340c8688d8b15ba85234a0b72320696b990cf4f0959" +ARG MATOMO_SHA256="e1db485229da10fb6e11a6a781d95a22cc34c5db86e0079411a214274209f03c" -ARG EXTRA_TOOLS_VERSION="4.1.0-beta5" +ARG EXTRA_TOOLS_VERSION="5.0.0-beta3" ARG EXTRA_TOOLS_FILE="${EXTRA_TOOLS_VERSION}.tar.gz" ARG EXTRA_TOOLS_URL="https://github.com/digitalist-se/extratools/archive/refs/tags/${EXTRA_TOOLS_FILE}" -ARG EXTRA_TOOLS_SHA256="ce9c9f1d01aaf04e3dfded21d6b9080c1fda633535295dc1c8cd0427bcdc826f" +ARG EXTRA_TOOLS_SHA256="96190d6392bc45332eb9033216ea4c436e71496b48ee9a23d4647934d8051cae" EXPOSE 8000 diff --git a/matomo/Dockerfile-e b/matomo/Dockerfile-e new file mode 100644 index 00000000..39cef787 --- /dev/null +++ b/matomo/Dockerfile-e @@ -0,0 +1,63 @@ +# syntax=docker/dockerfile:1.5.1 +FROM nginx + +ARG TARGETARCH + +ARG MATOMO_VERSION="5.0.1" +ARG MATOMO_FILE="${MATOMO_VERSION}.tar.gz" +ARG MATOMO_URL="https://builds.matomo.org/matomo-${MATOMO_FILE}" +ARG MATOMO_SHA256="e1db485229da10fb6e11a6a781d95a22cc34c5db86e0079411a214274209f03c" + +ARG EXTRA_TOOLS_VERSION="5.0.0-beta3" +ARG EXTRA_TOOLS_FILE="${EXTRA_TOOLS_VERSION}.tar.gz" +ARG EXTRA_TOOLS_URL="https://github.com/digitalist-se/extratools/archive/refs/tags/${EXTRA_TOOLS_FILE}" +ARG EXTRA_TOOLS_SHA256="" + +EXPOSE 8000 + +WORKDIR /var/www/matomo + +# Composer require statements are for supporting the Extra Tools plugin. +# +# Platform agnostic does not require arch specific identifier. +RUN --mount=type=cache,id=matomo-downloads-${TARGETARCH},sharing=locked,target=/opt/downloads \ + download.sh \ + --url "${MATOMO_URL}" \ + --sha256 "${MATOMO_SHA256}" \ + --strip \ + --dest /var/www/matomo \ + && \ + wget --directory-prefix=/var/www/matomo "https://raw.githubusercontent.com/matomo-org/matomo/${MATOMO_VERSION}/composer.json" && \ + wget --directory-prefix=/var/www/matomo "https://raw.githubusercontent.com/matomo-org/matomo/${MATOMO_VERSION}/composer.lock" && \ + composer require -d /var/www/matomo symfony/yaml:~2.6.0 && \ + composer require -d /var/www/matomo symfony/process:^5.4 && \ + composer install -d /var/www/matomo && \ + download.sh \ + --url "${EXTRA_TOOLS_URL}" \ + --sha256 "${EXTRA_TOOLS_SHA256}" \ + --strip \ + --dest /var/www/matomo/plugins/ExtraTools && \ + cleanup.sh + +# The driver is given explicitly to prevent accidentially overriding as Matomo +# only supports MySQL. +ENV \ + MATOMO_ASSUME_SECURE_PROTOCOL=1 \ + MATOMO_DB_DRIVER=mysql \ + MATOMO_DB_NAME=matomo \ + MATOMO_DB_PASSWORD=password \ + MATOMO_DB_USER=matomo \ + MATOMO_DEFAULT_HOST=https://islandora.traefik.me \ + MATOMO_DEFAULT_NAME=Islandora \ + MATOMO_DEFAULT_TIMEZONE=America/Halifax \ + MATOMO_FORCE_SSL=1 \ + MATOMO_PROXY_CLIENT_HEADERS=HTTP_X_FORWARDED_FOR \ + MATOMO_PROXY_HOST_HEADERS=HTTP_X_FORWARDED_HOST \ + MATOMO_PROXY_URI_HEADER=1 \ + MATOMO_USER_EMAIL=admin@example.org \ + MATOMO_USER_NAME=admin \ + MATOMO_USER_PASS=password + +COPY --link rootfs / + +RUN chown -R nginx:nginx /var/www From bc16f1d5168b3585256c0e225e4ba1c24c55e32a Mon Sep 17 00:00:00 2001 From: Gavin Morris Date: Fri, 26 Jan 2024 14:44:29 -0500 Subject: [PATCH 2/3] Removing fragment --- matomo/Dockerfile-e | 63 --------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 matomo/Dockerfile-e diff --git a/matomo/Dockerfile-e b/matomo/Dockerfile-e deleted file mode 100644 index 39cef787..00000000 --- a/matomo/Dockerfile-e +++ /dev/null @@ -1,63 +0,0 @@ -# syntax=docker/dockerfile:1.5.1 -FROM nginx - -ARG TARGETARCH - -ARG MATOMO_VERSION="5.0.1" -ARG MATOMO_FILE="${MATOMO_VERSION}.tar.gz" -ARG MATOMO_URL="https://builds.matomo.org/matomo-${MATOMO_FILE}" -ARG MATOMO_SHA256="e1db485229da10fb6e11a6a781d95a22cc34c5db86e0079411a214274209f03c" - -ARG EXTRA_TOOLS_VERSION="5.0.0-beta3" -ARG EXTRA_TOOLS_FILE="${EXTRA_TOOLS_VERSION}.tar.gz" -ARG EXTRA_TOOLS_URL="https://github.com/digitalist-se/extratools/archive/refs/tags/${EXTRA_TOOLS_FILE}" -ARG EXTRA_TOOLS_SHA256="" - -EXPOSE 8000 - -WORKDIR /var/www/matomo - -# Composer require statements are for supporting the Extra Tools plugin. -# -# Platform agnostic does not require arch specific identifier. -RUN --mount=type=cache,id=matomo-downloads-${TARGETARCH},sharing=locked,target=/opt/downloads \ - download.sh \ - --url "${MATOMO_URL}" \ - --sha256 "${MATOMO_SHA256}" \ - --strip \ - --dest /var/www/matomo \ - && \ - wget --directory-prefix=/var/www/matomo "https://raw.githubusercontent.com/matomo-org/matomo/${MATOMO_VERSION}/composer.json" && \ - wget --directory-prefix=/var/www/matomo "https://raw.githubusercontent.com/matomo-org/matomo/${MATOMO_VERSION}/composer.lock" && \ - composer require -d /var/www/matomo symfony/yaml:~2.6.0 && \ - composer require -d /var/www/matomo symfony/process:^5.4 && \ - composer install -d /var/www/matomo && \ - download.sh \ - --url "${EXTRA_TOOLS_URL}" \ - --sha256 "${EXTRA_TOOLS_SHA256}" \ - --strip \ - --dest /var/www/matomo/plugins/ExtraTools && \ - cleanup.sh - -# The driver is given explicitly to prevent accidentially overriding as Matomo -# only supports MySQL. -ENV \ - MATOMO_ASSUME_SECURE_PROTOCOL=1 \ - MATOMO_DB_DRIVER=mysql \ - MATOMO_DB_NAME=matomo \ - MATOMO_DB_PASSWORD=password \ - MATOMO_DB_USER=matomo \ - MATOMO_DEFAULT_HOST=https://islandora.traefik.me \ - MATOMO_DEFAULT_NAME=Islandora \ - MATOMO_DEFAULT_TIMEZONE=America/Halifax \ - MATOMO_FORCE_SSL=1 \ - MATOMO_PROXY_CLIENT_HEADERS=HTTP_X_FORWARDED_FOR \ - MATOMO_PROXY_HOST_HEADERS=HTTP_X_FORWARDED_HOST \ - MATOMO_PROXY_URI_HEADER=1 \ - MATOMO_USER_EMAIL=admin@example.org \ - MATOMO_USER_NAME=admin \ - MATOMO_USER_PASS=password - -COPY --link rootfs / - -RUN chown -R nginx:nginx /var/www From 48562c209007b5b3f2cb4a6700ff2e4fba86a3ed Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Tue, 30 Jan 2024 02:40:45 +0100 Subject: [PATCH 3/3] Need to set the trusted host in latest version of Matomo. --- matomo/rootfs/etc/s6-overlay/scripts/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matomo/rootfs/etc/s6-overlay/scripts/install.sh b/matomo/rootfs/etc/s6-overlay/scripts/install.sh index 266db3d7..c1f0a28a 100755 --- a/matomo/rootfs/etc/s6-overlay/scripts/install.sh +++ b/matomo/rootfs/etc/s6-overlay/scripts/install.sh @@ -52,6 +52,7 @@ function install { s6-setuidgid nginx /var/www/matomo/console plugin:activate ExtraTools # Add additional configurations. + add_setting General "trusted_hosts[]" "${MATOMO_DEFAULT_HOST}" add_setting General "assume_secure_protocol" "${MATOMO_ASSUME_SECURE_PROTOCOL}" add_setting General "proxy_client_headers[]" "${MATOMO_PROXY_CLIENT_HEADERS}" add_setting General "proxy_host_headers" "${MATOMO_PROXY_HOST_HEADERS}" @@ -63,6 +64,7 @@ function install { # shellcheck disable=SC2001 name=$(echo "${site}" | sed -e 's/MATOMO_SITE_\(.*\)_HOST/\1/') s6-setuidgid nginx /var/www/matomo/console site:add --name="${name}" --urls="${!site}" + add_setting General "trusted_hosts[]" "${!site}" done }