Puppet Class: gitlab::backup
- Defined in:
- modules/gitlab/manifests/backup.pp
Overview
SPDX-License-Identifier: Apache-2.0
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'modules/gitlab/manifests/backup.pp', line 3
class gitlab::backup (
Wmflib::Ensure $ensure = 'present',
Wmflib::Ensure $full_ensure = 'present',
Wmflib::Ensure $partial_ensure = 'present',
Wmflib::Ensure $config_ensure = 'present',
Boolean $rsyncable_gzip = true,
Integer[1] $max_concurrency = 4,
Integer[1] $max_storage_concurrency = 1,
Integer[1] $backup_keep_time = 3,
Stdlib::Unixpath $backup_dir_data = '/srv/gitlab-backup',
Stdlib::Unixpath $backup_dir_config = '/etc/gitlab/config_backup',
Systemd::Timer::Schedule $full_backup_interval = {'start' => 'OnCalendar', 'interval' => '*-*-* 00:00:00'},
Systemd::Timer::Schedule $config_backup_interval = {'start' => 'OnCalendar', 'interval' => '*-*-* 00:00:00'},
Systemd::Timer::Schedule $partial_backup_interval = {'start' => 'OnCalendar', 'interval' => '*-*-* 00:00:00'},
) {
# install backup script
file { "${backup_dir_data}/gitlab-backup.sh":
ensure => present,
mode => '0744',
owner => 'root',
group => 'root',
content => template('gitlab/gitlab-backup.sh.erb') # TODO: remove, T254480
}
# systemd timer for full backups
systemd::timer::job { 'full-backup':
ensure => $full_ensure,
user => 'root',
description => 'GitLab full data backup',
command => "${backup_dir_data}/gitlab-backup.sh full",
interval => $full_backup_interval,
}
# systemd timer for partial backups
systemd::timer::job { 'partial-backup':
ensure => $partial_ensure,
user => 'root',
description => 'GitLab partial data backup',
command => "${backup_dir_data}/gitlab-backup.sh partial",
interval => $partial_backup_interval,
}
# systemd timer for config backups
systemd::timer::job { 'config-backup':
ensure => $config_ensure,
user => 'root',
description => 'GitLab config backup',
command => "${backup_dir_data}/gitlab-backup.sh config",
interval => $config_backup_interval,
}
# make sure only root can access backup folders
# create folder for latest backup
wmflib::dir::mkdir_p(["${backup_dir_data}/latest", "${backup_dir_config}/latest"], {
owner => 'root',
group => 'root',
mode => '0600',
})
}
|