1
2
3
4
5
6
7
8
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'modules/profile/manifests/mariadb/misc/multiinstance.pp', line 1
class profile::mariadb::misc::multiinstance (
Hash[String, Stdlib::Datasize] $instances = lookup('profile::mariadb::misc::multiinstance::instances'),
Hash[String, Stdlib::Port] $section_ports = lookup('profile::mariadb::section_ports'),
) {
require profile::mariadb::packages_wmf
class { 'mariadb::service':
override => "[Service]\nExecStartPre=/bin/sh -c \"echo 'mariadb main service is \
disabled, use mariadb@<instance_name> instead'; exit 1\"",
}
include ::profile::mariadb::mysql_role
include profile::mariadb::wmfmariadbpy
class { 'mariadb::config':
datadir => false,
basedir => $profile::mariadb::packages_wmf::basedir,
read_only => 'ON',
config => 'profile/mariadb/mysqld_config/misc_multiinstance.my.cnf.erb',
p_s => 'on',
ssl => 'puppet-cert',
binlog_format => 'ROW',
}
file { '/etc/mysql/mysqld.conf.d':
ensure => directory,
owner => root,
group => root,
mode => '0755',
}
$instances.each |$section, $buffer_pool| {
$port = $section_ports[$section]
if (!$port) {
fail("'${section}' is not a valid section.")
}
$prom_port = Integer("1${port}")
$template = $section ? {
default => undef,
'm3' => 'profile/mariadb/mysqld_config/phabricator_instance.my.cnf.erb',
}
mariadb::instance { $section:
port => $port,
innodb_buffer_pool_size => $buffer_pool,
template => $template,
}
profile::mariadb::section { $section: mention_alias => true }
profile::mariadb::ferm { $section: port => $port, }
profile::prometheus::mysqld_exporter_instance { $section: port => $prom_port }
if $section == 'm3' {
# stopwords are stored prersistently and backed up, so no need to load it every time
file { '/etc/mysql/phabricator-init.sql':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/profile/mariadb/phabricator-init.sql',
}
}
}
class { 'mariadb::monitor_disk':
is_critical => false,
}
class { 'mariadb::monitor_process':
process_count => length($instances),
is_critical => false,
}
}
|