Commit a72d018f8cf3c4e14c27104835c88188ece4a462
1 parent
60033750
Exists in
master
and in
17 other branches
Use template_symlink helper in gitlab-core.rb
Showing
2 changed files
with
10 additions
and
23 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb
@@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
16 | # limitations under the License. | 16 | # limitations under the License. |
17 | # | 17 | # |
18 | 18 | ||
19 | +gitlab_core_source_dir = "/opt/gitlab/embedded/service/gitlab-core" | ||
19 | gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] | 20 | gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] |
20 | gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") | 21 | gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") |
21 | gitlab_core_working_dir = File.join(gitlab_core_dir, "working") | 22 | gitlab_core_working_dir = File.join(gitlab_core_dir, "working") |
@@ -42,22 +43,17 @@ end | @@ -42,22 +43,17 @@ end | ||
42 | 43 | ||
43 | should_notify = OmnibusHelper.should_notify?("gitlab-core") | 44 | should_notify = OmnibusHelper.should_notify?("gitlab-core") |
44 | 45 | ||
45 | -secret_token_config = File.join(gitlab_core_etc_dir, "secret") | ||
46 | - | ||
47 | -file secret_token_config do | ||
48 | - content node['gitlab']['gitlab-core']['secret_token'] | 46 | +template_symlink File.join(gitlab_core_etc_dir, "secret") do |
47 | + link_from File.join(gitlab_core_source_dir, ".secret") | ||
48 | + source "secret_token.erb" | ||
49 | owner "root" | 49 | owner "root" |
50 | group "root" | 50 | group "root" |
51 | mode "0644" | 51 | mode "0644" |
52 | notifies :restart, 'service[gitlab-core]' if should_notify | 52 | notifies :restart, 'service[gitlab-core]' if should_notify |
53 | end | 53 | end |
54 | 54 | ||
55 | -link "/opt/gitlab/embedded/service/gitlab-core/.secret" do | ||
56 | - to secret_token_config | ||
57 | -end | ||
58 | - | ||
59 | template_symlink File.join(gitlab_core_etc_dir, "database.yml") do | 55 | template_symlink File.join(gitlab_core_etc_dir, "database.yml") do |
60 | - link_from "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" | 56 | + link_from File.join(gitlab_core_source_dir, "config/database.yml") |
61 | source "database.yml.postgresql.erb" | 57 | source "database.yml.postgresql.erb" |
62 | owner "root" | 58 | owner "root" |
63 | group "root" | 59 | group "root" |
@@ -66,9 +62,8 @@ template_symlink File.join(gitlab_core_etc_dir, "database.yml") do | @@ -66,9 +62,8 @@ template_symlink File.join(gitlab_core_etc_dir, "database.yml") do | ||
66 | notifies :restart, 'service[gitlab-core]' if should_notify | 62 | notifies :restart, 'service[gitlab-core]' if should_notify |
67 | end | 63 | end |
68 | 64 | ||
69 | -gitlab_yml = File.join(gitlab_core_etc_dir, "gitlab.yml") | ||
70 | - | ||
71 | -template gitlab_yml do | 65 | +template_symlink File.join(gitlab_core_etc_dir, "gitlab.yml") do |
66 | + link_from File.join(gitlab_core_source_dir, "config/gitlab.yml") | ||
72 | source "gitlab.yml.erb" | 67 | source "gitlab.yml.erb" |
73 | owner "root" | 68 | owner "root" |
74 | group "root" | 69 | group "root" |
@@ -77,13 +72,8 @@ template gitlab_yml do | @@ -77,13 +72,8 @@ template gitlab_yml do | ||
77 | notifies :restart, 'service[gitlab-core]' if should_notify | 72 | notifies :restart, 'service[gitlab-core]' if should_notify |
78 | end | 73 | end |
79 | 74 | ||
80 | -link "/opt/gitlab/embedded/service/gitlab-core/config/gitlab.yml" do | ||
81 | - to gitlab_yml | ||
82 | -end | ||
83 | - | ||
84 | -rack_attack = File.join(gitlab_core_etc_dir, "rack_attack.rb") | ||
85 | - | ||
86 | -template rack_attack do | 75 | +template_symlink File.join(gitlab_core_etc_dir, "rack_attack.rb") do |
76 | + link_from File.join(gitlab_core_source_dir, "config/initializers/rack_attack.rb") | ||
87 | source "rack_attack.rb.erb" | 77 | source "rack_attack.rb.erb" |
88 | owner "root" | 78 | owner "root" |
89 | group "root" | 79 | group "root" |
@@ -92,10 +82,6 @@ template rack_attack do | @@ -92,10 +82,6 @@ template rack_attack do | ||
92 | notifies :restart, 'service[gitlab-core]' if should_notify | 82 | notifies :restart, 'service[gitlab-core]' if should_notify |
93 | end | 83 | end |
94 | 84 | ||
95 | -link "/opt/gitlab/embedded/service/gitlab-core/config/initializers/rack_attack.rb" do | ||
96 | - to rack_attack | ||
97 | -end | ||
98 | - | ||
99 | directory node['gitlab']['gitlab-core']['satellites_path'] do | 85 | directory node['gitlab']['gitlab-core']['satellites_path'] do |
100 | owner node['gitlab']['user']['username'] | 86 | owner node['gitlab']['user']['username'] |
101 | group node['gitlab']['user']['group'] | 87 | group node['gitlab']['user']['group'] |
files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb
0 → 100644
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +<%= node['gitlab']['gitlab-core']['secret_token'] %> |