Commit 4581372fce352641dfeb06c37765f76a6d8f2255

Authored by Marin Jankovski
1 parent ecff897d
Exists in master

Incorporate suggestions.

files/gitlab-cookbooks/gitlab/attributes/default.rb
@@ -237,10 +237,11 @@ default['gitlab']['redis']['port'] = 6379 @@ -237,10 +237,11 @@ default['gitlab']['redis']['port'] = 6379
237 # Web server 237 # Web server
238 #### 238 ####
239 # Username for the webserver user 239 # Username for the webserver user
240 -default['gitlab']['webserver']['username'] = 'gitlab-www'  
241 -default['gitlab']['webserver']['group'] = 'gitlab-www'  
242 -default['gitlab']['webserver']['uid'] = nil  
243 -default['gitlab']['webserver']['gid'] = nil 240 +default['gitlab']['web-server']['username'] = 'gitlab-www'
  241 +default['gitlab']['web-server']['group'] = 'gitlab-www'
  242 +default['gitlab']['web-server']['uid'] = nil
  243 +default['gitlab']['web-server']['gid'] = nil
  244 +default['gitlab']['web-server']['shell'] = "/bin/false"
244 245
245 #### 246 ####
246 # Nginx 247 # Nginx
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
@@ -46,6 +46,7 @@ module Gitlab @@ -46,6 +46,7 @@ module Gitlab
46 logging Mash.new 46 logging Mash.new
47 remote_syslog Mash.new 47 remote_syslog Mash.new
48 high_availability Mash.new 48 high_availability Mash.new
  49 + web_server Mash.new
49 node nil 50 node nil
50 external_url nil 51 external_url nil
51 git_data_dir nil 52 git_data_dir nil
@@ -170,7 +171,8 @@ module Gitlab @@ -170,7 +171,8 @@ module Gitlab
170 "logging", 171 "logging",
171 "remote_syslog", 172 "remote_syslog",
172 "high_availability", 173 "high_availability",
173 - "postgresql" 174 + "postgresql",
  175 + "web_server"
174 ].each do |key| 176 ].each do |key|
175 rkey = key.gsub('_', '-') 177 rkey = key.gsub('_', '-')
176 results['gitlab'][rkey] = Gitlab[key] 178 results['gitlab'][rkey] = Gitlab[key]
files/gitlab-cookbooks/gitlab/recipes/default.rb
@@ -49,7 +49,7 @@ include_recipe "gitlab::users" @@ -49,7 +49,7 @@ include_recipe "gitlab::users"
49 include_recipe "gitlab::gitlab-shell" 49 include_recipe "gitlab::gitlab-shell"
50 include_recipe "gitlab::gitlab-rails" 50 include_recipe "gitlab::gitlab-rails"
51 include_recipe "gitlab::selinux" 51 include_recipe "gitlab::selinux"
52 -include_recipe "gitlab::web_server" 52 +include_recipe "gitlab::web-server"
53 53
54 # Create dummy unicorn and sidekiq services to receive notifications, in case 54 # Create dummy unicorn and sidekiq services to receive notifications, in case
55 # the corresponding service recipe is not loaded below. 55 # the corresponding service recipe is not loaded below.
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
@@ -49,7 +49,7 @@ end @@ -49,7 +49,7 @@ end
49 49
50 directory gitlab_rails_public_uploads_dir do 50 directory gitlab_rails_public_uploads_dir do
51 owner node['gitlab']['user']['username'] 51 owner node['gitlab']['user']['username']
52 - group node['gitlab']['webserver']['username'] 52 + group node['gitlab']['web-server']['username']
53 mode '0750' 53 mode '0750'
54 recursive true 54 recursive true
55 end 55 end
files/gitlab-cookbooks/gitlab/recipes/unicorn.rb
@@ -38,7 +38,7 @@ end @@ -38,7 +38,7 @@ end
38 38
39 directory unicorn_socket_dir do 39 directory unicorn_socket_dir do
40 owner node['gitlab']['user']['username'] 40 owner node['gitlab']['user']['username']
41 - group node['gitlab']['webserver']['username'] 41 + group node['gitlab']['web-server']['username']
42 mode '0750' 42 mode '0750'
43 recursive true 43 recursive true
44 end 44 end
files/gitlab-cookbooks/gitlab/recipes/web-server.rb 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +#
  2 +# Copyright:: Copyright (c) 2014 GitLab B.V.
  3 +# License:: Apache License, Version 2.0
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +webserver_username = node['gitlab']['web-server']['username']
  19 +webserver_group = node['gitlab']['web-server']['group']
  20 +
  21 +# Create the group for the GitLab user
  22 +group webserver_group do
  23 + gid node['gitlab']['web-server']['gid']
  24 +end
  25 +
  26 +# Create the webserver user
  27 +user webserver_username do
  28 + shell node['gitlab']['web-server']['shell']
  29 + uid node['gitlab']['web-server']['uid']
  30 + gid webserver_group
  31 + supports manage_home: false
  32 +end
files/gitlab-cookbooks/gitlab/recipes/web_server.rb
@@ -1,33 +0,0 @@ @@ -1,33 +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 -webserver_username = node['gitlab']['webserver']['username']  
20 -webserver_group = node['gitlab']['webserver']['group']  
21 -  
22 -# Create the group for the GitLab user  
23 -group webserver_group do  
24 - gid node['gitlab']['webserver']['gid']  
25 -end  
26 -  
27 -# Create the webserver user  
28 -user webserver_username do  
29 - shell node['gitlab']['user']['shell']  
30 - uid node['gitlab']['webserver']['uid']  
31 - gid webserver_group  
32 - supports manage_home: false  
33 -end