Commit aa428b11d99295b6dbfd0ac60b03ad6b6813a76a
Exists in
master
and in
9 other branches
Merge branch 'aws_fog' into 'master'
Support AWS S3 attachment storage
Showing
6 changed files
with
58 additions
and
1 deletions
Show diff stats
CHANGELOG
README.md
| ... | ... | @@ -426,6 +426,20 @@ redis['uid'] = 1236 |
| 426 | 426 | redis['gid'] = 1236 |
| 427 | 427 | ``` |
| 428 | 428 | |
| 429 | +## Storing user attachments on Amazon S3 | |
| 430 | + | |
| 431 | +Instead of using local storage you can also store the user attachments for your | |
| 432 | +GitLab instance on Amazon S3. | |
| 433 | + | |
| 434 | +``` | |
| 435 | +# /etc/gitlab/gitlab.rb | |
| 436 | +gitlab_rails['aws_enable'] = true | |
| 437 | +gitlab_rails['aws_access_key_id'] = 'AKIA1111111111111UA' | |
| 438 | +gitlab_rails['aws_secret_access_key'] = 'secret' | |
| 439 | +gitlab_rails['aws_bucket'] = 'my_gitlab_bucket' | |
| 440 | +gitlab_rails['aws_region'] = 'us-east-1' | |
| 441 | +``` | |
| 442 | + | |
| 429 | 443 | ## Building your own package |
| 430 | 444 | |
| 431 | 445 | See [the separate build documentation](doc/build.md). | ... | ... |
files/gitlab-cookbooks/gitlab/attributes/default.rb
| ... | ... | @@ -103,6 +103,12 @@ default['gitlab']['gitlab-rails']['git_bin_path'] = "/opt/gitlab/embedded/bin/gi |
| 103 | 103 | default['gitlab']['gitlab-rails']['git_max_size'] = 5242880 |
| 104 | 104 | default['gitlab']['gitlab-rails']['git_timeout'] = 10 |
| 105 | 105 | |
| 106 | +default['gitlab']['gitlab-rails']['aws_enable'] = false | |
| 107 | +default['gitlab']['gitlab-rails']['aws_access_key_id'] = nil | |
| 108 | +default['gitlab']['gitlab-rails']['aws_secret_access_key'] = nil | |
| 109 | +default['gitlab']['gitlab-rails']['aws_bucket'] = nil | |
| 110 | +default['gitlab']['gitlab-rails']['aws_region'] = nil | |
| 111 | + | |
| 106 | 112 | default['gitlab']['gitlab-rails']['db_adapter'] = "postgresql" |
| 107 | 113 | default['gitlab']['gitlab-rails']['db_encoding'] = "unicode" |
| 108 | 114 | default['gitlab']['gitlab-rails']['db_database'] = "gitlabhq_production" | ... | ... |
files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | # limitations under the License. |
| 16 | 16 | # |
| 17 | 17 | |
| 18 | -define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :helpers => nil, :notifies => nil, :restarts => [] do | |
| 18 | +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :helpers => nil, :notifies => nil, :restarts => [], :action => :create do | |
| 19 | 19 | template params[:name] do |
| 20 | 20 | source params[:source] |
| 21 | 21 | owner params[:owner] |
| ... | ... | @@ -27,9 +27,11 @@ define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :gro |
| 27 | 27 | params[:restarts].each do |resource| |
| 28 | 28 | notifies :restart, resource |
| 29 | 29 | end |
| 30 | + action params[:action] | |
| 30 | 31 | end |
| 31 | 32 | |
| 32 | 33 | link params[:link_from] do |
| 33 | 34 | to params[:name] |
| 35 | + action params[:action] | |
| 34 | 36 | end |
| 35 | 37 | end | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
| ... | ... | @@ -86,6 +86,19 @@ template_symlink File.join(gitlab_rails_etc_dir, "resque.yml") do |
| 86 | 86 | restarts dependent_services |
| 87 | 87 | end |
| 88 | 88 | |
| 89 | +template_symlink File.join(gitlab_rails_etc_dir, "aws.yml") do | |
| 90 | + link_from File.join(gitlab_rails_source_dir, "config/aws.yml") | |
| 91 | + owner "root" | |
| 92 | + group "root" | |
| 93 | + mode "0644" | |
| 94 | + variables(node['gitlab']['gitlab-rails'].to_hash) | |
| 95 | + restarts dependent_services | |
| 96 | + | |
| 97 | + unless node['gitlab']['gitlab-rails']['aws_enable'] | |
| 98 | + action :delete | |
| 99 | + end | |
| 100 | +end | |
| 101 | + | |
| 89 | 102 | template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do |
| 90 | 103 | link_from File.join(gitlab_rails_source_dir, "config/gitlab.yml") |
| 91 | 104 | source "gitlab.yml.erb" | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/aws.yml.erb
0 → 100644
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +# This file is managed by gitlab-ctl. Manual changes will be | |
| 2 | +# erased! To change the contents below, edit /etc/gitlab/gitlab.rb | |
| 3 | +# and run `sudo gitlab-ctl reconfigure`. | |
| 4 | + | |
| 5 | +production: | |
| 6 | + access_key_id: <%= @aws_access_key_id %> | |
| 7 | + secret_access_key: <%= @aws_secret_access_key %> | |
| 8 | + bucket: <%= @aws_bucket %> | |
| 9 | + region: <%= @aws_region %> | |
| 10 | + | |
| 11 | +development: | |
| 12 | + access_key_id: AKIA1111111111111UA | |
| 13 | + secret_access_key: secret | |
| 14 | + bucket: mygitlab.development.us | |
| 15 | + region: us-east-1 | |
| 16 | + | |
| 17 | +test: | |
| 18 | + access_key_id: AKIA1111111111111UA | |
| 19 | + secret_access_key: secret | |
| 20 | + bucket: mygitlab.test.us | |
| 21 | + region: us-east-1 | ... | ... |