Commit 2e4b00ae7d0b10cb670d514f38bd1910f23bbd0a

Authored by Jacob Vosmaer
1 parent 8ce63fbb

Import bootstrap*.rb from chef-server

Repo
https://github.com/opscode/omnibus-chef-server.git
Path
files/chef-server-cookbooks/chef-server/recipes/bootstrap.rb
files/chef-server-cookbooks/chef-server/recipes/bootstrap_disable.rb
Revision
6a11fd840045a7ae7961e5a37439371b7407f3e9
files/gitlab-cookbooks/gitlab/recipes/bootstrap.rb 0 → 100644
... ... @@ -0,0 +1,53 @@
  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 +bootstrap_status_file = "/var/opt/chef-server/bootstrapped"
  19 +erchef_dir = "/opt/chef-server/embedded/service/erchef"
  20 +
  21 +erchef_status_url = "http://#{node['chef_server']['erchef']['listen']}"
  22 +erchef_status_url << ":#{node['chef_server']['erchef']['port']}/_status"
  23 +
  24 +execute "verify-system-status" do
  25 + command "curl -sf #{erchef_status_url}"
  26 + retries 20
  27 + not_if { File.exists?(bootstrap_status_file) }
  28 +end
  29 +
  30 +execute "boostrap-chef-server" do
  31 + command "bin/bootstrap-chef-server"
  32 + cwd erchef_dir
  33 + not_if { File.exists?(bootstrap_status_file) }
  34 + environment({ 'CHEF_ADMIN_USER' => node['chef_server']['chef-server-webui']['web_ui_admin_user_name'],
  35 + 'CHEF_ADMIN_PASS' => node['chef_server']['chef-server-webui']['web_ui_admin_default_password'] })
  36 + notifies :restart, 'service[erchef]'
  37 +end
  38 +
  39 +# servers need access to this key.
  40 +chef_user = node['chef_server']['user']['username']
  41 +file "/etc/chef-server/chef-webui.pem" do
  42 + owner "root"
  43 + group chef_user
  44 + mode "0640"
  45 + not_if { File.exists?(bootstrap_status_file) }
  46 +end
  47 +
  48 +file bootstrap_status_file do
  49 + owner "root"
  50 + group "root"
  51 + mode "0600"
  52 + content "All your bootstraps are belong to Chef"
  53 +end
... ...
files/gitlab-cookbooks/gitlab/recipes/bootstrap_disable.rb 0 → 100644
... ... @@ -0,0 +1,16 @@
  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 +#
... ...