diff options
author | Valery Sizov <valery@gitlab.com> | 2015-06-10 09:41:56 +0000 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-06-10 09:41:56 +0000 |
commit | 7872778df3f02edf68a7a8b964e7a788dd49ed26 (patch) | |
tree | 7144b6361191934023a835717850741c8506f03b | |
parent | dedabbc0243cc7aa401c49f35b4e100ff2d95fa3 (diff) | |
parent | 151dd7ccad23e9866dca7045405f422bdd2e77a5 (diff) | |
download | gitlab-ci-7872778df3f02edf68a7a8b964e7a788dd49ed26.tar.gz |
Merge branch 'master' into 'master'
use multipart uploading when using fog
See merge request !130
-rw-r--r-- | config/application.yml.example | 3 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | lib/backup/manager.rb | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/config/application.yml.example b/config/application.yml.example index 8f64c33..760cab4 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -44,6 +44,9 @@ defaults: &defaults # aws_secret_access_key: 'secret123' # # The remote 'directory' to store your backups. For S3, this would be the bucket name. # remote_directory: 'my.s3.bucket' + # # Use multipart uploads when file size reaches 100MB, see + # # http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html + # multipart_chunk_size: 104857600 development: diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 6021b46..dbe4fa1 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -63,3 +63,4 @@ Settings.backup['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'co if Settings.backup['upload']['connection'] Settings.backup['upload']['connection'] = Hash[Settings.backup['upload']['connection'].map { |k, v| [k.to_sym, v] }] end +Settings.backup['upload']['multipart_chunk_size'] ||= 104857600 diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index dc5ac75..fc847e2 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -45,7 +45,8 @@ module Backup connection = ::Fog::Storage.new(connection_settings) directory = connection.directories.get(remote_directory) - if directory.files.create(key: tar_file, body: File.open(tar_file), public: false) + if directory.files.create(key: tar_file, body: File.open(tar_file), public: false, + multipart_chunk_size: GitlabCi.config.backup.upload.multipart_chunk_size) $progress.puts "done".green else puts "uploading backup to #{remote_directory} failed".red |