34

What is the best way to backup and restore gitlab incuding all repositories, commit comments, wall comments, wiki etc.

newbie
  • 763
  • 1
  • 10
  • 12
  • 3
    If I knew what to try, would I ask the question? – newbie Jun 01 '13 at 21:30
  • There are two major problems with this question - (1) "best" is very subjective. The "best" solution depends on your environment and needs. (2) Server Fault does not exist to do all the work for you. [You are expected to come to the table with research, and at least a little effort expended to find a solution on your own](http://meta.serverfault.com/questions/3608/how-can-i-ask-better-questions-on-server-fault), and then to ask specific questions. – voretaq7 Jun 03 '13 at 07:30
  • 5
    This looks like a valid question to me (and one which I too am wanting an answer to currently). Closing it as "not constructive" is ironically a lot less constructive of a thing to do than what the OP did by asking the question. Who cares if "best" is subjective? Let people answer the question by submitting the best way (in their eyes) to perform this task that they know of. – Tyler Rick Nov 23 '16 at 00:05

1 Answers1

33

From the documentation:

A backup creates an archive file that contains the database, all repositories and all attachments. This archive will be saved in backup_path (see config/gitlab.yml).

The filename will be [TIMESTAMP]_gitlab_backup.tar. This timestamp can be used to restore an specific backup.

sudo gitlab-rake gitlab:backup:create

Mark
  • 296
  • 3
  • 12
newbie
  • 763
  • 1
  • 10
  • 12
  • Thank you, and where is the backup path? – Marian Klühspies Mar 15 '15 at 22:25
  • 2
    This answer is only for the omnibus edition, and not if you installed gitlab from source – user3791372 Mar 17 '15 at 19:22
  • Can i issue this command while the GitLab has users working on wikipages doing push and pulls and stuff? – kiltek Feb 02 '16 at 14:46
  • 1
    For omnibus version you can define your backup path via: `gitlab_rails['backup_path'] = "/mnt/backup"` – Melroy van den Berg Jun 28 '16 at 12:12
  • So it's not a problem to restore the backup to a newer version of GitLab? https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/backup_restore.md says "You can only restore a backup to exactly the same version of GitLab on which it was created." Guess I'll just have to try it... – Tyler Rick Nov 23 '16 at 00:07
  • @TylerRick, how did you go with restoring to a newer version? I just migrated mine across to a new server, but couldn't bear the thought of losing anything so I installed an old version of GitLab on the new server, and then will manually upgrade. (I'm moving away from a source-based installation to an omnibus installation). – XtraSimplicity Apr 06 '17 at 06:58
  • 1
    @XtraSimplicity I don't think I actually ended up trying it. IIRC, we downgraded database version temporarily so they matched... – Tyler Rick Apr 11 '17 at 15:21