Commit ac74661b7f4b07b5f369ca9a1637decef4263310
1 parent
f1d32a9b
Exists in
master
and in
17 other branches
Rename gitlab.core to gitlab.rails
Showing
17 changed files
with
234 additions
and
234 deletions
Show diff stats
config/projects/gitlab.rb
... | ... | @@ -32,7 +32,7 @@ dependency "git" |
32 | 32 | dependency "postgresql" |
33 | 33 | dependency "redis" |
34 | 34 | dependency "gitlab-shell" |
35 | -dependency "gitlab-core" | |
35 | +dependency "gitlab-rails" | |
36 | 36 | dependency "chef-gem" |
37 | 37 | dependency "gitlab-ctl" |
38 | 38 | dependency "gitlab-cookbooks" | ... | ... |
config/software/gitlab-core.rb
... | ... | @@ -1,76 +0,0 @@ |
1 | -# | |
2 | -# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
3 | -# Copyright:: Copyright (c) 2014 GitLab.com | |
4 | -# License:: Apache License, Version 2.0 | |
5 | -# | |
6 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | -# you may not use this file except in compliance with the License. | |
8 | -# You may obtain a copy of the License at | |
9 | -# | |
10 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
11 | -# | |
12 | -# Unless required by applicable law or agreed to in writing, software | |
13 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
14 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | -# See the License for the specific language governing permissions and | |
16 | -# limitations under the License. | |
17 | -# | |
18 | - | |
19 | -name "gitlab-core" | |
20 | -version "master" | |
21 | - | |
22 | -dependency "ruby" | |
23 | -dependency "bundler" | |
24 | -dependency "libxml2" | |
25 | -dependency "libxslt" | |
26 | -dependency "curl" | |
27 | -dependency "rsync" | |
28 | -dependency "libicu" | |
29 | -dependency "postgresql" | |
30 | - | |
31 | -source :git => "https://gitlab.com/gitlab-org/gitlab-ce.git" | |
32 | - | |
33 | -build do | |
34 | - # GitLab assumes it can extract the Git revision of the currently version | |
35 | - # from the Git repo the code lives in at boot. Because of our rsync later on, | |
36 | - # this assumption does not hold. The sed command below patches the GitLab | |
37 | - # source code to include the Git revision of the code included in the omnibus | |
38 | - # build. | |
39 | - command "sed -i \"s/.*REVISION.*/REVISION = '$(git log --pretty=format:'%h' -n 1)'/\" config/initializers/2_app.rb" | |
40 | - | |
41 | - bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem" | |
42 | - | |
43 | - # In order to precompile the assets, we need to get to a state where rake can | |
44 | - # load the Rails environment. | |
45 | - command "cp config/gitlab.yml.example config/gitlab.yml" | |
46 | - command "cp config/database.yml.postgresql config/database.yml" | |
47 | - # There is a bug in the acts-as-taggable-on gem that makes | |
48 | - # rake assets:precompile check for a database connection. We do not have a | |
49 | - # database at this point so that is a problem. This bug is fixed in | |
50 | - # acts-as-taggable-on 3.0.0 by | |
51 | - # https://github.com/mbleigh/acts-as-taggable-on/commit/ad02dc9bb24ec8e1e79e7e35e2d4bb5910a66d8e | |
52 | - patch = "#{Omnibus.project_root}/config/patches/acts-as-taggable-on-ad02dc9bb24ec8e1e79e7e35e2d4bb5910a66d8e.diff" | |
53 | - # To make this idempotent, we apply the patch (in case this is a first run) or | |
54 | - # we revert and re-apply the patch (if this is a second or later run). | |
55 | - command "git apply #{patch} || (git apply -R #{patch} && git apply #{patch})", | |
56 | - :cwd => "#{install_dir}/embedded/service/gem/ruby/1.9.1/gems/acts-as-taggable-on-2.4.1" | |
57 | - rake "assets:precompile", :env => {"RAILS_ENV" => "production"} | |
58 | - # Tear down now that the assets:precompile is done. | |
59 | - command "rm config/gitlab.yml config/database.yml" | |
60 | - | |
61 | - command "mkdir -p #{install_dir}/embedded/service/gitlab-core" | |
62 | - command "rm -rf log tmp public/uploads" | |
63 | - command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-core/" | |
64 | - | |
65 | - # Create a wrapper for the rake tasks of the Rails app | |
66 | - erb :dest => "#{install_dir}/bin/gitlab-rake", | |
67 | - :source => "bundle_exec_wrapper.erb", | |
68 | - :mode => 0755, | |
69 | - :vars => {:command => 'rake "$@"', :install_dir => install_dir} | |
70 | - | |
71 | - # Create a wrapper for the rails command, useful for e.g. `rails console` | |
72 | - erb :dest => "#{install_dir}/bin/gitlab-rails", | |
73 | - :source => "bundle_exec_wrapper.erb", | |
74 | - :mode => 0755, | |
75 | - :vars => {:command => 'rails "$@"', :install_dir => install_dir} | |
76 | -end |
... | ... | @@ -0,0 +1,76 @@ |
1 | +# | |
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
3 | +# Copyright:: Copyright (c) 2014 GitLab.com | |
4 | +# License:: Apache License, Version 2.0 | |
5 | +# | |
6 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | +# you may not use this file except in compliance with the License. | |
8 | +# You may obtain a copy of the License at | |
9 | +# | |
10 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
11 | +# | |
12 | +# Unless required by applicable law or agreed to in writing, software | |
13 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | +# See the License for the specific language governing permissions and | |
16 | +# limitations under the License. | |
17 | +# | |
18 | + | |
19 | +name "gitlab-rails" | |
20 | +version "master" | |
21 | + | |
22 | +dependency "ruby" | |
23 | +dependency "bundler" | |
24 | +dependency "libxml2" | |
25 | +dependency "libxslt" | |
26 | +dependency "curl" | |
27 | +dependency "rsync" | |
28 | +dependency "libicu" | |
29 | +dependency "postgresql" | |
30 | + | |
31 | +source :git => "https://gitlab.com/gitlab-org/gitlab-ce.git" | |
32 | + | |
33 | +build do | |
34 | + # GitLab assumes it can extract the Git revision of the currently version | |
35 | + # from the Git repo the code lives in at boot. Because of our rsync later on, | |
36 | + # this assumption does not hold. The sed command below patches the GitLab | |
37 | + # source code to include the Git revision of the code included in the omnibus | |
38 | + # build. | |
39 | + command "sed -i \"s/.*REVISION.*/REVISION = '$(git log --pretty=format:'%h' -n 1)'/\" config/initializers/2_app.rb" | |
40 | + | |
41 | + bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem" | |
42 | + | |
43 | + # In order to precompile the assets, we need to get to a state where rake can | |
44 | + # load the Rails environment. | |
45 | + command "cp config/gitlab.yml.example config/gitlab.yml" | |
46 | + command "cp config/database.yml.postgresql config/database.yml" | |
47 | + # There is a bug in the acts-as-taggable-on gem that makes | |
48 | + # rake assets:precompile check for a database connection. We do not have a | |
49 | + # database at this point so that is a problem. This bug is fixed in | |
50 | + # acts-as-taggable-on 3.0.0 by | |
51 | + # https://github.com/mbleigh/acts-as-taggable-on/commit/ad02dc9bb24ec8e1e79e7e35e2d4bb5910a66d8e | |
52 | + patch = "#{Omnibus.project_root}/config/patches/acts-as-taggable-on-ad02dc9bb24ec8e1e79e7e35e2d4bb5910a66d8e.diff" | |
53 | + # To make this idempotent, we apply the patch (in case this is a first run) or | |
54 | + # we revert and re-apply the patch (if this is a second or later run). | |
55 | + command "git apply #{patch} || (git apply -R #{patch} && git apply #{patch})", | |
56 | + :cwd => "#{install_dir}/embedded/service/gem/ruby/1.9.1/gems/acts-as-taggable-on-2.4.1" | |
57 | + rake "assets:precompile", :env => {"RAILS_ENV" => "production"} | |
58 | + # Tear down now that the assets:precompile is done. | |
59 | + command "rm config/gitlab.yml config/database.yml" | |
60 | + | |
61 | + command "mkdir -p #{install_dir}/embedded/service/gitlab-rails" | |
62 | + command "rm -rf log tmp public/uploads" | |
63 | + command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-rails/" | |
64 | + | |
65 | + # Create a wrapper for the rake tasks of the Rails app | |
66 | + erb :dest => "#{install_dir}/bin/gitlab-rake", | |
67 | + :source => "bundle_exec_wrapper.erb", | |
68 | + :mode => 0755, | |
69 | + :vars => {:command => 'rake "$@"', :install_dir => install_dir} | |
70 | + | |
71 | + # Create a wrapper for the rails command, useful for e.g. `rails console` | |
72 | + erb :dest => "#{install_dir}/bin/gitlab-rails", | |
73 | + :source => "bundle_exec_wrapper.erb", | |
74 | + :mode => 0755, | |
75 | + :vars => {:command => 'rails "$@"', :install_dir => install_dir} | |
76 | +end | ... | ... |
config/templates/gitlab-core/bundle_exec_wrapper.erb
... | ... | @@ -1,13 +0,0 @@ |
1 | -#!/bin/bash | |
2 | - | |
3 | -export PATH=<%= install_dir %>/bin:<%= install_dir %>/embedded/bin:$PATH | |
4 | - | |
5 | -# default to RAILS_ENV=production | |
6 | -if [[ -z $RAILS_ENV ]]; then | |
7 | - export RAILS_ENV=production | |
8 | -fi | |
9 | - | |
10 | -gitlab_user=$(ls -lLd <%= install_dir %>/embedded/service/gitlab-core/log | awk '{ print $3 }') | |
11 | - | |
12 | -cd <%= install_dir %>/embedded/service/gitlab-core | |
13 | -exec <%= install_dir %>/embedded/bin/chpst -u $gitlab_user -U $gitlab_user <%= install_dir %>/embedded/bin/bundle exec <%= command %> |
... | ... | @@ -0,0 +1,13 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +export PATH=<%= install_dir %>/bin:<%= install_dir %>/embedded/bin:$PATH | |
4 | + | |
5 | +# default to RAILS_ENV=production | |
6 | +if [[ -z $RAILS_ENV ]]; then | |
7 | + export RAILS_ENV=production | |
8 | +fi | |
9 | + | |
10 | +gitlab_user=$(ls -lLd <%= install_dir %>/embedded/service/gitlab-rails/log | awk '{ print $3 }') | |
11 | + | |
12 | +cd <%= install_dir %>/embedded/service/gitlab-rails | |
13 | +exec <%= install_dir %>/embedded/bin/chpst -u $gitlab_user -U $gitlab_user <%= install_dir %>/embedded/bin/bundle exec <%= command %> | ... | ... |
files/gitlab-cookbooks/gitlab/attributes/default.rb
... | ... | @@ -39,24 +39,24 @@ default['gitlab']['user']['git_user_email'] = "gitlab@#{node['fqdn']}" |
39 | 39 | #### |
40 | 40 | # GitLab core |
41 | 41 | #### |
42 | -default['gitlab']['gitlab-core']['enable'] = true | |
43 | -default['gitlab']['gitlab-core']['ha'] = false | |
44 | -default['gitlab']['gitlab-core']['dir'] = "/var/opt/gitlab/gitlab-core" | |
45 | -default['gitlab']['gitlab-core']['log_directory'] = "/var/log/gitlab/gitlab-core" | |
46 | -default['gitlab']['gitlab-core']['environment'] = 'production' | |
47 | -default['gitlab']['gitlab-core']['umask'] = "0022" | |
48 | - | |
49 | -default['gitlab']['gitlab-core']['repositories_path'] = "/var/opt/gitlab/repositories" | |
50 | -default['gitlab']['gitlab-core']['satellites_path'] = "/var/opt/gitlab/gitlab-satellites" | |
51 | -default['gitlab']['gitlab-core']['internal_api_url'] = "http://localhost:8080" | |
52 | -default['gitlab']['gitlab-core']['external_fqdn'] = node['fqdn'] | |
53 | -default['gitlab']['gitlab-core']['external_port'] = 80 | |
54 | -default['gitlab']['gitlab-core']['external_https'] = false | |
55 | -default['gitlab']['gitlab-core']['notification_email'] = "gitlab@#{node['fqdn']}" | |
56 | -default['gitlab']['gitlab-core']['support_email'] = "support@example.com" | |
57 | -default['gitlab']['gitlab-core']['uploads_directory'] = "/var/opt/gitlab/uploads" | |
58 | -default['gitlab']['gitlab-core']['rate_limit_requests_per_period'] = 10 | |
59 | -default['gitlab']['gitlab-core']['rate_limit_period'] = 60 | |
42 | +default['gitlab']['gitlab-rails']['enable'] = true | |
43 | +default['gitlab']['gitlab-rails']['ha'] = false | |
44 | +default['gitlab']['gitlab-rails']['dir'] = "/var/opt/gitlab/gitlab-rails" | |
45 | +default['gitlab']['gitlab-rails']['log_directory'] = "/var/log/gitlab/gitlab-rails" | |
46 | +default['gitlab']['gitlab-rails']['environment'] = 'production' | |
47 | +default['gitlab']['gitlab-rails']['umask'] = "0022" | |
48 | + | |
49 | +default['gitlab']['gitlab-rails']['repositories_path'] = "/var/opt/gitlab/repositories" | |
50 | +default['gitlab']['gitlab-rails']['satellites_path'] = "/var/opt/gitlab/gitlab-satellites" | |
51 | +default['gitlab']['gitlab-rails']['internal_api_url'] = "http://localhost:8080" | |
52 | +default['gitlab']['gitlab-rails']['external_fqdn'] = node['fqdn'] | |
53 | +default['gitlab']['gitlab-rails']['external_port'] = 80 | |
54 | +default['gitlab']['gitlab-rails']['external_https'] = false | |
55 | +default['gitlab']['gitlab-rails']['notification_email'] = "gitlab@#{node['fqdn']}" | |
56 | +default['gitlab']['gitlab-rails']['support_email'] = "support@example.com" | |
57 | +default['gitlab']['gitlab-rails']['uploads_directory'] = "/var/opt/gitlab/uploads" | |
58 | +default['gitlab']['gitlab-rails']['rate_limit_requests_per_period'] = 10 | |
59 | +default['gitlab']['gitlab-rails']['rate_limit_period'] = 60 | |
60 | 60 | |
61 | 61 | |
62 | 62 | #### |
... | ... | @@ -67,7 +67,7 @@ default['gitlab']['unicorn']['log_directory'] = "/var/log/gitlab/unicorn" |
67 | 67 | default['gitlab']['unicorn']['worker_processes'] = 2 |
68 | 68 | default['gitlab']['unicorn']['listen'] = '127.0.0.1' |
69 | 69 | default['gitlab']['unicorn']['port'] = 8080 |
70 | -default['gitlab']['unicorn']['socket'] = '/var/opt/gitlab/gitlab-core/tmp/sockets/gitlab.socket' | |
70 | +default['gitlab']['unicorn']['socket'] = '/var/opt/gitlab/gitlab-rails/tmp/sockets/gitlab.socket' | |
71 | 71 | default['gitlab']['unicorn']['tcp_nopush'] = true |
72 | 72 | default['gitlab']['unicorn']['backlog_socket'] = 64 |
73 | 73 | default['gitlab']['unicorn']['worker_timeout'] = 30 | ... | ... |
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
... | ... | @@ -28,7 +28,7 @@ module Gitlab |
28 | 28 | bootstrap Mash.new |
29 | 29 | postgresql Mash.new |
30 | 30 | redis Mash.new |
31 | - gitlab_core Mash.new | |
31 | + gitlab_rails Mash.new | |
32 | 32 | unicorn Mash.new |
33 | 33 | node nil |
34 | 34 | |
... | ... | @@ -51,7 +51,7 @@ module Gitlab |
51 | 51 | end |
52 | 52 | |
53 | 53 | Gitlab['postgresql']['sql_password'] ||= generate_hex(50) |
54 | - Gitlab['gitlab_core']['secret_token'] ||= generate_hex(64) | |
54 | + Gitlab['gitlab_rails']['secret_token'] ||= generate_hex(64) | |
55 | 55 | |
56 | 56 | if File.directory?("/etc/gitlab") |
57 | 57 | File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f| |
... | ... | @@ -60,8 +60,8 @@ module Gitlab |
60 | 60 | 'postgresql' => { |
61 | 61 | 'sql_password' => Gitlab['postgresql']['sql_password'], |
62 | 62 | }, |
63 | - 'gitlab_core' => { | |
64 | - 'secret_token' => Gitlab['gitlab_core']['secret_token'], | |
63 | + 'gitlab_rails' => { | |
64 | + 'secret_token' => Gitlab['gitlab_rails']['secret_token'], | |
65 | 65 | } |
66 | 66 | }) |
67 | 67 | ) |
... | ... | @@ -75,7 +75,7 @@ module Gitlab |
75 | 75 | [ |
76 | 76 | "bootstrap", |
77 | 77 | "redis", |
78 | - "gitlab_core", | |
78 | + "gitlab_rails", | |
79 | 79 | "unicorn", |
80 | 80 | "postgresql" |
81 | 81 | ].each do |key| | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb
... | ... | @@ -21,7 +21,7 @@ execute "initialize database" do |
21 | 21 | end |
22 | 22 | |
23 | 23 | user_group = "#{node['gitlab']['user']['username']}:#{node['gitlab']['user']['group']}" |
24 | -execute "chown #{user_group} /opt/gitlab/embedded/service/gitlab-core/db/schema.rb" | |
24 | +execute "chown #{user_group} /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb" | |
25 | 25 | |
26 | 26 | execute "migrate database" do |
27 | 27 | command "/opt/gitlab/bin/gitlab-rake db:migrate" | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/default.rb
... | ... | @@ -47,7 +47,7 @@ end |
47 | 47 | |
48 | 48 | include_recipe "gitlab::users" |
49 | 49 | include_recipe "gitlab::gitlab-shell" |
50 | -include_recipe "gitlab::gitlab-core" | |
50 | +include_recipe "gitlab::gitlab-rails" | |
51 | 51 | |
52 | 52 | # Create a dummy unicorn service to receive notifications, in case the |
53 | 53 | # gitlab::unicorn is not loaded below. | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb
... | ... | @@ -1,100 +0,0 @@ |
1 | -# | |
2 | -# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
3 | -# Copyright:: Copyright (c) 2014 GitLab.com | |
4 | -# License:: Apache License, Version 2.0 | |
5 | -# | |
6 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | -# you may not use this file except in compliance with the License. | |
8 | -# You may obtain a copy of the License at | |
9 | -# | |
10 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
11 | -# | |
12 | -# Unless required by applicable law or agreed to in writing, software | |
13 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
14 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | -# See the License for the specific language governing permissions and | |
16 | -# limitations under the License. | |
17 | -# | |
18 | - | |
19 | -gitlab_core_source_dir = "/opt/gitlab/embedded/service/gitlab-core" | |
20 | -gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] | |
21 | -gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") | |
22 | -gitlab_core_working_dir = File.join(gitlab_core_dir, "working") | |
23 | -gitlab_core_tmp_dir = File.join(gitlab_core_dir, "tmp") | |
24 | -gitlab_core_public_uploads_dir = node['gitlab']['gitlab-core']['uploads_directory'] | |
25 | -gitlab_core_log_dir = node['gitlab']['gitlab-core']['log_directory'] | |
26 | - | |
27 | -[ | |
28 | - gitlab_core_dir, | |
29 | - gitlab_core_etc_dir, | |
30 | - gitlab_core_working_dir, | |
31 | - gitlab_core_tmp_dir, | |
32 | - gitlab_core_public_uploads_dir, | |
33 | - gitlab_core_log_dir | |
34 | -].each do |dir_name| | |
35 | - directory dir_name do | |
36 | - owner node['gitlab']['user']['username'] | |
37 | - mode '0700' | |
38 | - recursive true | |
39 | - end | |
40 | -end | |
41 | - | |
42 | -should_notify_unicorn = OmnibusHelper.should_notify?("unicorn") | |
43 | - | |
44 | -template_symlink File.join(gitlab_core_etc_dir, "secret") do | |
45 | - link_from File.join(gitlab_core_source_dir, ".secret") | |
46 | - source "secret_token.erb" | |
47 | - owner "root" | |
48 | - group "root" | |
49 | - mode "0644" | |
50 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
51 | -end | |
52 | - | |
53 | -template_symlink File.join(gitlab_core_etc_dir, "database.yml") do | |
54 | - link_from File.join(gitlab_core_source_dir, "config/database.yml") | |
55 | - source "database.yml.postgresql.erb" | |
56 | - owner "root" | |
57 | - group "root" | |
58 | - mode "0644" | |
59 | - variables(node['gitlab']['postgresql'].to_hash) | |
60 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
61 | -end | |
62 | - | |
63 | -template_symlink File.join(gitlab_core_etc_dir, "gitlab.yml") do | |
64 | - link_from File.join(gitlab_core_source_dir, "config/gitlab.yml") | |
65 | - source "gitlab.yml.erb" | |
66 | - owner "root" | |
67 | - group "root" | |
68 | - mode "0644" | |
69 | - variables(node['gitlab']['gitlab-core'].to_hash) | |
70 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
71 | -end | |
72 | - | |
73 | -template_symlink File.join(gitlab_core_etc_dir, "rack_attack.rb") do | |
74 | - link_from File.join(gitlab_core_source_dir, "config/initializers/rack_attack.rb") | |
75 | - source "rack_attack.rb.erb" | |
76 | - owner "root" | |
77 | - group "root" | |
78 | - mode "0644" | |
79 | - variables(node['gitlab']['gitlab-core'].to_hash) | |
80 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
81 | -end | |
82 | - | |
83 | -directory node['gitlab']['gitlab-core']['satellites_path'] do | |
84 | - owner node['gitlab']['user']['username'] | |
85 | - group node['gitlab']['user']['group'] | |
86 | - recursive true | |
87 | -end | |
88 | - | |
89 | -# replace empty directories in the Git repo with symlinks to /var/opt/gitlab | |
90 | -{ | |
91 | - "/opt/gitlab/embedded/service/gitlab-core/tmp" => gitlab_core_tmp_dir, | |
92 | - "/opt/gitlab/embedded/service/gitlab-core/public/uploads" => gitlab_core_public_uploads_dir, | |
93 | - "/opt/gitlab/embedded/service/gitlab-core/log" => gitlab_core_log_dir | |
94 | -}.each do |link_dir, target_dir| | |
95 | - link link_dir do | |
96 | - to target_dir | |
97 | - end | |
98 | -end | |
99 | - | |
100 | -execute "chown -R #{node['gitlab']['user']['username']} /opt/gitlab/embedded/service/gitlab-core/public" |
... | ... | @@ -0,0 +1,100 @@ |
1 | +# | |
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
3 | +# Copyright:: Copyright (c) 2014 GitLab.com | |
4 | +# License:: Apache License, Version 2.0 | |
5 | +# | |
6 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | +# you may not use this file except in compliance with the License. | |
8 | +# You may obtain a copy of the License at | |
9 | +# | |
10 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
11 | +# | |
12 | +# Unless required by applicable law or agreed to in writing, software | |
13 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | +# See the License for the specific language governing permissions and | |
16 | +# limitations under the License. | |
17 | +# | |
18 | + | |
19 | +gitlab_rails_source_dir = "/opt/gitlab/embedded/service/gitlab-rails" | |
20 | +gitlab_rails_dir = node['gitlab']['gitlab-rails']['dir'] | |
21 | +gitlab_rails_etc_dir = File.join(gitlab_rails_dir, "etc") | |
22 | +gitlab_rails_working_dir = File.join(gitlab_rails_dir, "working") | |
23 | +gitlab_rails_tmp_dir = File.join(gitlab_rails_dir, "tmp") | |
24 | +gitlab_rails_public_uploads_dir = node['gitlab']['gitlab-rails']['uploads_directory'] | |
25 | +gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory'] | |
26 | + | |
27 | +[ | |
28 | + gitlab_rails_dir, | |
29 | + gitlab_rails_etc_dir, | |
30 | + gitlab_rails_working_dir, | |
31 | + gitlab_rails_tmp_dir, | |
32 | + gitlab_rails_public_uploads_dir, | |
33 | + gitlab_rails_log_dir | |
34 | +].each do |dir_name| | |
35 | + directory dir_name do | |
36 | + owner node['gitlab']['user']['username'] | |
37 | + mode '0700' | |
38 | + recursive true | |
39 | + end | |
40 | +end | |
41 | + | |
42 | +should_notify_unicorn = OmnibusHelper.should_notify?("unicorn") | |
43 | + | |
44 | +template_symlink File.join(gitlab_rails_etc_dir, "secret") do | |
45 | + link_from File.join(gitlab_rails_source_dir, ".secret") | |
46 | + source "secret_token.erb" | |
47 | + owner "root" | |
48 | + group "root" | |
49 | + mode "0644" | |
50 | + notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
51 | +end | |
52 | + | |
53 | +template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do | |
54 | + link_from File.join(gitlab_rails_source_dir, "config/database.yml") | |
55 | + source "database.yml.postgresql.erb" | |
56 | + owner "root" | |
57 | + group "root" | |
58 | + mode "0644" | |
59 | + variables(node['gitlab']['postgresql'].to_hash) | |
60 | + notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
61 | +end | |
62 | + | |
63 | +template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do | |
64 | + link_from File.join(gitlab_rails_source_dir, "config/gitlab.yml") | |
65 | + source "gitlab.yml.erb" | |
66 | + owner "root" | |
67 | + group "root" | |
68 | + mode "0644" | |
69 | + variables(node['gitlab']['gitlab-rails'].to_hash) | |
70 | + notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
71 | +end | |
72 | + | |
73 | +template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do | |
74 | + link_from File.join(gitlab_rails_source_dir, "config/initializers/rack_attack.rb") | |
75 | + source "rack_attack.rb.erb" | |
76 | + owner "root" | |
77 | + group "root" | |
78 | + mode "0644" | |
79 | + variables(node['gitlab']['gitlab-rails'].to_hash) | |
80 | + notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
81 | +end | |
82 | + | |
83 | +directory node['gitlab']['gitlab-rails']['satellites_path'] do | |
84 | + owner node['gitlab']['user']['username'] | |
85 | + group node['gitlab']['user']['group'] | |
86 | + recursive true | |
87 | +end | |
88 | + | |
89 | +# replace empty directories in the Git repo with symlinks to /var/opt/gitlab | |
90 | +{ | |
91 | + "/opt/gitlab/embedded/service/gitlab-rails/tmp" => gitlab_rails_tmp_dir, | |
92 | + "/opt/gitlab/embedded/service/gitlab-rails/public/uploads" => gitlab_rails_public_uploads_dir, | |
93 | + "/opt/gitlab/embedded/service/gitlab-rails/log" => gitlab_rails_log_dir | |
94 | +}.each do |link_dir, target_dir| | |
95 | + link link_dir do | |
96 | + to target_dir | |
97 | + end | |
98 | +end | |
99 | + | |
100 | +execute "chown -R #{node['gitlab']['user']['username']} /opt/gitlab/embedded/service/gitlab-rails/public" | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
... | ... | @@ -20,7 +20,7 @@ git_user = node['gitlab']['user']['username'] |
20 | 20 | git_group = node['gitlab']['user']['group'] |
21 | 21 | gitlab_shell_dir = "/opt/gitlab/embedded/service/gitlab-shell" |
22 | 22 | gitlab_shell_var_dir = "/var/opt/gitlab/gitlab-shell" |
23 | -repositories_path = node['gitlab']['gitlab-core']['repositories_path'] | |
23 | +repositories_path = node['gitlab']['gitlab-rails']['repositories_path'] | |
24 | 24 | ssh_dir = File.join(node['gitlab']['user']['home'], ".ssh") |
25 | 25 | log_directory = node['gitlab']['gitlab-shell']['log_directory'] |
26 | 26 | |
... | ... | @@ -54,7 +54,7 @@ template_symlink File.join(gitlab_shell_var_dir, "config.yml") do |
54 | 54 | source "gitlab-shell-config.yml.erb" |
55 | 55 | variables( |
56 | 56 | :user => git_user, |
57 | - :api_url => node['gitlab']['gitlab-core']['internal_api_url'], | |
57 | + :api_url => node['gitlab']['gitlab-rails']['internal_api_url'], | |
58 | 58 | :repositories_path => repositories_path, |
59 | 59 | :authorized_keys => File.join(ssh_dir, "authorized_keys"), |
60 | 60 | :redis_port => node['gitlab']['redis']['port'], | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/unicorn.rb
... | ... | @@ -16,9 +16,9 @@ |
16 | 16 | # limitations under the License. |
17 | 17 | # |
18 | 18 | |
19 | -gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] | |
20 | -gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") | |
21 | -gitlab_core_working_dir = File.join(gitlab_core_dir, "working") | |
19 | +gitlab_rails_dir = node['gitlab']['gitlab-rails']['dir'] | |
20 | +gitlab_rails_etc_dir = File.join(gitlab_rails_dir, "etc") | |
21 | +gitlab_rails_working_dir = File.join(gitlab_rails_dir, "working") | |
22 | 22 | |
23 | 23 | unicorn_listen_socket = node['gitlab']['unicorn']['socket'] |
24 | 24 | unicorn_log_dir = node['gitlab']['unicorn']['log_directory'] |
... | ... | @@ -38,7 +38,7 @@ end |
38 | 38 | unicorn_listen_tcp = node['gitlab']['unicorn']['listen'] |
39 | 39 | unicorn_listen_tcp << ":#{node['gitlab']['unicorn']['port']}" |
40 | 40 | |
41 | -unicorn_config File.join(gitlab_core_etc_dir, "unicorn.rb") do | |
41 | +unicorn_config File.join(gitlab_rails_etc_dir, "unicorn.rb") do | |
42 | 42 | listen( |
43 | 43 | unicorn_listen_tcp => { |
44 | 44 | :tcp_nopush => node['gitlab']['unicorn']['tcp_nopush'] |
... | ... | @@ -48,7 +48,7 @@ unicorn_config File.join(gitlab_core_etc_dir, "unicorn.rb") do |
48 | 48 | } |
49 | 49 | ) |
50 | 50 | worker_timeout node['gitlab']['unicorn']['worker_timeout'] |
51 | - working_directory gitlab_core_working_dir | |
51 | + working_directory gitlab_rails_working_dir | |
52 | 52 | worker_processes node['gitlab']['unicorn']['worker_processes'] |
53 | 53 | preload_app true |
54 | 54 | owner "root" | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb
... | ... | @@ -15,9 +15,9 @@ production: &base |
15 | 15 | ## GitLab settings |
16 | 16 | gitlab: |
17 | 17 | ## Web server settings (note: host is the FQDN, do not include http://) |
18 | - host: <%= node['gitlab']['gitlab-core']['external_fqdn'] %> | |
19 | - port: <%= node['gitlab']['gitlab-core']['external_port'] %> | |
20 | - https: <%= node['gitlab']['gitlab-core']['external_https'] %> | |
18 | + host: <%= node['gitlab']['gitlab-rails']['external_fqdn'] %> | |
19 | + port: <%= node['gitlab']['gitlab-rails']['external_port'] %> | |
20 | + https: <%= node['gitlab']['gitlab-rails']['external_https'] %> | |
21 | 21 | |
22 | 22 | # Uncomment and customize the last line to run in a non-root path |
23 | 23 | # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. |
... | ... | @@ -35,10 +35,10 @@ production: &base |
35 | 35 | |
36 | 36 | ## Email settings |
37 | 37 | # Email address used in the "From" field in mails sent by GitLab |
38 | - email_from: <%= node['gitlab']['gitlab-core']['notification_email'] %> | |
38 | + email_from: <%= node['gitlab']['gitlab-rails']['notification_email'] %> | |
39 | 39 | |
40 | 40 | # Email address of your support contact (default: same as email_from) |
41 | - support_email: <%= node['gitlab']['gitlab-core']['support_email'] %> | |
41 | + support_email: <%= node['gitlab']['gitlab-rails']['support_email'] %> | |
42 | 42 | |
43 | 43 | ## User settings |
44 | 44 | default_projects_limit: 10 |
... | ... | @@ -175,7 +175,7 @@ production: &base |
175 | 175 | # GitLab Satellites |
176 | 176 | satellites: |
177 | 177 | # Relative paths are relative to Rails.root (default: tmp/repo_satellites/) |
178 | - path: <%= node['gitlab']['gitlab-core']['satellites_path'] %> | |
178 | + path: <%= node['gitlab']['gitlab-rails']['satellites_path'] %> | |
179 | 179 | |
180 | 180 | ## Backup settings |
181 | 181 | backup: |
... | ... | @@ -187,7 +187,7 @@ production: &base |
187 | 187 | path: /opt/gitlab/embedded/service/gitlab-shell/ |
188 | 188 | |
189 | 189 | # REPOS_PATH MUST NOT BE A SYMLINK!!! |
190 | - repos_path: <%= node['gitlab']['gitlab-core']['repositories_path'] %> | |
190 | + repos_path: <%= node['gitlab']['gitlab-rails']['repositories_path'] %> | |
191 | 191 | hooks_path: /opt/gitlab/embedded/service/gitlab-shell/hooks/ |
192 | 192 | |
193 | 193 | # Git over HTTP | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/rack_attack.rb.erb
... | ... | @@ -12,7 +12,7 @@ paths_to_be_protected = [ |
12 | 12 | ] |
13 | 13 | |
14 | 14 | unless Rails.env.test? |
15 | - Rack::Attack.throttle('protected paths', limit: <%= node['gitlab']['gitlab-core']['rate_limit_requests_per_period'] %>, period: <%= node['gitlab']['gitlab-core']['rate_limit_period'] %>.seconds) do |req| | |
15 | + Rack::Attack.throttle('protected paths', limit: <%= node['gitlab']['gitlab-rails']['rate_limit_requests_per_period'] %>, period: <%= node['gitlab']['gitlab-rails']['rate_limit_period'] %>.seconds) do |req| | |
16 | 16 | req.ip if paths_to_be_protected.include?(req.path) && req.post? |
17 | 17 | end |
18 | 18 | end | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb
files/gitlab-cookbooks/gitlab/templates/default/sv-unicorn-run.erb
1 | 1 | #!/bin/sh |
2 | 2 | |
3 | -cd /opt/gitlab/embedded/service/gitlab-core | |
3 | +cd /opt/gitlab/embedded/service/gitlab-rails | |
4 | 4 | |
5 | 5 | exec 2>&1 |
6 | -exec chpst -P -U <%= node['gitlab']['user']['username'] %> -u <%= node['gitlab']['user']['username'] %> /usr/bin/env HOME="<%= node['gitlab']['gitlab-core']['dir'] %>" /opt/gitlab/embedded/bin/bundle exec unicorn -E <%= node['gitlab']['gitlab-core']['environment'] %> -c <%= File.join(node['gitlab']['gitlab-core']['dir'], "etc", "unicorn.rb") %> /opt/gitlab/embedded/service/gitlab-core/config.ru | |
6 | +exec chpst -P -U <%= node['gitlab']['user']['username'] %> -u <%= node['gitlab']['user']['username'] %> /usr/bin/env HOME="<%= node['gitlab']['gitlab-rails']['dir'] %>" /opt/gitlab/embedded/bin/bundle exec unicorn -E <%= node['gitlab']['gitlab-rails']['environment'] %> -c <%= File.join(node['gitlab']['gitlab-rails']['dir'], "etc", "unicorn.rb") %> /opt/gitlab/embedded/service/gitlab-rails/config.ru | ... | ... |