Commit c6f8c9dbcca7c467334ad2af06eb3978f2ae0f7d
Exists in
master
and in
17 other branches
Merge branch 'backup_documentation' into 'master'
Backup Documentation
Showing
3 changed files
with
37 additions
and
2 deletions
Show diff stats
README.md
| ... | ... | @@ -74,12 +74,46 @@ external_url "http://gitlab.example.com" |
| 74 | 74 | |
| 75 | 75 | Run `sudo gitlab-ctl reconfigure` for the change to take effect. |
| 76 | 76 | |
| 77 | +### Creating an application backup | |
| 78 | + | |
| 79 | +To create a backup of your repositories and GitLab metadata, run the following command. | |
| 80 | + | |
| 81 | +```shell | |
| 82 | +sudo gitlab-rake gitlab:backup:create | |
| 83 | +``` | |
| 84 | + | |
| 85 | +This will store a tar file in `/var/opt/gitlab/backups`. The filename will look like | |
| 86 | +`1393513186_gitlab_backup.tar`, where 1393513186 is a timestamp. | |
| 87 | + | |
| 88 | +### Restoring an application backup | |
| 89 | + | |
| 90 | +We will assume that you have installed GitLab from an omnibus package and run | |
| 91 | +`sudo gitlab-ctl reconfigure` at least once. | |
| 92 | + | |
| 93 | +First make sure your backup tar file is in `/var/opt/gitlab/backups`. | |
| 94 | + | |
| 95 | +```shell | |
| 96 | +sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/ | |
| 97 | +``` | |
| 98 | + | |
| 99 | +Next, restore the backup by running the restore command. You need to specify the | |
| 100 | +timestamp of the backup you are restoring. | |
| 101 | + | |
| 102 | +```shell | |
| 103 | +# This command will overwrite the contents of your GitLab database! | |
| 104 | +sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186 | |
| 105 | +``` | |
| 106 | + | |
| 107 | +If there is a GitLab version mismatch between your backup tar file and the installed | |
| 108 | +version of GitLab, the restore command will abort with an error. Install a package for | |
| 109 | +the [required version](https://www.gitlab.com/downloads/archives/) and try again. | |
| 110 | + | |
| 77 | 111 | ### Invoking Rake tasks |
| 78 | 112 | |
| 79 | 113 | To invoke a GitLab Rake task, use `gitlab-rake`. For example: |
| 80 | 114 | |
| 81 | 115 | ```shell |
| 82 | -sudo gitlab-rake gitlab:backup:create | |
| 116 | +sudo gitlab-rake gitlab:check | |
| 83 | 117 | ``` |
| 84 | 118 | |
| 85 | 119 | Contrary to with a traditional GitLab installation, there is no need to change | ... | ... |
files/gitlab-cookbooks/gitlab/attributes/default.rb
| ... | ... | @@ -87,7 +87,7 @@ default['gitlab']['gitlab-rails']['ldap_bind_dn'] = "_the_full_dn_of_the_user_yo |
| 87 | 87 | default['gitlab']['gitlab-rails']['ldap_password'] = "_the_password_of_the_bind_user" |
| 88 | 88 | default['gitlab']['gitlab-rails']['ldap_allow_username_or_email_login'] = true |
| 89 | 89 | default['gitlab']['gitlab-rails']['satellites_path'] = "/var/opt/gitlab/git-data/gitlab-satellites" |
| 90 | -default['gitlab']['gitlab-rails']['backup_path'] = "tmp/backups" | |
| 90 | +default['gitlab']['gitlab-rails']['backup_path'] = "/var/opt/gitlab/backups" | |
| 91 | 91 | default['gitlab']['gitlab-rails']['gitlab_shell_path'] = "/opt/gitlab/embedded/service/gitlab-shell/" |
| 92 | 92 | default['gitlab']['gitlab-rails']['gitlab_shell_repos_path'] = "/var/opt/gitlab/git-data/repositories" |
| 93 | 93 | default['gitlab']['gitlab-rails']['gitlab_shell_hooks_path'] = "/opt/gitlab/embedded/service/gitlab-shell/hooks/" | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
| ... | ... | @@ -30,6 +30,7 @@ gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory'] |
| 30 | 30 | gitlab_rails_working_dir, |
| 31 | 31 | gitlab_rails_tmp_dir, |
| 32 | 32 | gitlab_rails_public_uploads_dir, |
| 33 | + node['gitlab']['gitlab-rails']['backup_path'], | |
| 33 | 34 | gitlab_rails_log_dir |
| 34 | 35 | ].each do |dir_name| |
| 35 | 36 | directory dir_name do | ... | ... |