Restore from backup - don't move existing git data to old with timestamp
Hi,
As part of a hot swap environment for gitlab that I have in place, I am restoring a backup of a primary Gitlab machine every night. The problem is that restoring from backup will continually move existing repository data from repositories
to repositories.old.timestamp
. This redundancy has some problems.
I would like the Gitlab configuration to allow opt out of saving existing repositories during restoration of backups and that the gitlab-data\repositories existing data be removed.
Beyond my problem, I expect that this hidden process actually helps some people recover from failures. But for administrators it also means Gitlab consumes disk space in a hidden way. I would prefer not to write clean up actions post restore to remove them and I think administrators should have control over this aspect.
Solution options: This occurs in the lib\backup\repository.rb
def restore
if File.exists?(repos_path)
# Move repos dir to 'repositories.old' dir
bk_repos_path = File.join(repos_path, '..', 'repositories.old.' + Time.now.to_i.to_s)
FileUtils.mv(repos_path, bk_repos_path)
end
It seems like a task that the Backup::Manager class (lib\backup\manager.rb) should have responsibility for and that the backup.rake task would have keeping the existing data as an optional action within the template of actions in the restore task (lib\tasks\gitlab\backup.rake).
Thanks for a great application.