Puppet Class: matomo

Defined in:
modules/matomo/manifests/init.pp

Overview

SPDX-License-Identifier: Apache-2.0

Class: matomo

Matomo (formerly Piwik) is an open-source analytics platform.

matomo.org/

Matomo's installation is meant to be executed manually using its UI, to initialize the database and generate the related config file. Therefore each new deployment from scratch will require some manual work, please keep it mind.

Misc: Q: Where did the deb package come from? A: debian.piwik.org, imported to apt.wikimedia.org

Parameters:

  • database_host (Any) (defaults to: 'localhost')
  • database_password (Any) (defaults to: undef)
  • database_username (Any) (defaults to: 'piwik')
  • admin_username (Any) (defaults to: undef)
  • admin_password (Any) (defaults to: undef)
  • password_salt (Any) (defaults to: undef)
  • trusted_hosts (Any) (defaults to: [])
  • piwik_username (Any) (defaults to: 'www-data')


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'modules/matomo/manifests/init.pp', line 17

class matomo (
    $database_host      = 'localhost',
    $database_password  = undef,
    $database_username  = 'piwik',
    $admin_username     = undef,
    $admin_password     = undef,
    $password_salt      = undef,
    $trusted_hosts      = [],
    $piwik_username     = 'www-data',
) {

    apt::package_from_component { 'matomo':
        component => 'thirdparty/matomo',
        packages  => ['matomo'],
    }

    # Prior to bookworm/matomo1003 we installed this package manually.
    # Once matomo1002 is decommissioned we will be able to remove this condition.
    if debian::codename::ge('bullseye') {
        package { 'matomo-plugin-marketingcampaignsreporting':
            require => Package['matomo'],
        }
    }

    $database_name = 'piwik'
    $database_table_prefix = 'piwik_'
    $proxy_client_headers = ['HTTP_X_FORWARDED_FOR']

    file { '/etc/matomo/config.ini.php':
        content => template('matomo/config.ini.php.erb'),
        owner   => $piwik_username,
        group   => $piwik_username,
        mode    => '0750',
        require => Package['matomo'],
    }

    file { '/var/log/matomo':
        ensure  => 'directory',
        owner   => $piwik_username,
        group   => $piwik_username,
        mode    => '0755',
        require => Package['matomo'],
    }

    # The TagManager plugin requires that the web server user have write access to
    # the /js directory in order that it can create its custom container javascript files.
    file { '/usr/share/matomo/js':
        ensure  => 'directory',
        owner   => 'root',
        group   => 'www-data',
        mode    => '0775',
        require => Package['matomo'],
    }
}