The backup and restore tools provided by GitLab are relied upon by administrators of GitLab instances as part of their disaster recovery strategy. These procedures rely on standard UNIX tools such as rsync and tar and cover most data excluding GitLab configuration.
There are a number of ways that we can continue to improve the backup and restore processes to make the experience more reliable, efficient, and transparent for system administrators.
Backup and restore output logs
gitlab:backup:restore output to
These logs would come in handy especially for GitLab Support while assisiting customers (and also sys admins as well), especially when debugging for issues with these operations.
Creating a BackupLogger Class from Gitlab::JsonLogger inside
# frozen_string_literal: true module Gitlab class BackupLogger < Gitlab::JsonLogger def self.file_name_noext 'backup_json' end end end
Using it inside backup rake which STDOUT the output and saves to
.log file also.
Remove backups/tmp directory after restore
bundle exec rake gitlab:backup:restore restores the backup but it also contains
tmp dir resulting in disk-full alert.
remove_tmp function inside lib/backup/manager.rb:
def remove_tmp # delete tmp inside backups progress.print "Deleting backups/tmp ... " if FileUtils.rm_rf(File.join(backup_path, "tmp")) progress.puts "done".color(:green) else puts "deleting backups/tmp failed".color(:red) end end
And calling it in backup rake.
Done (During GSoC):
- Add backup/restore logs:
- Added json logger for backup and restore output - MR !63832.
- Delete tmp after gitlab:backup:restore:
- Deletes backups/tmp after restore process - MR !67741.
- Allow failed gitlab backup to email admin:
To Do (Plan post GSoC):
- Rescue custom backup errors to notify admin - MR !66790.
- Add option to disable compression of backup - #17197.