Sign inSign up

timoreymann/matomo

By timoreymann

Updated about 2 years ago
Archived

Docker image to run matomo, including report archive cron job

Image
0

1.6K

timoreymann/matomo repository overview

Matomo Docker Image

LICENSE GitHub Release DockerHub Renovate Pipeline status


Matomo image based on php-app, customized to suit best for matomo, including report archive cron job

Features

  • Running as non-root
  • Includes matomo installation
  • Easy installation of plugins on startup or in build process
  • Installed maxminddb php extension for geoip functionality
  • Run report archive every hour in dedicated crons
  • Disabled update check
  • Immutable configuration file

Requirements

Configuration

Configuration is done via environment variables:

Environment VariableDescriptionDefaultPossible values
MATOMO_PLUGINS_TO_DEACTIVATEList of plugins to deactivate on startupNoneplugin names seperated by comma
MATOMO_PLUGINS_TO_INSTALLList of plugins to install, this either means activating an already installed plugin or downloading it from MarketplaceNoneplugin names seperated by comma
MATOMO_DATABASE_HOSTHost of the MySQL serverNoneMySQL database server host
MATOMO_DATABASE_USERNAMEUsername to authenticate to MySQL server withNoneMySQL database user username
MATOMO_DATABASE_PASSWORDPassword to authenticate to MySQL server withNoneMySQL database user password
MATOMO_DATABASE_DBNAMEName of the database on the MySQL server to useNoneMySQL database name
MATOMO_DATABASE_SCHEMADatabase specific schema to use for the databaseMariadbMariadb, Mysql
MATOMO_DATABASE_TABLES_PREFIXTable prefix to prepend to MySQL database tablesmatomo_any string or leave empty to omit
MATOMO_DATABASE_CHARSETCharset to use for MySQL database tablesutf8mb4any valid charset supported by your MySQL server
MATOMO_GENERAL_SALTSalt to add to hashed values (this should never be changed once it is used, as it will render data unusableNoneSalt to use for hashing
MATOMO_GENERAL_ASSUME_SECURE_PROTOCOLAssume all requests have been sent over HTTPs and suppress warnings about http urls (set this if your proxy terminates the SSL)falsefalse, true, 0, 1
MATOMO_GENERAL_FORCE_SSLEnforce https for all generated clients (set this if your proxy terminates the SSL)falsefalse, true, 0, 1
MATOMO_GENERAL_PROXY_CLIENT_HEADERSProxy client headers to acknowledgeNoneheader names seperated by comma
MATOMO_GENERAL_PROXY_HOST_HEADERSProxy host headers to acknowledgeNoneheader names seperated by comma
MATOMO_GENERAL_TRUSTED_HOSTSTrusted hosts for matomo user interface and APINonehost names seperated by comma
MATOMO_MAIL_ENABLEDEnable mail sending using matomofalsefalse, true, 0, 1
MATOMO_MAIL_HOSTHostname to use for sending mailsNoneHostname or IP address
MATOMO_MAIL_PORTPort to use for sending mails587any valid port number
MATOMO_MAIL_ENCRYPTIONEncryption to use for sending mailssslauto, ssl, TLS, none
MATOMO_MAIL_USERNAMEUsername to authenticate against mail serverNoneValid email or username
MATOMO_MAIL_PASSWORDPassword to authenticate against mail serverNonepassword or empty string in case the user has no password set
MATOMO_MAIL_TRANSPORTTransport to use for sending mailssmtpAny supported transport by matomo
MATOMO_AUTO_UPDATE_SCHEMATry to upgrade schema on start upfalsefalse, true, 0, 1
MATOMO_SETUP_COMPLETESet this to a truthy value to generate configuration file and skip setup assistantfalsefalse, true, 0, 1
MATOMO_MARKETPLACE_TOKEN(Optional) Token to authenticate plugin install requests with when loading from Marketplace (required for private & paid plugins)Noneany valid token for the matomo marketplace

Install plugins

On start up

If you want to install plugins on startup you can simply set the MATOMO_PLUGINS_TO_INSTALL env variable.

The plugins will be activated or if not installed already installed first from Marketplace.

In docker build

Use this docker image as a base and pre-install plugins, e.g:

FROM timoreymann/matomo
RUN matomo-download-pugin Swagger \
    && matomo-download-plugin BotTracker

When you run your image set MATOMO_PLUGINS_TO_INSTALL=Swagger,BotTracker.

This will only activate the plugins but not have to download them first.

Installation

  • Expose port 8080
  • Set environment variables as documented in Configuration
  • Run once with MATOMO_MATOMO_SETUP_COMPLETE=0
  • Complete the installer
  • Set MATOMO_SETUP_COMPLETE=1 and start up the container again
  • Enjoy!
Example docker run command
docker run --name matomo -p 8080:8080 -v ${PWD}:/app timoreymann/matomo

Usage

Web UI
  • Open your browser on the exposed port e.g. localhost:8080
Updating
  • The image is updated in case of any upstream changes to the php image or maxminddb extension, which results in new image on docker hub available for you
  • For matomo updates you can rely on the regular update procedure, also automated using renovate with a manual approval and review on every update

Motivation

Why not just using one of the official images?

  • first of all they run as root, which i don't like
  • on the other hand I would like to use nginx over apache, for performance, security reasons and personal preference
  • includes no cron for archiving, which dramatically speeds up the web ui
  • mutable matomo installation, i would like to not mount any files

Components

  • nginx
  • php-fpm
  • go binary for archiving reports every hour
  • shell script for generating php config and

Contributing

I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the configuration
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

To get started please read the Contribution Guidelines.

Development

Requirements
Alternatives

Tag summary

Content type

Image

Digest

sha256:694da6ab8

Size

214.7 MB

Last updated

about 2 years ago

docker pull timoreymann/matomo