5 # Copyright 2010, OpenStreetMap Foundation
 
   7 # Licensed under the Apache License, Version 2.0 (the "License");
 
   8 # you may not use this file except in compliance with the License.
 
   9 # You may obtain a copy of the License at
 
  11 #     http://www.apache.org/licenses/LICENSE-2.0
 
  13 # Unless required by applicable law or agreed to in writing, software
 
  14 # distributed under the License is distributed on an "AS IS" BASIS,
 
  15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16 # See the License for the specific language governing permissions and
 
  17 # limitations under the License.
 
  20 include_recipe "apache::ssl"
 
  22 chef_platform = case node[:platform_version]
 
  23                 when "12.10" then "12.04"
 
  24                 when "14.04" then "12.04"
 
  25                 else node[:platform_version]
 
  28 chef_package = "chef-server_#{node[:chef][:server][:version]}_amd64.deb"
 
  30 directory "/var/cache/chef" do
 
  36 Dir.glob("/var/cache/chef/chef-server_*.deb").each do |deb|
 
  37   next if deb == "/var/cache/chef/#{chef_package}"
 
  45 remote_file "/var/cache/chef/#{chef_package}" do
 
  46   source "https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/#{chef_platform}/x86_64/#{chef_package}"
 
  53 dpkg_package "chef-erver" do
 
  54   source "/var/cache/chef/#{chef_package}"
 
  55   version node[:chef][:server][:version]
 
  56   notifies :run, "execute[chef-server-reconfigure]"
 
  59 ruby_block "/opt/chef-server/embedded/service/chef-server-webui/app/controllers/status_controller.rb" do
 
  61     rc = Chef::Util::FileEdit.new("/opt/chef-server/embedded/service/chef-server-webui/app/controllers/status_controller.rb")
 
  62     rc.search_file_delete(/&rows=20/)
 
  66       resources(:execute => "chef-server-reconfigure").run_action(:run)
 
  71 template "/etc/chef-server/chef-server.rb" do
 
  72   source "server.rb.erb"
 
  76   notifies :run, "execute[chef-server-reconfigure]"
 
  79 execute "chef-server-reconfigure" do
 
  81   command "chef-server-ctl reconfigure"
 
  86 service "chef-server-runsvdir" do
 
  87   provider Chef::Provider::Service::Upstart
 
  88   action [:enable, :start]
 
  89   supports :status => true, :restart => true, :reload => true
 
  93 apache_module "proxy_http"
 
  95 apache_site "chef.openstreetmap.org" do
 
  99 template "/etc/cron.daily/chef-server-backup" do
 
 100   source "server-backup.cron.erb"