Commit a98e398cfab943e53816cfe8994e472a2c3e6daf
1 parent
c720190f
Exists in
master
Add webserver recipe and attributes.
Showing
4 changed files
with
43 additions
and
1 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/attributes/default.rb
@@ -233,6 +233,14 @@ default['gitlab']['redis']['shell'] = "/bin/nologin" | @@ -233,6 +233,14 @@ default['gitlab']['redis']['shell'] = "/bin/nologin" | ||
233 | default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis" | 233 | default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis" |
234 | default['gitlab']['redis']['port'] = 6379 | 234 | default['gitlab']['redis']['port'] = 6379 |
235 | 235 | ||
236 | +#### | ||
237 | +# Web server | ||
238 | +#### | ||
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 | ||
236 | 244 | ||
237 | #### | 245 | #### |
238 | # Nginx | 246 | # Nginx |
files/gitlab-cookbooks/gitlab/recipes/default.rb
@@ -49,6 +49,7 @@ include_recipe "gitlab::users" | @@ -49,6 +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 | 53 | ||
53 | # Create dummy unicorn and sidekiq services to receive notifications, in case | 54 | # Create dummy unicorn and sidekiq services to receive notifications, in case |
54 | # the corresponding service recipe is not loaded below. | 55 | # the corresponding service recipe is not loaded below. |
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
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 |
files/gitlab-cookbooks/gitlab/templates/default/nginx.conf.erb
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | # erased! To change the contents below, edit /etc/gitlab/gitlab.rb | 2 | # erased! To change the contents below, edit /etc/gitlab/gitlab.rb |
3 | # and run `sudo gitlab-ctl reconfigure`. | 3 | # and run `sudo gitlab-ctl reconfigure`. |
4 | 4 | ||
5 | -user <%= node['gitlab']['user']['username'] %> <%= node['gitlab']['user']['username']%>; | 5 | +user <%= node['gitlab']['user']['username'] %> <%= node['gitlab']['web_server']['username']%>; |
6 | worker_processes <%= @worker_processes %>; | 6 | worker_processes <%= @worker_processes %>; |
7 | error_log /var/log/gitlab/nginx/error.log; | 7 | error_log /var/log/gitlab/nginx/error.log; |
8 | pid /var/opt/gitlab/nginx/nginx.pid; | 8 | pid /var/opt/gitlab/nginx/nginx.pid; |