2013-11-05 21:21:00 +01:00
|
|
|
class zulip_internal::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
|
|
|
|
"python-boto",
|
|
|
|
"lzop",
|
|
|
|
"pv",
|
|
|
|
]
|
|
|
|
package { $internal_postgres_packages: ensure => "installed" }
|
|
|
|
|
2013-04-22 17:24:28 +02:00
|
|
|
exec {"pip_wal-e":
|
|
|
|
command => "/usr/bin/pip install git+git://github.com/zbenjamin/wal-e.git#egg=wal-e",
|
|
|
|
creates => "/usr/local/bin/wal-e",
|
|
|
|
require => Package['python-pip', 'python-boto', 'python-argparse',
|
2013-05-23 21:07:35 +02:00
|
|
|
'python-gevent', 'lzop', 'pv'],
|
2013-04-22 17:24:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
file { "/usr/local/bin/env-wal-e":
|
|
|
|
ensure => file,
|
|
|
|
owner => "root",
|
|
|
|
group => "postgres",
|
|
|
|
mode => 750,
|
2013-11-05 21:21:00 +01:00
|
|
|
source => "puppet:///modules/zulip_internal/postgresql/env-wal-e",
|
2013-04-22 17:24:28 +02:00
|
|
|
}
|
|
|
|
|
2013-05-10 18:15:51 +02:00
|
|
|
file { "/usr/local/bin/pg_backup_and_purge.py":
|
|
|
|
ensure => file,
|
|
|
|
owner => "root",
|
|
|
|
group => "postgres",
|
|
|
|
mode => 754,
|
2013-11-05 21:21:00 +01:00
|
|
|
source => "puppet:///modules/zulip_internal/postgresql/pg_backup_and_purge.py",
|
2013-05-10 18:15:51 +02:00
|
|
|
require => File["/usr/local/bin/env-wal-e"],
|
|
|
|
}
|
|
|
|
|
2013-05-10 18:16:16 +02:00
|
|
|
cron { "pg_backup_and_purge":
|
|
|
|
command => "/usr/local/bin/pg_backup_and_purge.py",
|
|
|
|
ensure => present,
|
2013-08-28 20:54:16 +02:00
|
|
|
environment => "PATH=/bin:/usr/bin:/usr/local/bin",
|
2013-05-10 18:16:16 +02:00
|
|
|
hour => 5,
|
|
|
|
minute => 0,
|
|
|
|
target => "postgres",
|
|
|
|
user => "postgres",
|
|
|
|
require => [ File["/usr/local/bin/pg_backup_and_purge.py"], Package["postgresql-9.1", "python-dateutil"] ]
|
|
|
|
}
|
|
|
|
|
2013-07-26 23:00:23 +02:00
|
|
|
exec { "sysctl_p":
|
|
|
|
command => "/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf",
|
|
|
|
subscribe => File['/etc/sysctl.d/40-postgresql.conf'],
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-07 22:20:10 +01:00
|
|
|
}
|