Skip to content

A simple script to backup Gitlab data. This script will backup the $gitlab_home/tmp/backups of your gitlab installation to a remote host if configured.

License

Notifications You must be signed in to change notification settings

iboxpay/auto-gitlab-backup

 
 

Repository files navigation

AutoGITBackup

http://sund.la/glup


A script to use gitlab's own backup rake command on a cron schedule and rsync to another server if wanted.

See the omnibus-master branch to use this with the gitlab-omnibus package.

Clone

clone to your directory of choice. I usually use /usr/local/sbin

Set up gitlab to expire backups

Change config/gitlab.yml to expire backups

remove the # from keep_time

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

Configure the script for remote copy

cp auto-gitlab-backup.conf.sample auto-gitlab-backup.conf

edit auto-gitlab-backup.conf

remoteUser="" #user account on remote server
remoteServer="" #remote host
remoteDest="" #remote path
sshKeyPath="" #path to an alternate ssh key, if needed.
remotePort=22 # ssh port
## only use the below settings if your destination is using rsync in daemon mode
remoteModule=""
rsync_password_file=""

cron settings

Example for crontab to run at 5:05am everyday.

5 5 * * * /usr/local/sbin/auto-gitlab-backup/auto-gitlab-backup.sh

restore a backup

Still under development but useful

run ./restoreGitLab.sh -r and it will attempt to restore a backup. You may have to run some rake commands manually.

About

A simple script to backup Gitlab data. This script will backup the $gitlab_home/tmp/backups of your gitlab installation to a remote host if configured.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%