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. ...@@ -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). 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 `SKIP=tar`) is found, and no backup is chosen with `BACKUP=<timestamp>`, the
untarred backup is used. untarred backup is used.
......
...@@ -126,6 +126,7 @@ module Backup ...@@ -126,6 +126,7 @@ module Backup
end end
def unpack def unpack
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 to restore # User has indicated which backup to restore
...@@ -164,6 +165,7 @@ module Backup ...@@ -164,6 +165,7 @@ module Backup
exit 1 exit 1
end end
end end
end
true true
end end
......
...@@ -41,7 +41,7 @@ namespace :gitlab do ...@@ -41,7 +41,7 @@ namespace :gitlab do
backup = Backup::Manager.new(progress) backup = Backup::Manager.new(progress)
cleanup_required = backup.unpack cleanup_required = backup.unpack
backup.verify_restore backup.verify_backup_version
unless backup.skipped?('db') unless backup.skipped?('db')
begin 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