Сервис приложения
Сервисы/Matomo (buildable)

Сервис Matomo (buildable)

Среда выполнения PHP для Matomo, собранная из вашего Git-репозитория, в котором закреплён релиз Matomo и лежат ваши плагины.

Этот сервис запускает ваш код: его образ собирается из Git-репозитория, а каждая сборка развёртывается в окружение.

В StackMaster

Как Matomo (buildable) работает в StackMaster

What Wodby sets up for Matomo on this service.

Image

The service runs the prebuilt wodby/matomo Apache image: Matomo's release, verified against its signature, on the Apache variant of wodby/php. Apache serves Matomo and passes PHP to PHP-FPM in the same container, on port 80. There is no build and no Git repository; a new image revision of the selected Matomo major brings Matomo's updates.

Plugins can be installed from Matomo's Marketplace. They are kept on the files volume, so every replica loads them and they survive new images.

Settings

Matomo writes its settings to config/config.ini.php. The image also writes config/common.config.ini.php on every start, a layer Matomo reads but never writes:

  • Database. DB_HOST, DB_PORT, DB_NAME, DB_USERNAME and DB_PASSWORD from the db link, with the matomo_ table prefix. The password is never copied into config.ini.php.
  • Salt. MATOMO_SALT, generated once for the app. It is mixed into every password hash, API token and session: never change it.
  • Trusted hosts. Every route of the app (WODBY_HOSTS).
  • Proxy. HTTPS when the main route uses it, and the client address from X-Forwarded-For, because TLS ends before the request reaches the container.
  • Installer and updates. The web installer and Matomo's own updater are off; the image brings the code.
  • Archiving. Reports are archived by the hourly cron job, not when someone views them.

Data

The files volume is mounted at /mnt/files and shared by every replica and the cron job through the linked storage service. It holds config.ini.php (plugin activation and every setting saved in Matomo), custom logos (misc/user) and Marketplace plugins. Matomo's cache stays in each container. The database holds reports, visits and users; sessions are kept in the database.

Installation and updates

On every deployment the Install or update Matomo action runs matomo-update in a job of the new version, before its pods are replaced (on the first deployment, right after the install):

  • First deployment: it installs Matomo into the empty database, as the web installer would. The superuser comes from the service's settings: admin-username (default admin, MATOMO_ADMIN_USERNAME), admin-password (required, secret, MATOMO_ADMIN_PASSWORD) and admin-email (required, MATOMO_ADMIN_EMAIL). When website-url (MATOMO_SITE_URL) is set, the first website is added with the app's title as its name; otherwise Matomo asks for a website at the first sign-in.
  • Without an admin password or email, the action fails and installs nothing.
  • The installation never runs over existing tables: if the database has tables but config.ini.php is missing, the action fails instead.
  • Later deployments: it runs php console core:update --yes. The previous version keeps serving on the updated database until the new one is ready. If the update fails, the deployment stops before the rollout.
  • Changing the admin settings after the first deployment does not change the account; change it in Matomo.

Archiving

The archive cron job runs php console core:archive at five past every hour. It also sends scheduled email reports and runs Matomo's other scheduled tasks.

Limits

  • Matomo 5 on PHP 8.4, with MariaDB or MySQL.
  • Plugins that change the tracker script matomo.js rebuild it in the container where they run; restart the service after activating one so every replica serves the new script.
  • No development workspace.

Check the result

  • Administration > System > Diagnostics shows Matomo's own checks.
  • php console diagnostics:run reports the state of the installation.
  • The deployment's log shows the install or update output, and the cron job's log the archiving.

Buildable Matomo on Wodby

This service is the matomo service built from the app's repository: its guidance applies to settings, data, installation and updates. This page covers what differs.

Image

