path: root/gitlab-server/usr/share/gitlab-install/backup-gitlab
diff options
authorLars Wirzenius <>2014-05-19 16:20:53 +0000
committerLars Wirzenius <>2014-05-20 14:23:45 +0000
commitcd86b155042f6fca18c231b862d8e923eb38b441 (patch)
treeef877aede038726888dd50e34331af4a1c84e3f2 /gitlab-server/usr/share/gitlab-install/backup-gitlab
parentbc347a438b36c60931602bf86d4156d332cb9cde (diff)
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.
Diffstat (limited to 'gitlab-server/usr/share/gitlab-install/backup-gitlab')
1 files changed, 22 insertions, 0 deletions
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 @@
+# 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
+ mv "$filename" /home/git/gitlab-backup.tar