Puppet Class: profile::piwik::database

Defined in:
modules/profile/manifests/piwik/database.pp

Overview

SPDX-License-Identifier: Apache-2.0

Class: profile::piwik::database

Set up a simple mysql database for Piwik. This config is not standard (as in following Wikimedia's puppet classes) because of historic reasons, but it will refactored in the future. For the moment it contains the very basic configs added to the standard Debian mysql deployment.

Parameters:

  • database_port (Any) (defaults to: lookup('profile::piwik::database', { 'default_value' => 3306 }))
  • backup_hosts_ferm_range (Any) (defaults to: lookup('profile::piwik::database::backup_hosts_ferm_range', { 'default_value' => undef }))


9
10
11
12
13
14
15
16
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
# File 'modules/profile/manifests/piwik/database.pp', line 9

class profile::piwik::database(
    $database_port           = lookup('profile::piwik::database', { 'default_value' => 3306 }),
    $backup_hosts_ferm_range = lookup('profile::piwik::database::backup_hosts_ferm_range', { 'default_value' => undef }),
) {

    package { 'mysql-server':
        ensure => absent,
    }

    $mariadb_socket = '/run/mysqld/mysqld.sock'

    require profile::mariadb::packages_wmf
    include profile::mariadb::wmfmariadbpy
    include profile::mariadb::monitor::prometheus

    class { '::mariadb::config':
        config    => 'profile/piwik/my.cnf.erb',
        socket    => $mariadb_socket,
        port      => $database_port ,
        datadir   => '/var/lib/mysql',
        basedir   => $profile::mariadb::packages_wmf::basedir,
        read_only => false,
        ssl       => 'puppet-cert',
    }

    class { '::mariadb::service':
        ensure  => 'running',
        manage  => true,
        enable  => true,
        require => Class['mariadb::config'],
    }

    if $backup_hosts_ferm_range {
        ferm::service { 'mariadb':
            proto  => 'tcp',
            port   => $database_port,
            srange => $backup_hosts_ferm_range,
        }
    }
}