2 # Cookbook:: stateofthemap
5 # Copyright:: 2013, 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 "wordpress"
22 passwords = data_bag_item("stateofthemap", "passwords")
24 git "/srv/stateofthemap.org" do
26 repository "https://git.openstreetmap.org/public/stateofthemap.git"
33 ssl_certificate "stateofthemap.org" do
34 domains ["stateofthemap.org", "www.stateofthemap.org",
35 "stateofthemap.com", "www.stateofthemap.com",
36 "sotm.org", "www.sotm.org"]
37 notifies :reload, "service[apache2]"
40 apache_site "stateofthemap.org" do
42 directory "/srv/stateofthemap.org"
45 directory "/srv/2007.stateofthemap.org" do
51 wordpress_site "2007.stateofthemap.org" do
52 aliases "2007.stateofthemap.com"
53 directory "/srv/2007.stateofthemap.org/wp"
54 database_name "sotm2007"
55 database_user "sotm2007"
56 database_password passwords["sotm2007"]
57 database_prefix "wp_sotm_"
58 fpm_prometheus_port 12007
61 wordpress_theme "2007.stateofthemap.org-refreshwp-11" do
63 site "2007.stateofthemap.org"
64 repository "https://git.openstreetmap.org/public/stateofthemap.git"
68 wordpress_plugin "2007.stateofthemap.org-geopress" do
70 site "2007.stateofthemap.org"
73 directory "/srv/2008.stateofthemap.org" do
79 wordpress_site "2008.stateofthemap.org" do
80 aliases "2008.stateofthemap.com"
81 directory "/srv/2008.stateofthemap.org/wp"
82 database_name "sotm2008"
83 database_user "sotm2008"
84 database_password passwords["sotm2008"]
85 database_prefix "wp_sotm08_"
86 fpm_prometheus_port 12008
89 wordpress_theme "2008.stateofthemap.org-refreshwp-11" do
91 site "2008.stateofthemap.org"
92 repository "https://git.openstreetmap.org/public/stateofthemap.git"
96 wordpress_plugin "2008.stateofthemap.org-geopress" do
98 site "2008.stateofthemap.org"
101 directory "/srv/2009.stateofthemap.org" do
107 git "/srv/2009.stateofthemap.org" do
109 repository "https://git.openstreetmap.org/public/stateofthemap.git"
110 revision "resources-2009"
116 wordpress_site "2009.stateofthemap.org" do
117 aliases "2009.stateofthemap.com"
118 directory "/srv/2009.stateofthemap.org/wp"
119 database_name "sotm2009"
120 database_user "sotm2009"
121 database_password passwords["sotm2009"]
122 urls "/register" => "/srv/2009.stateofthemap.org/register",
123 "/register-pro-user" => "/srv/2009.stateofthemap.org/register-pro-user",
124 "/podcasts" => "/srv/2009.stateofthemap.org/podcasts"
125 fpm_prometheus_port 12009
128 wordpress_theme "2009.stateofthemap.org-aerodrome" do
130 site "2009.stateofthemap.org"
131 repository "https://git.openstreetmap.org/public/stateofthemap.git"
132 revision "theme-2009"
135 wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
137 site "2009.stateofthemap.org"
140 directory "/srv/2010.stateofthemap.org" do
146 git "/srv/2010.stateofthemap.org" do
148 repository "https://git.openstreetmap.org/public/stateofthemap.git"
149 revision "resources-2010"
155 wordpress_site "2010.stateofthemap.org" do
156 aliases "2010.stateofthemap.com"
157 directory "/srv/2010.stateofthemap.org/wp"
158 database_name "sotm2010"
159 database_user "sotm2010"
160 database_password passwords["sotm2010"]
161 urls "/register" => "/srv/2010.stateofthemap.org/register"
162 fpm_prometheus_port 12010
165 wordpress_theme "2010.stateofthemap.org-aerodrome" do
167 site "2010.stateofthemap.org"
168 repository "https://git.openstreetmap.org/public/stateofthemap.git"
169 revision "theme-2010"
172 wordpress_plugin "2010.stateofthemap.org-sitepress-multilingual-cms" do
173 plugin "sitepress-multilingual-cms"
174 site "2010.stateofthemap.org"
175 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
179 wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
181 site "2010.stateofthemap.org"
184 directory "/srv/2011.stateofthemap.org" do
190 git "/srv/2011.stateofthemap.org" do
192 repository "https://git.openstreetmap.org/public/stateofthemap.git"
193 revision "resources-2011"
199 wordpress_site "2011.stateofthemap.org" do
200 aliases "2011.stateofthemap.com"
201 directory "/srv/2011.stateofthemap.org/wp"
202 database_name "sotm2011"
203 database_user "sotm2011"
204 database_password passwords["sotm2011"]
205 urls "/register" => "/srv/2011.stateofthemap.org/register"
206 fpm_prometheus_port 12011
209 wordpress_theme "2011.stateofthemap.org-aerodrome" do
211 site "2011.stateofthemap.org"
212 repository "https://git.openstreetmap.org/public/stateofthemap.git"
213 revision "theme-2011"
216 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
217 plugin "sitepress-multilingual-cms"
218 site "2011.stateofthemap.org"
219 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
223 wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
225 site "2011.stateofthemap.org"
228 directory "/srv/2012.stateofthemap.org" do
234 git "/srv/2012.stateofthemap.org" do
236 repository "https://git.openstreetmap.org/public/stateofthemap.git"
237 revision "resources-2012"
243 wordpress_site "2012.stateofthemap.org" do
244 aliases "2012.stateofthemap.com"
245 directory "/srv/2012.stateofthemap.org/wp"
246 database_name "sotm2012"
247 database_user "sotm2012"
248 database_password passwords["sotm2012"]
249 urls "/register" => "/srv/2012.stateofthemap.org/register"
250 fpm_prometheus_port 12012
253 wordpress_theme "2012.stateofthemap.org-aerodrome" do
255 site "2012.stateofthemap.org"
256 repository "https://git.openstreetmap.org/public/stateofthemap.git"
257 revision "theme-2012"
260 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
261 plugin "leaflet-maps-marker"
262 site "2012.stateofthemap.org"
265 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
266 plugin "sitepress-multilingual-cms"
267 site "2012.stateofthemap.org"
268 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
272 wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
274 site "2012.stateofthemap.org"
277 %w[2013].each do |year|
278 git "/srv/#{year}.stateofthemap.org" do
280 repository "https://git.openstreetmap.org/public/stateofthemap.git"
281 revision "site-#{year}"
287 ssl_certificate "#{year}.stateofthemap.org" do
288 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
289 notifies :reload, "service[apache2]"
292 apache_site "#{year}.stateofthemap.org" do
293 template "apache.static.erb"
294 directory "/srv/#{year}.stateofthemap.org"
295 variables :year => year
310 apache_module "expires"
311 apache_module "rewrite"
313 gem_package "bundler" do
317 gem_package "bundler" do
321 %w[2016 2017 2018 2019 2020 2021].each do |year|
322 git "/srv/#{year}.stateofthemap.org" do
324 repository "https://github.com/openstreetmap/stateofthemap-#{year}.git"
328 notifies :run, "execute[/srv/#{year}.stateofthemap.org/Gemfile]"
331 directory "/srv/#{year}.stateofthemap.org/_site" do
337 # Workaround https://github.com/jekyll/jekyll/issues/7804
338 # by creating a .jekyll-cache folder
339 directory "/srv/#{year}.stateofthemap.org/.jekyll-cache" do
345 execute "/srv/#{year}.stateofthemap.org/Gemfile" do
347 command "bundle install --deployment --jobs #{node[:cpu][:total]}"
348 cwd "/srv/#{year}.stateofthemap.org"
351 notifies :run, "execute[/srv/#{year}.stateofthemap.org]"
352 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
355 execute "/srv/#{year}.stateofthemap.org" do
357 command "bundle exec jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
358 cwd "/srv/#{year}.stateofthemap.org"
361 environment "LANG" => "C.UTF-8"
364 ssl_certificate "#{year}.stateofthemap.org" do
365 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
366 notifies :reload, "service[apache2]"
369 apache_site "#{year}.stateofthemap.org" do
370 template "apache.jekyll.erb"
371 directory "/srv/#{year}.stateofthemap.org/_site"
372 variables :year => year
376 template "/etc/cron.daily/sotm-backup" do
377 source "backup.cron.erb"
381 variables :passwords => passwords