Commit 1a5d0a7fee7bdb8d706d36c99cbce386d7fa799f
1 parent
1f3c9ea0
Exists in
master
and in
17 other branches
Replace chef.server with gitlab in nginx files
Showing
3 changed files
with
31 additions
and
30 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/recipes/nginx.rb
| 1 | 1 | # |
| 2 | 2 | # Copyright:: Copyright (c) 2012 Opscode, Inc. |
| 3 | +# Copyright:: Copyright (c) 2014 GitLab.com | |
| 3 | 4 | # License:: Apache License, Version 2.0 |
| 4 | 5 | # |
| 5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| ... | ... | @@ -15,13 +16,13 @@ |
| 15 | 16 | # limitations under the License. |
| 16 | 17 | # |
| 17 | 18 | |
| 18 | -nginx_dir = node['chef_server']['nginx']['dir'] | |
| 19 | +nginx_dir = node['gitlab']['nginx']['dir'] | |
| 19 | 20 | nginx_etc_dir = File.join(nginx_dir, "etc") |
| 20 | 21 | nginx_cache_dir = File.join(nginx_dir, "cache") |
| 21 | 22 | nginx_cache_tmp_dir = File.join(nginx_dir, "cache-tmp") |
| 22 | 23 | nginx_html_dir = File.join(nginx_dir, "html") |
| 23 | 24 | nginx_ca_dir = File.join(nginx_dir, "ca") |
| 24 | -nginx_log_dir = node['chef_server']['nginx']['log_directory'] | |
| 25 | +nginx_log_dir = node['gitlab']['nginx']['log_directory'] | |
| 25 | 26 | |
| 26 | 27 | [ |
| 27 | 28 | nginx_dir, |
| ... | ... | @@ -33,22 +34,22 @@ nginx_log_dir = node['chef_server']['nginx']['log_directory'] |
| 33 | 34 | nginx_log_dir, |
| 34 | 35 | ].each do |dir_name| |
| 35 | 36 | directory dir_name do |
| 36 | - owner node['chef_server']['user']['username'] | |
| 37 | + owner node['gitlab']['user']['username'] | |
| 37 | 38 | mode '0700' |
| 38 | 39 | recursive true |
| 39 | 40 | end |
| 40 | 41 | end |
| 41 | 42 | |
| 42 | -ssl_keyfile = File.join(nginx_ca_dir, "#{node['chef_server']['nginx']['server_name']}.key") | |
| 43 | -ssl_crtfile = File.join(nginx_ca_dir, "#{node['chef_server']['nginx']['server_name']}.crt") | |
| 44 | -ssl_signing_conf = File.join(nginx_ca_dir, "#{node['chef_server']['nginx']['server_name']}-ssl.conf") | |
| 43 | +ssl_keyfile = File.join(nginx_ca_dir, "#{node['gitlab']['nginx']['server_name']}.key") | |
| 44 | +ssl_crtfile = File.join(nginx_ca_dir, "#{node['gitlab']['nginx']['server_name']}.crt") | |
| 45 | +ssl_signing_conf = File.join(nginx_ca_dir, "#{node['gitlab']['nginx']['server_name']}-ssl.conf") | |
| 45 | 46 | |
| 46 | 47 | unless File.exists?(ssl_keyfile) && File.exists?(ssl_crtfile) && File.exists?(ssl_signing_conf) |
| 47 | 48 | file ssl_keyfile do |
| 48 | 49 | owner "root" |
| 49 | 50 | group "root" |
| 50 | 51 | mode "0644" |
| 51 | - content `/opt/chef-server/embedded/bin/openssl genrsa 2048` | |
| 52 | + content `/opt/gitlab/embedded/bin/openssl genrsa 2048` | |
| 52 | 53 | not_if { File.exists?(ssl_keyfile) } |
| 53 | 54 | end |
| 54 | 55 | |
| ... | ... | @@ -63,13 +64,13 @@ unless File.exists?(ssl_keyfile) && File.exists?(ssl_crtfile) && File.exists?(ss |
| 63 | 64 | prompt = no |
| 64 | 65 | |
| 65 | 66 | [ req_distinguished_name ] |
| 66 | - C = #{node['chef_server']['nginx']['ssl_country_name']} | |
| 67 | - ST = #{node['chef_server']['nginx']['ssl_state_name']} | |
| 68 | - L = #{node['chef_server']['nginx']['ssl_locality_name']} | |
| 69 | - O = #{node['chef_server']['nginx']['ssl_company_name']} | |
| 70 | - OU = #{node['chef_server']['nginx']['ssl_organizational_unit_name']} | |
| 71 | - CN = #{node['chef_server']['nginx']['server_name']} | |
| 72 | - emailAddress = #{node['chef_server']['nginx']['ssl_email_address']} | |
| 67 | + C = #{node['gitlab']['nginx']['ssl_country_name']} | |
| 68 | + ST = #{node['gitlab']['nginx']['ssl_state_name']} | |
| 69 | + L = #{node['gitlab']['nginx']['ssl_locality_name']} | |
| 70 | + O = #{node['gitlab']['nginx']['ssl_company_name']} | |
| 71 | + OU = #{node['gitlab']['nginx']['ssl_organizational_unit_name']} | |
| 72 | + CN = #{node['gitlab']['nginx']['server_name']} | |
| 73 | + emailAddress = #{node['gitlab']['nginx']['ssl_email_address']} | |
| 73 | 74 | EOH |
| 74 | 75 | end |
| 75 | 76 | |
| ... | ... | @@ -79,15 +80,15 @@ unless File.exists?(ssl_keyfile) && File.exists?(ssl_crtfile) && File.exists?(ss |
| 79 | 80 | r.owner "root" |
| 80 | 81 | r.group "root" |
| 81 | 82 | r.mode "0644" |
| 82 | - r.content `/opt/chef-server/embedded/bin/openssl req -config '#{ssl_signing_conf}' -new -x509 -nodes -sha1 -days 3650 -key #{ssl_keyfile}` | |
| 83 | + r.content `/opt/gitlab/embedded/bin/openssl req -config '#{ssl_signing_conf}' -new -x509 -nodes -sha1 -days 3650 -key #{ssl_keyfile}` | |
| 83 | 84 | r.not_if { File.exists?(ssl_crtfile) } |
| 84 | 85 | r.run_action(:create) |
| 85 | 86 | end |
| 86 | 87 | end |
| 87 | 88 | end |
| 88 | 89 | |
| 89 | -node.default['chef_server']['nginx']['ssl_certificate'] ||= ssl_crtfile | |
| 90 | -node.default['chef_server']['nginx']['ssl_certificate_key'] ||= ssl_keyfile | |
| 90 | +node.default['gitlab']['nginx']['ssl_certificate'] ||= ssl_crtfile | |
| 91 | +node.default['gitlab']['nginx']['ssl_certificate_key'] ||= ssl_keyfile | |
| 91 | 92 | |
| 92 | 93 | remote_directory nginx_html_dir do |
| 93 | 94 | source "html" |
| ... | ... | @@ -95,12 +96,12 @@ remote_directory nginx_html_dir do |
| 95 | 96 | files_owner "root" |
| 96 | 97 | files_group "root" |
| 97 | 98 | files_mode "0644" |
| 98 | - owner node['chef_server']['user']['username'] | |
| 99 | + owner node['gitlab']['user']['username'] | |
| 99 | 100 | mode "0700" |
| 100 | 101 | end |
| 101 | 102 | |
| 102 | 103 | nginx_config = File.join(nginx_etc_dir, "nginx.conf") |
| 103 | -nginx_vars = node['chef_server']['nginx'].to_hash.merge({ | |
| 104 | +nginx_vars = node['gitlab']['nginx'].to_hash.merge({ | |
| 104 | 105 | :chef_https_config => File.join(nginx_etc_dir, "chef_https_lb.conf"), |
| 105 | 106 | :chef_http_config => File.join(nginx_etc_dir, "chef_http_lb.conf") |
| 106 | 107 | }) |
| ... | ... | @@ -140,14 +141,14 @@ template nginx_config do |
| 140 | 141 | end |
| 141 | 142 | |
| 142 | 143 | runit_service "nginx" do |
| 143 | - down node['chef_server']['nginx']['ha'] | |
| 144 | + down node['gitlab']['nginx']['ha'] | |
| 144 | 145 | options({ |
| 145 | 146 | :log_directory => nginx_log_dir |
| 146 | 147 | }.merge(params)) |
| 147 | 148 | end |
| 148 | 149 | |
| 149 | -if node['chef_server']['bootstrap']['enable'] | |
| 150 | - execute "/opt/chef-server/bin/chef-server-ctl start nginx" do | |
| 150 | +if node['gitlab']['bootstrap']['enable'] | |
| 151 | + execute "/opt/gitlab/bin/gitlab-ctl start nginx" do | |
| 151 | 152 | retries 20 |
| 152 | 153 | end |
| 153 | 154 | end | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/nginx.conf.erb
| 1 | -user <%= node['chef_server']['user']['username'] %> <%= node['chef_server']['user']['username']%>; | |
| 1 | +user <%= node['gitlab']['user']['username'] %> <%= node['gitlab']['user']['username']%>; | |
| 2 | 2 | worker_processes <%= @worker_processes %>; |
| 3 | -error_log /var/log/chef-server/nginx/error.log<%= node['chef_server']['lb']['debug'] ? " debug" : "" %>; | |
| 3 | +error_log /var/log/gitlab/nginx/error.log<%= node['gitlab']['lb']['debug'] ? " debug" : "" %>; | |
| 4 | 4 | |
| 5 | 5 | daemon off; |
| 6 | 6 | |
| ... | ... | @@ -25,18 +25,18 @@ http { |
| 25 | 25 | gzip_proxied <%= @gzip_proxied %>; |
| 26 | 26 | gzip_types <%= @gzip_types.join(' ') %>; |
| 27 | 27 | |
| 28 | - include /opt/chef-server/embedded/conf/mime.types; | |
| 28 | + include /opt/gitlab/embedded/conf/mime.types; | |
| 29 | 29 | |
| 30 | - <%- node['chef_server']['lb']['upstream'].each do |uname, servers| -%> | |
| 30 | + <%- node['gitlab']['lb']['upstream'].each do |uname, servers| -%> | |
| 31 | 31 | upstream <%= uname.gsub(/-/, '_') %> { |
| 32 | 32 | <%- servers.each do |server| -%> |
| 33 | - server <%= server %>:<%= node['chef_server'][uname]['port'] %>; | |
| 33 | + server <%= server %>:<%= node['gitlab'][uname]['port'] %>; | |
| 34 | 34 | <%- end -%> |
| 35 | 35 | } |
| 36 | 36 | <%- end -%> |
| 37 | 37 | |
| 38 | 38 | # external lb config for Chef API |
| 39 | - <%- if node['chef_server']['lb']['enable'] -%> | |
| 39 | + <%- if node['gitlab']['lb']['enable'] -%> | |
| 40 | 40 | proxy_cache_path <%= File.join(@dir, "cache") %> levels=1:2 keys_zone=webui-cache:50m max_size=<%= @cache_max_size %> inactive=600m; |
| 41 | 41 | proxy_temp_path <%= File.join(@dir, "cache-tmp") %>; |
| 42 | 42 | |
| ... | ... | @@ -51,7 +51,7 @@ http { |
| 51 | 51 | |
| 52 | 52 | server { |
| 53 | 53 | listen <%= @non_ssl_port %>; |
| 54 | - access_log /var/log/chef-server/nginx/rewrite-port-<%= @non_ssl_port %>.log; | |
| 54 | + access_log /var/log/gitlab/nginx/rewrite-port-<%= @non_ssl_port %>.log; | |
| 55 | 55 | return 301 https://$host:<%= @ssl_port %>$request_uri; |
| 56 | 56 | } |
| 57 | 57 | <%- end -%> | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/sv-nginx-run.erb