Commit 38584e9210dc2768c8b32927e2b8a391803bb211

Authored by Jacob Vosmaer
1 parent e301f4a5

Import recipes/chef-server-webui*.rb

Path
files/chef-server-cookbooks/chef-server/recipes/chef-server-webui.rb
files/chef-server-cookbooks/chef-server/recipes/chef-server-webui_disable.rb
Repo
https://github.com/opscode/omnibus-chef-server.git
Revision
6a11fd840045a7ae7961e5a37439371b7407f3e9
files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb 0 → 100644
... ... @@ -0,0 +1,142 @@
  1 +#
  2 +# Copyright:: Copyright (c) 2012 Opscode, Inc.
  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 +chef_server_webui_dir = node['chef_server']['chef-server-webui']['dir']
  19 +chef_server_webui_etc_dir = File.join(chef_server_webui_dir, "etc")
  20 +chef_server_webui_working_dir = File.join(chef_server_webui_dir, "working")
  21 +chef_server_webui_tmp_dir = File.join(chef_server_webui_dir, "tmp")
  22 +chef_server_webui_log_dir = node['chef_server']['chef-server-webui']['log_directory']
  23 +
  24 +[
  25 + chef_server_webui_dir,
  26 + chef_server_webui_etc_dir,
  27 + chef_server_webui_working_dir,
  28 + chef_server_webui_tmp_dir,
  29 + chef_server_webui_log_dir
  30 +].each do |dir_name|
  31 + directory dir_name do
  32 + owner node['chef_server']['user']['username']
  33 + mode '0700'
  34 + recursive true
  35 + end
  36 +end
  37 +
  38 +should_notify = OmnibusHelper.should_notify?("chef-server-webui")
  39 +
  40 +env_config = File.join(chef_server_webui_etc_dir, "#{node['chef_server']['chef-server-webui']['environment']}.rb")
  41 +session_store_config = File.join(chef_server_webui_etc_dir, "session_store.rb")
  42 +secret_token_config = File.join(chef_server_webui_etc_dir, "secret_token.rb")
  43 +config_ru = File.join(chef_server_webui_etc_dir, "config.ru")
  44 +
  45 +erchef_url = "http://#{node['chef_server']['erchef']['listen']}"
  46 +erchef_url << ":#{node['chef_server']['erchef']['port']}"
  47 +
  48 +template env_config do
  49 + source "chef-server-webui-config.rb.erb"
  50 + owner "root"
  51 + group "root"
  52 + mode "0644"
  53 + variables({
  54 + :chef_server_url => erchef_url
  55 + }.merge(node['chef_server']['chef-server-webui'].to_hash))
  56 + notifies :restart, 'service[chef-server-webui]' if should_notify
  57 +end
  58 +
  59 +link "/opt/chef-server/embedded/service/chef-server-webui/config/environments/#{node['chef_server']['chef-server-webui']['environment']}.rb" do
  60 + to env_config
  61 +end
  62 +
  63 +template session_store_config do
  64 + source "session_store.erb"
  65 + owner "root"
  66 + group "root"
  67 + mode "0644"
  68 + variables(node['chef_server']['chef-server-webui'].to_hash)
  69 + notifies :restart, 'service[chef-server-webui]' if should_notify
  70 +end
  71 +
  72 +link "/opt/chef-server/embedded/service/chef-server-webui/config/initializers/session_store.rb" do
  73 + to session_store_config
  74 +end
  75 +
  76 +template secret_token_config do
  77 + source "secret_token.erb"
  78 + owner "root"
  79 + group "root"
  80 + mode "0644"
  81 + variables(node['chef_server']['chef-server-webui'].to_hash)
  82 + notifies :restart, 'service[chef-server-webui]' if should_notify
  83 +end
  84 +
  85 +link "/opt/chef-server/embedded/service/chef-server-webui/config/initializers/secret_token.rb" do
  86 + to secret_token_config
  87 +end
  88 +
  89 +template config_ru do
  90 + source "chef-server-webui.ru.erb"
  91 + mode "0644"
  92 + owner "root"
  93 + group "root"
  94 + variables(node['chef_server']['chef-server-webui'].to_hash)
  95 + notifies :restart, 'service[chef-server-webui]' if should_notify
  96 +end
  97 +
  98 +file "/opt/chef-server/embedded/service/chef-server-webui/config.ru" do
  99 + action :delete
  100 + not_if "test -h /opt/chef-server/embedded/service/chef-server-webui/config.ru"
  101 +end
  102 +
  103 +link "/opt/chef-server/embedded/service/chef-server-webui/config.ru" do
  104 + to config_ru
  105 +end
  106 +
  107 +unicorn_listen = node['chef_server']['chef-server-webui']['listen']
  108 +unicorn_listen << ":#{node['chef_server']['chef-server-webui']['port']}"
  109 +
  110 +unicorn_config File.join(chef_server_webui_etc_dir, "unicorn.rb") do
  111 + listen unicorn_listen => {
  112 + :backlog => node['chef_server']['chef-server-webui']['backlog'],
  113 + :tcp_nodelay => node['chef_server']['chef-server-webui']['tcp_nodelay']
  114 + }
  115 + worker_timeout node['chef_server']['chef-server-webui']['worker_timeout']
  116 + working_directory chef_server_webui_working_dir
  117 + worker_processes node['chef_server']['chef-server-webui']['worker_processes']
  118 + owner "root"
  119 + group "root"
  120 + mode "0644"
  121 + notifies :restart, 'service[chef-server-webui]' if should_notify
  122 +end
  123 +
  124 +link "/opt/chef-server/embedded/service/chef-server-webui/tmp" do
  125 + to chef_server_webui_tmp_dir
  126 +end
  127 +
  128 +execute "chown -R #{node['chef_server']['user']['username']} /opt/chef-server/embedded/service/chef-server-webui/public"
  129 +
  130 +runit_service "chef-server-webui" do
  131 + down node['chef_server']['chef-server-webui']['ha']
  132 + options({
  133 + :log_directory => chef_server_webui_log_dir
  134 + }.merge(params))
  135 +end
  136 +
  137 +if node['chef_server']['bootstrap']['enable']
  138 + execute "/opt/chef-server/bin/chef-server-ctl start chef-server-webui" do
  139 + retries 20
  140 + end
  141 +end
  142 +
... ...
files/gitlab-cookbooks/gitlab/recipes/gitlab-core_disable.rb 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +#
  2 +# Copyright:: Copyright (c) 2012 Opscode, Inc.
  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 +runit_service "chef-server-webui" do
  19 + action :disable
  20 +end
... ...