Allow user to skip archive creation on backup

Don't create a (tar) archive if the user specified SKIP=tar when
creating a backup.

Allow restore from untarred backups (they don't have easily accesible
timestamps, so just give such a backup priority if it's present).

Document the festure.

Addresses https://gitlab.com/gitlab-org/gitlab/issues/15179
parent ca995093
......@@ -683,7 +683,7 @@ 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).
Starting with GitLab12.9 if an untarred backup (like the ones made with
Starting with GitLab 12.9 if an untarred backup (like the ones made with
`SKIP=tar`) is found, and no backup is chosen with `BACKUP=<timestamp>`, the
untarred backup is used.
......
......@@ -126,6 +126,7 @@ module Backup
end
def unpack
cleanup_required = true
Dir.chdir(backup_path) do
if ENV['BACKUP'].present?
# User has indicated which backup to restore
......@@ -155,13 +156,14 @@ module Backup
tar_file = backup_file_list.first
end
progress.print 'Unpacking backup ... '
progress.print 'Unpacking backup ... '
if Kernel.system(*%W(tar -xf #{tar_file}))
progress.puts 'done'.color(:green)
else
progress.puts 'unpacking backup failed'.color(:red)
exit 1
if Kernel.system(*%W(tar -xf #{tar_file}))
progress.puts 'done'.color(:green)
else
progress.puts 'unpacking backup failed'.color(:red)
exit 1
end
end
end
true
......
......@@ -41,7 +41,7 @@ namespace :gitlab do
backup = Backup::Manager.new(progress)
cleanup_required = backup.unpack
backup.verify_restore
backup.verify_backup_version
unless backup.skipped?('db')
begin
......
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