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 #     https://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"
 
  22 # chef_version = node[:chef][:server][:version]
 
  23 # chef_package = "chef-server-core_#{chef_version}-1_amd64.deb"
 
  25 # directory "/var/cache/chef" do
 
  31 # Dir.glob("/var/cache/chef/chef-server-core_*.deb").each do |deb|
 
  32 #   next if deb == "/var/cache/chef/#{chef_package}"
 
  40 # remote_file "/var/cache/chef/#{chef_package}" do
 
  41 #   source "https://packages.chef.io/files/stable/chef-server/#{chef_version}/ubuntu/16.04/#{chef_package}"
 
  48 # dpkg_package "chef-server-core" do
 
  49 #   source "/var/cache/chef/#{chef_package}"
 
  50 #   version "#{chef_version}-1"
 
  51 #   notifies :run, "execute[chef-server-reconfigure]"
 
  54 template "/etc/opscode/chef-server.rb" do
 
  55   source "server.rb.erb"
 
  59   notifies :run, "execute[chef-server-reconfigure]"
 
  62 execute "chef-server-reconfigure" do
 
  64   command "chef-server-ctl reconfigure"
 
  69 execute "chef-server-restart" do
 
  71   command "chef-server-ctl restart"
 
  76 systemd_service "chef-server" do
 
  77   description "Chef server"
 
  78   after "network.target"
 
  79   exec_start "/opt/opscode/embedded/bin/runsvdir-start"
 
  82 service "chef-server" do
 
  83   action [:enable, :start]
 
  84   subscribes :restart, "systemd_service[chef-server]"
 
  88 apache_module "proxy_http"
 
  90 ssl_certificate "chef.openstreetmap.org" do
 
  91   domains ["chef.openstreetmap.org", "chef.osm.org"]
 
  92   notifies :reload, "service[apache2]"
 
  93   notifies :run, "execute[chef-server-restart]"
 
  96 apache_site "chef.openstreetmap.org" do
 
 100 template "/etc/cron.daily/chef-server-backup" do
 
 101   source "server-backup.cron.erb"
 
 107 munin_plugin "chef_status"