2016-10-17 04:05:49 +02:00
|
|
|
class zulip_ops::postgres_common {
|
2013-11-05 19:53:13 +01:00
|
|
|
include zulip::postgres_common
|
2013-02-07 22:20:10 +01:00
|
|
|
|
2013-11-08 21:35:05 +01:00
|
|
|
$internal_postgres_packages = [# dependencies for our wal-e backup system
|
2018-08-13 21:29:40 +02:00
|
|
|
'lzop',
|
|
|
|
'pv',
|
|
|
|
'python3-pip',
|
|
|
|
'python-pip',
|
2019-06-26 07:06:59 +02:00
|
|
|
'python3-gevent',
|
2018-08-13 21:29:40 +02:00
|
|
|
'python-gevent',
|
2018-08-13 21:27:41 +02:00
|
|
|
]
|
2018-08-13 21:29:40 +02:00
|
|
|
package { $internal_postgres_packages: ensure => 'installed' }
|
2013-11-08 21:35:05 +01:00
|
|
|
|
2018-08-13 21:29:40 +02:00
|
|
|
exec {'pip_wal-e':
|
2017-08-11 01:37:43 +02:00
|
|
|
# On trusty, there is no python3-boto or python3-gevent package,
|
|
|
|
# so we keep our `wal-e` explicitly on Python 2 for now.
|
2018-08-13 21:29:40 +02:00
|
|
|
command => '/usr/bin/pip2 install git+git://github.com/zbenjamin/wal-e.git#egg=wal-e',
|
|
|
|
creates => '/usr/local/bin/wal-e',
|
2018-08-13 21:20:34 +02:00
|
|
|
require => Package['python-pip', 'python-boto', 'python-gevent',
|
2017-08-04 02:00:13 +02:00
|
|
|
'lzop', 'pv'],
|
2013-04-22 17:24:28 +02:00
|
|
|
}
|
|
|
|
|
2018-08-13 21:29:40 +02:00
|
|
|
cron { 'pg_backup_and_purge':
|
2018-08-13 21:20:34 +02:00
|
|
|
ensure => present,
|
2018-08-13 21:29:40 +02:00
|
|
|
command => '/usr/local/bin/pg_backup_and_purge',
|
|
|
|
environment => 'PATH=/bin:/usr/bin:/usr/local/bin',
|
2018-08-13 21:20:34 +02:00
|
|
|
hour => 5,
|
|
|
|
minute => 0,
|
2018-08-13 21:29:40 +02:00
|
|
|
target => 'postgres',
|
|
|
|
user => 'postgres',
|
2018-08-13 21:27:41 +02:00
|
|
|
require => [
|
2018-08-13 21:29:40 +02:00
|
|
|
File['/usr/local/bin/pg_backup_and_purge'],
|
2018-08-13 21:27:41 +02:00
|
|
|
Package[
|
|
|
|
"postgresql-${zulip::base::postgres_version}",
|
2018-08-13 21:29:40 +02:00
|
|
|
'python3-dateutil',
|
|
|
|
'python-dateutil'
|
2018-08-13 21:27:41 +02:00
|
|
|
]
|
|
|
|
]
|
2013-05-10 18:16:16 +02:00
|
|
|
}
|
|
|
|
|
2018-08-13 21:29:40 +02:00
|
|
|
exec { 'sysctl_p':
|
|
|
|
command => '/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf',
|
2018-08-13 21:20:34 +02:00
|
|
|
subscribe => File['/etc/sysctl.d/40-postgresql.conf'],
|
2013-07-26 23:00:23 +02:00
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-07 22:20:10 +01:00
|
|
|
}
|