The image is built from the app's Git repository on top of wodby/matomo-php: PHP-FPM and Apache with the same Wodby setup as the prebuilt Matomo image, but no Matomo. The service's versions are PHP versions. Start the repository from the Matomo boilerplate. It holds:

  • .matomo-version: the Matomo release to run, such as 5.14.2, required. The build installs it with matomo-install-release, which downloads it from builds.matomo.org, checks its signature and adds Wodby's parts: the WodbyInstall plugin, the GeoLite database, the .htaccess files and the links to the files volume. Matomo 5 releases are supported.
  • plugins/: the app's own plugins. The build copies each directory into Matomo's plugins directory and records its name. It fails when a directory has no plugin.json, or has the name of one of Matomo's own plugins.

Matomo's version changes only when the repository changes it: new image revisions bring PHP, Apache and Wodby's scripts, not a new Matomo. Upgrading Matomo means changing .matomo-version and deploying; the deployment updates the database.

Plugins

On every deployment the Install or update Matomo action runs matomo-update-app, before the new version rolls out (on the first deployment, right after the install). It installs or updates Matomo as the matomo service does, then:

  • activates every plugin from the repository;
  • deactivates the plugins the repository had at the previous deployment but no longer has. The list of deployed plugins is kept in config/app-plugins on the files volume.

A plugin from the repository can't stay deactivated: the next deployment activates it again. Remove it from the repository instead.

Plugins installed from Matomo's Marketplace work as on the matomo service: they are kept on the files volume and are not part of the repository.

Обзор

Технический профиль Matomo (buildable)

Здесь перечислены версии, которые можно выбрать для Matomo (buildable) в стеке или окружении. Сам сервис публикуется ревизиями, и стек ссылается на конкретную ревизию.

Тип сервиса

Сервис приложения

Версии

8.4

Постоянные тома

Files

Стеки

Стеки, в которые входит Matomo (buildable)

Matomo (buildable) входит в этот публичный стек. Можно создать приложение из публичного стека как есть или добавить сервис в собственный стек.

CI/CD

Сборка Matomo (buildable) из Git-репозитория

Начните с публичного шаблона проекта или подключите собственный репозиторий. В StackMaster CI push в ветку, за которой следит окружение, запускает сборку Matomo (buildable), а пайплайн её развёртывает.

Vanilla Matomo

Используйте его как есть или клонируйте в свой Git-аккаунт.

wodby/matomo-boilerplate

Git-провайдеры

Репозиторий подключается через интеграцию с его Git-провайдером.

CI-провайдеры

StackMaster CI встроен в платформу: пайплайн описывается в файле .wodby/pipeline.yml в репозитории. Для подключённого репозитория те же шаги может выполнять внешний CI-провайдер с помощью StackMaster CLI.

Реестры контейнеров

Собранные образы по умолчанию попадают в StackMaster Registry или во внешний реестр, подключённый как интеграция.

Переменные окружения из интеграций

Интеграция с переменными один раз сохраняет учётные данные стороннего сервиса. Подключите её к Matomo (buildable), и StackMaster передаст их в контейнер как переменные окружения во время работы, а не при сборке образа.

Конфигурация

Конфигурация сервиса Matomo (buildable)

Сервис Matomo (buildable) объявляет следующее. Если значение можно изменить, его задаёт стек, а каждое окружение может его переопределить.

Технические домены

StackMaster выдаёт каждому публичному HTTP-порту технический домен с TLS-сертификатом и продлевает сертификат. Порт, который сервис помечает как частный, домен не получает. Можно добавить собственные домены.

Тома

Files

Настройки

4 настройки, которые стек или окружение могут изменить.

Расписания cron

1 задача по расписанию. Каждый запуск создаёт задачу с логами.

Действия

1 действие. Действие — это команда, которую вы запускаете из панели управления или которую StackMaster выполняет после развёртывания или обновления стека.

Связи сервиса

Каждая связь — это подключение Matomo (buildable) к другому сервису. На какой сервис указывает связь, задаёт стек. На карточках перечислены публичные сервисы, которые подходят для каждой связи.

sendmail

Сервисы, которые подходят для этой связи