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                   else node[:platform_version]
 
  27 chef_package = "chef-server_#{node[:chef][:server][:version]}_amd64.deb"
 
  29 directory "/var/cache/chef" do
 
  35 Dir.glob("/var/cache/chef/chef-server_*.deb").each do |deb|
 
  36   if deb != "/var/cache/chef/#{chef_package}"
 
  44 remote_file "/var/cache/chef/#{chef_package}" do
 
  45   source "https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/#{chef_platform}/x86_64/#{chef_package}"
 
  52 dpkg_package "chef-erver" do
 
  53   source "/var/cache/chef/#{chef_package}"
 
  54   version node[:chef][:server][:version]
 
  55   notifies :run, "execute[chef-server-reconfigure]"
 
  58 ruby_block "/opt/chef-server/embedded/service/chef-server-webui/app/controllers/status_controller.rb" do
 
  60     rc = Chef::Util::FileEdit.new("/opt/chef-server/embedded/service/chef-server-webui/app/controllers/status_controller.rb")
 
  61     rc.search_file_delete(/&rows=20/)
 
  65       resources(:execute => "chef-server-reconfigure").run_action(:run)
 
  70 template "/etc/chef-server/chef-server.rb" do
 
  71   source "server.rb.erb"
 
  75   notifies :run, "execute[chef-server-reconfigure]"
 
  78 execute "chef-server-reconfigure" do
 
  80   command "chef-server-ctl reconfigure"
 
  85 service "chef-server-runsvdir" do
 
  86   provider Chef::Provider::Service::Upstart
 
  87   action [ :enable, :start ]
 
  88   supports :status => true, :restart => true, :reload => true
 
  92 apache_module "proxy_http"
 
  94 apache_site "chef.openstreetmap.org" do
 
  98 template "/etc/cron.daily/chef-server-backup" do
 
  99   source "server-backup.cron.erb"