Puppet ethpad-lite DB backups.

Puppet will now add a cron job and configure logrotate to backup
etherpad-lite's MySQL DB daily and keep a months worth of backups.
These are the defaults and are slightly configurable through the
etherpad_lite::backup class.

Also configure log rotation for etherpad-lite's error.log and
access.log.

Change-Id: I30e0a4c8ee852e6621ee74744968d85696658608
This commit is contained in:
Clark Boylan 2012-06-04 21:49:48 +00:00
parent 022e155ec3
commit 5c00b92151
2 changed files with 39 additions and 0 deletions

26
manifests/backup.pp Normal file
View File

@ -0,0 +1,26 @@
class etherpad_lite::backup (
$minute = '0',
$hour = '0',
$day = '*',
$dest = "${etherpad_lite::base_log_dir}/${etherpad_lite::ep_user}/db.sql.gz",
$rotation = 'daily',
$num_backups = '30'
) {
cron { eplitedbbackup:
ensure => present,
command => "/usr/bin/mysqldump --defaults-file=/etc/mysql/debian.cnf --opt etherpad-lite | gzip -9 > ${dest}",
minute => $minute,
hour => $hour,
weekday => $day,
require => Package['mysql-server']
}
include logrotate
logrotate::file { 'eplitedb':
log => $dest,
options => ['nocompress', 'missingok', "rotate ${num_backups}", $rotation],
require => Cron['eplitedbbackup']
}
}

View File

@ -38,4 +38,17 @@ class etherpad_lite::site (
require => Class['etherpad_lite']
}
include logrotate
logrotate::file { 'epliteerror':
log => "${etherpad_lite::base_log_dir}/${etherpad_lite::ep_user}/error.log",
options => ['compress', 'delaycompress', 'missingok', 'rotate 7', 'daily', 'notifempty'],
require => Service['etherpad-lite']
}
logrotate::file { 'epliteaccess':
log => "${etherpad_lite::base_log_dir}/${etherpad_lite::ep_user}/access.log",
options => ['compress', 'delaycompress', 'missingok', 'rotate 7', 'daily', 'notifempty'],
require => Service['etherpad-lite']
}
}