sbadia / puppet-gitlab

Puppet module for manage GitLab installation
http://forge.puppetlabs.com/sbadia/gitlab
GNU General Public License v3.0
131 stars 76 forks source link

Add option to enable a backup cron job #101

Closed igalic closed 10 years ago

igalic commented 10 years ago

We should add options

gitlab_backup       = false,
gitlab_backup_hours = '*/3',

Which enables a backup cron job, ala:

if $gitlab_backup {
  cron { 'backup-gitlab':
    command => '/usr/local/sbin/backup-gitlab.sh',
    user    => 'git',
    minute  => fqdn_rand(59),
    hour    => $gitlab_backup_hours,
    require => File['/usr/local/sbin/backup-gitlab.sh'],
  }
}

The file itself looks like so:

#!/bin/sh
export PATH=<%= @exec_path %>
cd /home/git/gitlab
rake RAILS_ENV=production gitlab:backup:create >/dev/null
igalic commented 10 years ago

After running this for a day, I now also know that we need to limit the time backups are kept.

By default, the time_keep settings in gitlab/config/gitlab.yaml is "forever":


  ## Backup settings
  backup:
    path: "tmp/backups"   # Relative paths are relative to Rails.root (default: tmp/backups/)
    # keep_time: 604800   # default: 0 (forever) (in seconds)

They suggest an example setting of one week. Perhaps this should scale with the frequency backups are made.

sbadia commented 10 years ago

Fixed by #115, thanks @igalic

igalic commented 10 years ago

\o/