Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab
GitLab
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 36,969
    • Issues 36,969
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 1,432
    • Merge requests 1,432
  • Requirements
    • Requirements
    • List
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #14130

Closed
Open
Created Dec 18, 2015 by Richard@rarevans

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.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking