Commit 67ef96ea5f721cc620f3e931f05d918c904ec74e

Authored by Dmitriy Zaporozhets
2 parents 18f83016 ec01cbef

Merge pull request #1129 from meskyanichi/master

Potential solution for current `rake gitlab:app:backup_restore` issues.
Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
lib/tasks/gitlab/backup.rake
... ... @@ -121,7 +121,7 @@ namespace :gitlab do
121 121 backup_path_repo = File.join(Gitlab.config.backup_path, "repositories")
122 122 FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo)
123 123 puts "Dumping repositories:"
124   - project = Project.all.map { |n| [n.name,n.path_to_repo] }
  124 + project = Project.all.map { |n| [n.path,n.path_to_repo] }
125 125 project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")]
126 126 project.each do |project|
127 127 print "- Dumping repository #{project.first}... "
... ... @@ -136,12 +136,14 @@ namespace :gitlab do
136 136 task :repo_restore => :environment do
137 137 backup_path_repo = File.join(Gitlab.config.backup_path, "repositories")
138 138 puts "Restoring repositories:"
139   - project = Project.all.map { |n| [n.name,n.path_to_repo] }
  139 + project = Project.all.map { |n| [n.path,n.path_to_repo] }
140 140 project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")]
141 141 project.each do |project|
142 142 print "- Restoring repository #{project.first}... "
143 143 FileUtils.rm_rf(project.second) if File.dirname(project.second) # delet old stuff
144 144 if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1")
  145 + Kernel.system("sudo chmod -R g+rwX #{Gitlab.config.git_base_path}")
  146 + Kernel.system("sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}")
145 147 puts "[DONE]".green
146 148 else
147 149 puts "[FAILED]".red
... ...