diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-07-02 13:40:42 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-07-02 13:40:42 +0000 |
commit | 67a58bebd117870ccb2e9e12bbdab84bc89698ea (patch) | |
tree | 3713369feced4f57b1b55eb006aa5b36ce64b715 | |
parent | b55c8552a68bf045199e8ca77849b7c6fd279ca7 (diff) | |
download | definitions-67a58bebd117870ccb2e9e12bbdab84bc89698ea.tar.gz |
Change backup-gitlab to use database dump instead of Rake script
The Gitlab Rake script for backing up doesn't backup the database
that Gitlab CI uses, and additonally it does a git bundle for each
git repository. Our GitLab instance has hundreds of git repositories,
making the bundling be a very expensive things.
Instead, we use the Postgres tool to dump all databases to a file,
and arrange to backup the dump files, the git repositories, and all
other relevant files directly.
-rw-r--r-- | gitlab-server/usr/share/gitlab-install/backup-gitlab | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gitlab-server/usr/share/gitlab-install/backup-gitlab b/gitlab-server/usr/share/gitlab-install/backup-gitlab index a6c3e3f5..1320df81 100644 --- a/gitlab-server/usr/share/gitlab-install/backup-gitlab +++ b/gitlab-server/usr/share/gitlab-install/backup-gitlab @@ -4,19 +4,13 @@ # /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. +# This script be run as the postgres user on a Baserock 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 +mkdir -p /home/postgres/dumps +cd /home/postgres/dumps +pg_dumpall > new.dump +mv new.dump gitlab.pg_dumpall |