Skip to content

Instantly share code, notes, and snippets.

@choyer
Created June 30, 2014 20:43
Show Gist options
  • Save choyer/01a65929ac7b0e618bcd to your computer and use it in GitHub Desktop.
Save choyer/01a65929ac7b0e618bcd to your computer and use it in GitHub Desktop.
Backup 4.x Whenever Schedule File for Gitlab Backup (should be in ./config/)
BACKUP_MODULE_PATH = File.absolute_path("/root/Backup")
CONFIG_FILE_PATH = File.absolute_path("config.rb").to_s
env :PATH, ENV['PATH']
set :environment, 'production'
env :S3_ACCESS_KEY_ID, "YOUR_S3_ACCESS_KEY_ID"
env :S3_SECRET_ACCESS_KEY, "YOUR_S3_SECRET_ACCESS_KEY"
env :PUSHOVER_USER_KEY, "YOUR_PUSHOVER_USER_KEY"
env :PUSHOVER_API_KEY, "YOUR_PUSHOVER_API_KEY"
every 1.day, :at => '1:00 am' do
command "cd /home/git/gitlab && bundle exec rake gitlab:backup:create RAILS_ENV=production"
end
every 1.day, :at => '2:00 am' do
command "cd #{BACKUP_MODULE_PATH} && backup perform --trigger daily_gitlab_backup --config-file #{CONFIG_FILE_PATH}"
end
every :sunday, :at => "2:20 am" do
command "cd #{BACKUP_MODULE_PATH} && backup perform --trigger weekly_gitlab_backup --config-file #{CONFIG_FILE_PATH}"
end
every 1.month, :at => '2:40 am' do
command "cd #{BACKUP_MODULE_PATH} && backup perform --trigger monthly_gitlab_backup --config-file #{CONFIG_FILE_PATH}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment