Skip to content

Commit

Permalink
Add support to manage backup cron job
Browse files Browse the repository at this point in the history
  • Loading branch information
b4ldr committed Sep 4, 2017
1 parent a0cd33d commit f1159cb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
11 changes: 11 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
$gitlab_workhorse = $::gitlab::gitlab_workhorse
$user = $::gitlab::user
$web_server = $::gitlab::web_server
$backup_cron_enable = $::gitlab::backup_cron_enable
$backup_cron_minute = $::gitlab::backup_cron_minute
$backup_cron_hour = $::gitlab::backup_cron_hour

# replicate $nginx to $mattermost_nginx if $mattermost_nginx_eq_nginx true
if $mattermost_nginx_eq_nginx {
Expand Down Expand Up @@ -170,4 +173,12 @@
mode => '0644',
}
}

if $backup_cron_enable {
cron {'gitlab backup':
command => '/usr/bin/gitlab-rake gitlab:backup:create CRON=1',
hour => $backup_cron_hour,
minute => $backup_cron_minute,
}
}
}
20 changes: 19 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,18 @@
# Default: undef
# Hash of 'high_availability' config parameters.
#
# [*backup_cron_enable*]
# Default: false
# Boolean to enable the daily backup cron job
#
# [*backup_cron_minute*]
# Default: 0
# The minute when to run the daily backup cron job
#
# [*backup_cron_hour*]
# Default: 2
# The hour when to run the daily backup cron job
#
# === Examples
#
# class { 'gitlab':
Expand Down Expand Up @@ -387,6 +399,9 @@
$gitlab_workhorse = undef,
$user = undef,
$web_server = undef,
$backup_cron_enable = false,
$backup_cron_minute = 0,
$backup_cron_hour = 2,
$custom_hooks = {},
) inherits ::gitlab::params {

Expand Down Expand Up @@ -451,6 +466,9 @@
if $web_server { validate_hash($web_server) }
if $high_availability { validate_hash($high_availability) }
if $manage_accounts { validate_hash($manage_accounts) }
validate_bool($backup_cron_enable)
validate_integer($backup_cron_minutei,59)
validate_integer($backup_cron_hour,23)
validate_hash($custom_hooks)

class { '::gitlab::install': } ->
Expand All @@ -460,7 +478,7 @@
contain gitlab::install
contain gitlab::config
contain gitlab::service

create_resources(gitlab::custom_hook, $custom_hooks)

}

0 comments on commit f1159cb

Please sign in to comment.