2016-10-17 04:05:49 +02:00
|
|
|
class zulip_ops::postgres_appdb {
|
2020-06-12 22:48:48 +02:00
|
|
|
include zulip_ops::base
|
2016-07-31 05:17:17 +02:00
|
|
|
include zulip::postgres_appdb_tuned
|
2013-07-25 20:56:23 +02:00
|
|
|
|
2020-06-12 22:48:48 +02:00
|
|
|
$common_packages = ['xfsprogs']
|
|
|
|
package { $common_packages: ensure => 'installed' }
|
|
|
|
|
|
|
|
$wal_g_version = '0.2.15'
|
|
|
|
$wal_g_hash = 'ea33c2341d7bfb203c6948590c29834c013ab06a28c7a2b236a73d906f785c84'
|
|
|
|
exec {'install-wal-g':
|
2020-06-13 02:42:40 +02:00
|
|
|
command => "${::zulip_scripts_path}/setup/install-wal-g.sh ${wal_g_version} ${wal_g_hash}",
|
2020-06-12 22:48:48 +02:00
|
|
|
creates => "/usr/local/bin/wal-g-${wal_g_version}",
|
|
|
|
}
|
|
|
|
file { '/usr/local/bin/wal-g':
|
|
|
|
ensure => 'link',
|
|
|
|
target => "/usr/local/bin/wal-g-${wal_g_version}",
|
|
|
|
}
|
|
|
|
cron { 'pg_backup_and_purge':
|
|
|
|
ensure => present,
|
|
|
|
command => '/usr/local/bin/pg_backup_and_purge',
|
|
|
|
environment => 'PATH=/bin:/usr/bin:/usr/local/bin',
|
|
|
|
hour => 5,
|
|
|
|
minute => 0,
|
|
|
|
target => 'postgres',
|
|
|
|
user => 'postgres',
|
|
|
|
require => [
|
|
|
|
File['/usr/local/bin/pg_backup_and_purge'],
|
|
|
|
Package[
|
|
|
|
"postgresql-${zulip::base::postgres_version}",
|
|
|
|
'python3-dateutil',
|
2020-07-14 00:03:39 +02:00
|
|
|
],
|
|
|
|
],
|
2020-06-12 22:48:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/sysctl.d/40-postgresql.conf':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
source => 'puppet:///modules/zulip_ops/postgresql/40-postgresql.conf',
|
|
|
|
}
|
|
|
|
exec { 'sysctl_p':
|
|
|
|
command => '/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf',
|
|
|
|
subscribe => File['/etc/sysctl.d/40-postgresql.conf'],
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/root/setup_disks.sh':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0744',
|
|
|
|
source => 'puppet:///modules/zulip_ops/postgresql/setup_disks.sh',
|
|
|
|
}
|
|
|
|
exec { 'setup_disks':
|
|
|
|
command => '/root/setup_disks.sh',
|
|
|
|
require => Package["postgresql-${zulip::base::postgres_version}", 'xfsprogs'],
|
|
|
|
unless => 'test $(readlink /var/lib/postgresql) = "/srv/postgresql/" -a -d /srv/postgresql',
|
|
|
|
}
|
|
|
|
|
2020-06-12 04:52:33 +02:00
|
|
|
file { "${zulip::postgres_appdb_base::postgres_confdir}/pg_hba.conf":
|
2018-08-13 21:20:34 +02:00
|
|
|
ensure => file,
|
2018-04-23 08:41:28 +02:00
|
|
|
require => Package["postgresql-${zulip::base::postgres_version}"],
|
2018-08-13 21:29:40 +02:00
|
|
|
owner => 'postgres',
|
|
|
|
group => 'postgres',
|
2018-08-13 21:20:34 +02:00
|
|
|
mode => '0640',
|
2018-08-13 21:29:40 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/postgresql/pg_hba.conf',
|
2013-07-25 20:56:23 +02:00
|
|
|
}
|
|
|
|
}
|