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 | 16 | # limitations under the License. |
| 17 | 17 | # |
| 18 | 18 | |
| 19 | +gitlab_core_source_dir = "/opt/gitlab/embedded/service/gitlab-core" | |
| 19 | 20 | gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] |
| 20 | 21 | gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") |
| 21 | 22 | gitlab_core_working_dir = File.join(gitlab_core_dir, "working") |
| ... | ... | @@ -42,22 +43,17 @@ end |
| 42 | 43 | |
| 43 | 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 | 49 | owner "root" |
| 50 | 50 | group "root" |
| 51 | 51 | mode "0644" |
| 52 | 52 | notifies :restart, 'service[gitlab-core]' if should_notify |
| 53 | 53 | end |
| 54 | 54 | |
| 55 | -link "/opt/gitlab/embedded/service/gitlab-core/.secret" do | |
| 56 | - to secret_token_config | |
| 57 | -end | |
| 58 | - | |
| 59 | 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 | 57 | source "database.yml.postgresql.erb" |
| 62 | 58 | owner "root" |
| 63 | 59 | group "root" |
| ... | ... | @@ -66,9 +62,8 @@ template_symlink File.join(gitlab_core_etc_dir, "database.yml") do |
| 66 | 62 | notifies :restart, 'service[gitlab-core]' if should_notify |
| 67 | 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 | 67 | source "gitlab.yml.erb" |
| 73 | 68 | owner "root" |
| 74 | 69 | group "root" |
| ... | ... | @@ -77,13 +72,8 @@ template gitlab_yml do |
| 77 | 72 | notifies :restart, 'service[gitlab-core]' if should_notify |
| 78 | 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 | 77 | source "rack_attack.rb.erb" |
| 88 | 78 | owner "root" |
| 89 | 79 | group "root" |
| ... | ... | @@ -92,10 +82,6 @@ template rack_attack do |
| 92 | 82 | notifies :restart, 'service[gitlab-core]' if should_notify |
| 93 | 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 | 85 | directory node['gitlab']['gitlab-core']['satellites_path'] do |
| 100 | 86 | owner node['gitlab']['user']['username'] |
| 101 | 87 | group node['gitlab']['user']['group'] | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb
0 → 100644
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +<%= node['gitlab']['gitlab-core']['secret_token'] %> | ... | ... |