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 # cache_dir = Chef::Config[:file_cache_path]
24 # chef_version = node[:chef][:server][:version]
25 # chef_package = "chef-server-core_#{chef_version}-1_amd64.deb"
27 # Dir.glob("#{cache_dir}/chef-server-core_*.deb").each do |deb|
28 # next if deb == "#{cache_dir}/#{chef_package}"
36 # remote_file "#{cache_dir}/#{chef_package}" do
37 # source "https://packages.chef.io/files/stable/chef-server/#{chef_version}/ubuntu/16.04/#{chef_package}"
44 # dpkg_package "chef-server-core" do
45 # source "#{cache_dir}/#{chef_package}"
46 # version "#{chef_version}-1"
47 # notifies :run, "execute[chef-server-reconfigure]"
50 template "/etc/opscode/chef-server.rb" do
51 source "server.rb.erb"
55 notifies :run, "execute[chef-server-reconfigure]"
58 execute "chef-server-reconfigure" do
60 command "chef-server-ctl reconfigure"
65 execute "chef-server-restart" do
67 command "chef-server-ctl restart"
72 systemd_service "chef-server" do
73 description "Chef server"
74 after "network.target"
75 exec_start "/opt/opscode/embedded/bin/runsvdir-start"
78 service "chef-server" do
79 action [:enable, :start]
80 subscribes :restart, "systemd_service[chef-server]"
84 apache_module "proxy_http"
86 ssl_certificate "chef.openstreetmap.org" do
87 domains ["chef.openstreetmap.org", "chef.osm.org"]
88 notifies :reload, "service[apache2]"
89 notifies :run, "execute[chef-server-restart]"
92 apache_site "chef.openstreetmap.org" do
96 template "/etc/cron.daily/chef-server-backup" do
97 source "server-backup.cron.erb"
103 munin_plugin "chef_status"