2 # Cookbook:: stateofthemap
5 # Copyright:: 2022, 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 "stateofthemap"
32 apache_module "expires"
33 apache_module "rewrite"
35 %w[2016 2017 2018 2019 2020 2021 2022].each do |year|
36 git "/srv/#{year}.stateofthemap.org" do
38 repository "https://github.com/openstreetmap/stateofthemap-#{year}.git"
42 notifies :run, "bundle_install[/srv/#{year}.stateofthemap.org]"
45 directory "/srv/#{year}.stateofthemap.org/_site" do
51 directory "/srv/#{year}.stateofthemap.org/vendor" do
57 bundle_install "/srv/#{year}.stateofthemap.org" do
61 environment "BUNDLE_FROZEN" => "true",
62 "BUNDLE_WITHOUT" => "development:test",
63 "BUNDLE_PATH" => "vendor/bundle",
64 "BUNDLE_DEPLOYMENT" => "1",
65 "BUNDLE_JOBS" => node.cpu_cores.to_s
66 notifies :run, "bundle_exec[/srv/#{year}.stateofthemap.org]"
67 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
70 bundle_exec "/srv/#{year}.stateofthemap.org" do
72 command "jekyll build --trace --disable-disk-cache --baseurl=https://#{year}.stateofthemap.org"
75 environment "LANG" => "C.UTF-8",
76 "BUNDLE_PATH" => "vendor/bundle",
77 "BUNDLE_DEPLOYMENT" => "1"
80 ssl_certificate "#{year}.stateofthemap.org" do
81 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
82 notifies :reload, "service[apache2]"
85 apache_site "#{year}.stateofthemap.org" do
86 template "apache.jekyll.erb"
87 directory "/srv/#{year}.stateofthemap.org/_site"
88 variables :year => year