From cd86b155042f6fca18c231b862d8e923eb38b441 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 19 May 2014 16:20:53 +0000 Subject: Add GitLab backup automation This adds a systemd timer unit to back up a GitLab instance every four hours. The backup is placed as /home/git/gitlab-backup.tar and it is expected Something Else retrieves that. --- .../usr/share/gitlab-install/backup-gitlab | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gitlab-server/usr/share/gitlab-install/backup-gitlab (limited to 'gitlab-server/usr/share/gitlab-install/backup-gitlab') diff --git a/gitlab-server/usr/share/gitlab-install/backup-gitlab b/gitlab-server/usr/share/gitlab-install/backup-gitlab new file mode 100644 index 00000000..a6c3e3f5 --- /dev/null +++ b/gitlab-server/usr/share/gitlab-install/backup-gitlab @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Run the gitlab backup script. The backup will be stored as +# /home/git/gitlab-backup.tar . A separate backup host will need to +# back that up. +# +# This script be run as the git user on a GitLab host. + +set -e + +export PATH=/usr/local/bin:/usr/bin:/bin + +cd /home/git/gitlab +mkdir -p /home/git/gitlab/tmp/backups +bundle exec rake gitlab:backup:create RAILS_ENV=production + +ls /home/git/gitlab/tmp/backups/[0-9]*.tar | +tail -n1 | +while read filename +do + mv "$filename" /home/git/gitlab-backup.tar +done -- cgit v1.2.1