Merge "Puppet ethpad-lite DB backups."

This commit is contained in:
Jenkins 2012-06-05 15:06:53 +00:00 committed by Gerrit Code Review
commit 8e33d65b55
4 changed files with 43 additions and 2 deletions

View File

@ -374,8 +374,9 @@ MySQL
^^^^^
MySQL is configured by the Puppet module to allow user ``eplite`` to use
database ``etherpad-lite``. This module does not configure backups for the
``etherpad-lite`` database.
database ``etherpad-lite``. If you want backups for the ``etherpad-lite``
database you can include ``etherpad_lite::backup``. By default this will backup
the ``etherpad-lite`` DB daily and keep a rotation of 30 days of backups.
.. rubric:: Footnotes
.. [1] `Lodgeit homepage <http://www.pocoo.org/projects/lodgeit/>`_

View File

@ -423,6 +423,7 @@ node 'etherpadlite.openstack.org' {
}
include etherpad_lite::site
include etherpad_lite::mysql
include etherpad_lite::backup
}
# A bare machine, but with a jenkins user

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']
}
}