Try to meet several review comments

parent ab8372d2
...@@ -273,15 +273,16 @@ sudo -u git -H bundle exec rake gitlab:backup:create SKIP=db,uploads RAILS_ENV=p ...@@ -273,15 +273,16 @@ sudo -u git -H bundle exec rake gitlab:backup:create SKIP=db,uploads RAILS_ENV=p
### Skipping tar creation ### Skipping tar creation
The last part of backup creation is generation of a tar file with all The last part of creating a backup is generation of a `.tar` file containing
the parts in. In some cases (e.g. if the backup is picked up by other all the parts. In some cases (for example, if the backup is picked up by other
backup software) that might be wasted or even directly harmful, you can backup software) creating a `.tar` file might be wasted effort or even directly
skip this step by adding `tar` to the `SKIP` environment variable. harmful, so you can skip this step by adding `tar` to the `SKIP` environment
variable.
This will leave the files and directories containing the backup in the Including `tar` in the `SKIP` variable will leave the files and directories
directory used for the intermediate files, and thus the will be containing the backup in the directory used for the intermediate files. These
overwritten when a new backup is created, i.e. you can't have more than files will be overwritten when a new backup is created, so you should make sure
one backup on the system, so you should make sure it's copied elsewhere. it's copied elsewhere, because you can only have one backup on the system.
For Omnibus GitLab packages: For Omnibus GitLab packages:
...@@ -289,9 +290,6 @@ For Omnibus GitLab packages: ...@@ -289,9 +290,6 @@ For Omnibus GitLab packages:
sudo gitlab-backup create SKIP=tar sudo gitlab-backup create SKIP=tar
``` ```
NOTE: **Note**
For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`.
For installations from source: For installations from source:
```shell ```shell
...@@ -685,8 +683,9 @@ lose access to your GitLab server. ...@@ -685,8 +683,9 @@ lose access to your GitLab server.
You may also want to restore any TLS keys, certificates, or [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079). You may also want to restore any TLS keys, certificates, or [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079).
If an untarred backup (like the ones made with `SKIP=tar`) is found, and Starting with GitLab12.9 if an untarred backup (like the ones made with
no backup is chosen with `BACKUP=<timestamp>`, the untarred is used. `SKIP=tar`) is found, and no backup is chosen with `BACKUP=<timestamp>`, the
untarred backup is used.
Depending on your case, you might want to run the restore command with one or Depending on your case, you might want to run the restore command with one or
more of the following options: more of the following options:
......
...@@ -24,9 +24,6 @@ module Backup ...@@ -24,9 +24,6 @@ module Backup
end end
def pack def pack
# Make sure there is a connection
ActiveRecord::Base.connection.reconnect!
Dir.chdir(backup_path) do Dir.chdir(backup_path) do
# create archive # create archive
progress.print "Creating backup archive: #{tar_file} ... " progress.print "Creating backup archive: #{tar_file} ... "
...@@ -113,9 +110,10 @@ module Backup ...@@ -113,9 +110,10 @@ module Backup
# rubocop: disable Metrics/AbcSize # rubocop: disable Metrics/AbcSize
def unpack def unpack
cleanup_required = true cleanup_required = true
Dir.chdir(backup_path) do Dir.chdir(backup_path) do
if ENV['BACKUP'].present? if ENV['BACKUP'].present?
# User has indicated which backup he/she wants restored # User has indicated which backup to restore
tar_file = File.basename(ENV['BACKUP']) + FILE_NAME_SUFFIX tar_file = File.basename(ENV['BACKUP']) + FILE_NAME_SUFFIX
unless File.exist?(tar_file) unless File.exist?(tar_file)
......
...@@ -19,13 +19,13 @@ namespace :gitlab do ...@@ -19,13 +19,13 @@ namespace :gitlab do
backup = Backup::Manager.new(progress) backup = Backup::Manager.new(progress)
backup.write_info backup.write_info
if !(ENV['SKIP'] && ENV['SKIP'].include?('tar')) if ENV['SKIP'] && ENV['SKIP'].include?('tar')
backup.upload
else
backup.pack backup.pack
backup.upload backup.upload
backup.cleanup backup.cleanup
backup.remove_old backup.remove_old
else
backup.upload
end end
progress.puts "Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data \n" \ progress.puts "Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data \n" \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment