Skip to content
Snippets Groups Projects
Commit fb9b114d authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Patch gitlab-rails for uploads backup restore

parent 4686104c
No related branches found
No related tags found
1 merge request!56Gitlab Rails Uploads
diff --git a/lib/backup/uploads.rb b/lib/backup/uploads.rb
index e79da7e..e50e1ff 100644
--- a/lib/backup/uploads.rb
+++ b/lib/backup/uploads.rb
@@ -3,7 +3,7 @@ module Backup
attr_reader :app_uploads_dir, :backup_uploads_dir, :backup_dir
def initialize
- @app_uploads_dir = Rails.root.join('public', 'uploads')
+ @app_uploads_dir = File.realpath(Rails.root.join('public', 'uploads'))
@backup_dir = Gitlab.config.backup.path
@backup_uploads_dir = File.join(Gitlab.config.backup.path, 'uploads')
end
@@ -21,8 +21,9 @@ module Backup
end
def backup_existing_uploads_dir
+ timestamped_uploads_path = File.join(app_uploads_dir, '..', "uploads.#{Time.now.to_i}")
if File.exists?(app_uploads_dir)
- FileUtils.mv(app_uploads_dir, Rails.root.join('public', "uploads.#{Time.now.to_i}"))
+ FileUtils.mv(app_uploads_dir, timestamped_uploads_path)
end
end
end
Loading
Loading
@@ -46,6 +46,11 @@ build do
patch :source => "backup_read_REVISION.patch"
command "git rev-parse HEAD > REVISION"
 
# The user uploads path is not (yet) configurable in gitlab-rails. As a
# workaround, omnibus-gitlab creates a symlink for public/uploads. This breaks
# the GitLab backup script.
patch :source => "backup_uploads_realpath.patch"
bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env
 
# In order to precompile the assets, we need to get to a state where rake can
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment