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"
180 # wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
182 # site "2010.stateofthemap.org"
185 directory "/srv/2011.stateofthemap.org" do
191 git "/srv/2011.stateofthemap.org" do
193 repository "https://git.openstreetmap.org/public/stateofthemap.git"
194 revision "resources-2011"
200 wordpress_site "2011.stateofthemap.org" do
201 aliases "2011.stateofthemap.com"
202 directory "/srv/2011.stateofthemap.org/wp"
203 database_name "sotm2011"
204 database_user "sotm2011"
205 database_password passwords["sotm2011"]
206 urls "/register" => "/srv/2011.stateofthemap.org/register"
207 fpm_prometheus_port 12011
210 wordpress_theme "2011.stateofthemap.org-aerodrome" do
212 site "2011.stateofthemap.org"
213 repository "https://git.openstreetmap.org/public/stateofthemap.git"
214 revision "theme-2011"
217 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
218 plugin "sitepress-multilingual-cms"
219 site "2011.stateofthemap.org"
220 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
225 # wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
227 # site "2011.stateofthemap.org"
230 directory "/srv/2012.stateofthemap.org" do
236 git "/srv/2012.stateofthemap.org" do
238 repository "https://git.openstreetmap.org/public/stateofthemap.git"
239 revision "resources-2012"
245 wordpress_site "2012.stateofthemap.org" do
246 aliases "2012.stateofthemap.com"
247 directory "/srv/2012.stateofthemap.org/wp"
248 database_name "sotm2012"
249 database_user "sotm2012"
250 database_password passwords["sotm2012"]
251 urls "/register" => "/srv/2012.stateofthemap.org/register"
252 fpm_prometheus_port 12012
255 wordpress_theme "2012.stateofthemap.org-aerodrome" do
257 site "2012.stateofthemap.org"
258 repository "https://git.openstreetmap.org/public/stateofthemap.git"
259 revision "theme-2012"
262 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
263 plugin "leaflet-maps-marker"
264 site "2012.stateofthemap.org"
267 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
268 plugin "sitepress-multilingual-cms"
269 site "2012.stateofthemap.org"
270 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
275 # wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
277 # site "2012.stateofthemap.org"
280 %w[2013].each do |year|
281 git "/srv/#{year}.stateofthemap.org" do
283 repository "https://git.openstreetmap.org/public/stateofthemap.git"
284 revision "site-#{year}"
290 ssl_certificate "#{year}.stateofthemap.org" do
291 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
292 notifies :reload, "service[apache2]"
295 apache_site "#{year}.stateofthemap.org" do
296 template "apache.static.erb"
297 directory "/srv/#{year}.stateofthemap.org"
298 variables :year => year
313 apache_module "expires"
314 apache_module "rewrite"
316 gem_package "bundler" do
320 gem_package "bundler" do
324 %w[2016 2017 2018 2019 2020 2021 2022].each do |year|
325 git "/srv/#{year}.stateofthemap.org" do
327 repository "https://github.com/openstreetmap/stateofthemap-#{year}.git"
331 notifies :run, "execute[/srv/#{year}.stateofthemap.org/Gemfile]"
334 directory "/srv/#{year}.stateofthemap.org/_site" do
340 # Workaround https://github.com/jekyll/jekyll/issues/7804
341 # by creating a .jekyll-cache folder
342 directory "/srv/#{year}.stateofthemap.org/.jekyll-cache" do
348 execute "/srv/#{year}.stateofthemap.org/Gemfile" do
350 command "bundle install --deployment --jobs #{node[:cpu][:total]}"
351 cwd "/srv/#{year}.stateofthemap.org"
354 notifies :run, "execute[/srv/#{year}.stateofthemap.org]"
355 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
358 execute "/srv/#{year}.stateofthemap.org" do
360 command "bundle exec jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
361 cwd "/srv/#{year}.stateofthemap.org"
364 environment "LANG" => "C.UTF-8"
367 ssl_certificate "#{year}.stateofthemap.org" do
368 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
369 notifies :reload, "service[apache2]"
372 apache_site "#{year}.stateofthemap.org" do
373 template "apache.jekyll.erb"
374 directory "/srv/#{year}.stateofthemap.org/_site"
375 variables :year => year
379 template "/etc/cron.daily/sotm-backup" do
380 source "backup.cron.erb"
384 variables :passwords => passwords