From 4581372fce352641dfeb06c37765f76a6d8f2255 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 28 Aug 2014 17:42:45 +0200 Subject: [PATCH] Incorporate suggestions. --- files/gitlab-cookbooks/gitlab/attributes/default.rb | 9 +++++---- files/gitlab-cookbooks/gitlab/libraries/gitlab.rb | 4 +++- files/gitlab-cookbooks/gitlab/recipes/default.rb | 2 +- files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb | 2 +- files/gitlab-cookbooks/gitlab/recipes/unicorn.rb | 2 +- files/gitlab-cookbooks/gitlab/recipes/web-server.rb | 32 ++++++++++++++++++++++++++++++++ files/gitlab-cookbooks/gitlab/recipes/web_server.rb | 33 --------------------------------- 7 files changed, 43 insertions(+), 41 deletions(-) create mode 100644 files/gitlab-cookbooks/gitlab/recipes/web-server.rb delete mode 100644 files/gitlab-cookbooks/gitlab/recipes/web_server.rb diff --git a/files/gitlab-cookbooks/gitlab/attributes/default.rb b/files/gitlab-cookbooks/gitlab/attributes/default.rb index 6d646fb..9e650dc 100644 --- a/files/gitlab-cookbooks/gitlab/attributes/default.rb +++ b/files/gitlab-cookbooks/gitlab/attributes/default.rb @@ -237,10 +237,11 @@ default['gitlab']['redis']['port'] = 6379 # Web server #### # Username for the webserver user -default['gitlab']['webserver']['username'] = 'gitlab-www' -default['gitlab']['webserver']['group'] = 'gitlab-www' -default['gitlab']['webserver']['uid'] = nil -default['gitlab']['webserver']['gid'] = nil +default['gitlab']['web-server']['username'] = 'gitlab-www' +default['gitlab']['web-server']['group'] = 'gitlab-www' +default['gitlab']['web-server']['uid'] = nil +default['gitlab']['web-server']['gid'] = nil +default['gitlab']['web-server']['shell'] = "/bin/false" #### # Nginx diff --git a/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb b/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb index 0eb5363..656d681 100644 --- a/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb +++ b/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb @@ -46,6 +46,7 @@ module Gitlab logging Mash.new remote_syslog Mash.new high_availability Mash.new + web_server Mash.new node nil external_url nil git_data_dir nil @@ -170,7 +171,8 @@ module Gitlab "logging", "remote_syslog", "high_availability", - "postgresql" + "postgresql", + "web_server" ].each do |key| rkey = key.gsub('_', '-') results['gitlab'][rkey] = Gitlab[key] diff --git a/files/gitlab-cookbooks/gitlab/recipes/default.rb b/files/gitlab-cookbooks/gitlab/recipes/default.rb index 1653e24..36e476f 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/default.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/default.rb @@ -49,7 +49,7 @@ include_recipe "gitlab::users" include_recipe "gitlab::gitlab-shell" include_recipe "gitlab::gitlab-rails" include_recipe "gitlab::selinux" -include_recipe "gitlab::web_server" +include_recipe "gitlab::web-server" # Create dummy unicorn and sidekiq services to receive notifications, in case # the corresponding service recipe is not loaded below. diff --git a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb index 0a4d888..4d956fd 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb @@ -49,7 +49,7 @@ end directory gitlab_rails_public_uploads_dir do owner node['gitlab']['user']['username'] - group node['gitlab']['webserver']['username'] + group node['gitlab']['web-server']['username'] mode '0750' recursive true end diff --git a/files/gitlab-cookbooks/gitlab/recipes/unicorn.rb b/files/gitlab-cookbooks/gitlab/recipes/unicorn.rb index 76b0b2a..820aaa7 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/unicorn.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/unicorn.rb @@ -38,7 +38,7 @@ end directory unicorn_socket_dir do owner node['gitlab']['user']['username'] - group node['gitlab']['webserver']['username'] + group node['gitlab']['web-server']['username'] mode '0750' recursive true end diff --git a/files/gitlab-cookbooks/gitlab/recipes/web-server.rb b/files/gitlab-cookbooks/gitlab/recipes/web-server.rb new file mode 100644 index 0000000..bff5084 --- /dev/null +++ b/files/gitlab-cookbooks/gitlab/recipes/web-server.rb @@ -0,0 +1,32 @@ +# +# Copyright:: Copyright (c) 2014 GitLab B.V. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +webserver_username = node['gitlab']['web-server']['username'] +webserver_group = node['gitlab']['web-server']['group'] + +# Create the group for the GitLab user +group webserver_group do + gid node['gitlab']['web-server']['gid'] +end + +# Create the webserver user +user webserver_username do + shell node['gitlab']['web-server']['shell'] + uid node['gitlab']['web-server']['uid'] + gid webserver_group + supports manage_home: false +end diff --git a/files/gitlab-cookbooks/gitlab/recipes/web_server.rb b/files/gitlab-cookbooks/gitlab/recipes/web_server.rb deleted file mode 100644 index 07d3273..0000000 --- a/files/gitlab-cookbooks/gitlab/recipes/web_server.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright:: Copyright (c) 2012 Opscode, Inc. -# Copyright:: Copyright (c) 2014 GitLab.com -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -webserver_username = node['gitlab']['webserver']['username'] -webserver_group = node['gitlab']['webserver']['group'] - -# Create the group for the GitLab user -group webserver_group do - gid node['gitlab']['webserver']['gid'] -end - -# Create the webserver user -user webserver_username do - shell node['gitlab']['user']['shell'] - uid node['gitlab']['webserver']['uid'] - gid webserver_group - supports manage_home: false -end -- libgit2 0.21.2