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"
32 ssl_certificate "stateofthemap.org" do
33 domains ["stateofthemap.org", "www.stateofthemap.org",
34 "stateofthemap.com", "www.stateofthemap.com",
35 "sotm.org", "www.sotm.org"]
36 notifies :reload, "service[apache2]"
39 apache_site "stateofthemap.org" do
41 directory "/srv/stateofthemap.org"
44 directory "/srv/2007.stateofthemap.org" do
50 wordpress_site "2007.stateofthemap.org" do
51 aliases "2007.stateofthemap.com"
52 directory "/srv/2007.stateofthemap.org/wp"
53 database_name "sotm2007"
54 database_user "sotm2007"
55 database_password passwords["sotm2007"]
56 database_prefix "wp_sotm_"
59 wordpress_theme "2007.stateofthemap.org-refreshwp-11" do
61 site "2007.stateofthemap.org"
62 repository "https://git.openstreetmap.org/public/stateofthemap.git"
66 wordpress_plugin "2007.stateofthemap.org-geopress" do
68 site "2007.stateofthemap.org"
71 directory "/srv/2008.stateofthemap.org" do
77 wordpress_site "2008.stateofthemap.org" do
78 aliases "2008.stateofthemap.com"
79 directory "/srv/2008.stateofthemap.org/wp"
80 database_name "sotm2008"
81 database_user "sotm2008"
82 database_password passwords["sotm2008"]
83 database_prefix "wp_sotm08_"
86 wordpress_theme "2008.stateofthemap.org-refreshwp-11" do
88 site "2008.stateofthemap.org"
89 repository "https://git.openstreetmap.org/public/stateofthemap.git"
93 wordpress_plugin "2008.stateofthemap.org-geopress" do
95 site "2008.stateofthemap.org"
98 directory "/srv/2009.stateofthemap.org" do
104 git "/srv/2009.stateofthemap.org" do
106 repository "https://git.openstreetmap.org/public/stateofthemap.git"
107 revision "resources-2009"
112 wordpress_site "2009.stateofthemap.org" do
113 aliases "2009.stateofthemap.com"
114 directory "/srv/2009.stateofthemap.org/wp"
115 database_name "sotm2009"
116 database_user "sotm2009"
117 database_password passwords["sotm2009"]
118 urls "/register" => "/srv/2009.stateofthemap.org/register",
119 "/register-pro-user" => "/srv/2009.stateofthemap.org/register-pro-user",
120 "/podcasts" => "/srv/2009.stateofthemap.org/podcasts"
123 wordpress_theme "2009.stateofthemap.org-aerodrome" do
125 site "2009.stateofthemap.org"
126 repository "https://git.openstreetmap.org/public/stateofthemap.git"
127 revision "theme-2009"
130 wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
132 site "2009.stateofthemap.org"
135 directory "/srv/2010.stateofthemap.org" do
141 git "/srv/2010.stateofthemap.org" do
143 repository "https://git.openstreetmap.org/public/stateofthemap.git"
144 revision "resources-2010"
149 wordpress_site "2010.stateofthemap.org" do
150 aliases "2010.stateofthemap.com"
151 directory "/srv/2010.stateofthemap.org/wp"
152 database_name "sotm2010"
153 database_user "sotm2010"
154 database_password passwords["sotm2010"]
155 urls "/register" => "/srv/2010.stateofthemap.org/register"
158 wordpress_theme "2010.stateofthemap.org-aerodrome" do
160 site "2010.stateofthemap.org"
161 repository "https://git.openstreetmap.org/public/stateofthemap.git"
162 revision "theme-2010"
165 wordpress_plugin "2010.stateofthemap.org-sitepress-multilingual-cms" do
166 plugin "sitepress-multilingual-cms"
167 site "2010.stateofthemap.org"
168 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
169 not_if { ENV["TEST_KITCHEN"] }
172 wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
174 site "2010.stateofthemap.org"
177 directory "/srv/2011.stateofthemap.org" do
183 git "/srv/2011.stateofthemap.org" do
185 repository "https://git.openstreetmap.org/public/stateofthemap.git"
186 revision "resources-2011"
191 wordpress_site "2011.stateofthemap.org" do
192 aliases "2011.stateofthemap.com"
193 directory "/srv/2011.stateofthemap.org/wp"
194 database_name "sotm2011"
195 database_user "sotm2011"
196 database_password passwords["sotm2011"]
197 urls "/register" => "/srv/2011.stateofthemap.org/register"
200 wordpress_theme "2011.stateofthemap.org-aerodrome" do
202 site "2011.stateofthemap.org"
203 repository "https://git.openstreetmap.org/public/stateofthemap.git"
204 revision "theme-2011"
207 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
208 plugin "sitepress-multilingual-cms"
209 site "2011.stateofthemap.org"
210 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
211 not_if { ENV["TEST_KITCHEN"] }
214 wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
216 site "2011.stateofthemap.org"
219 directory "/srv/2012.stateofthemap.org" do
225 git "/srv/2012.stateofthemap.org" do
227 repository "https://git.openstreetmap.org/public/stateofthemap.git"
228 revision "resources-2012"
233 wordpress_site "2012.stateofthemap.org" do
234 aliases "2012.stateofthemap.com"
235 directory "/srv/2012.stateofthemap.org/wp"
236 database_name "sotm2012"
237 database_user "sotm2012"
238 database_password passwords["sotm2012"]
239 urls "/register" => "/srv/2012.stateofthemap.org/register"
242 wordpress_theme "2012.stateofthemap.org-aerodrome" do
244 site "2012.stateofthemap.org"
245 repository "https://git.openstreetmap.org/public/stateofthemap.git"
246 revision "theme-2012"
249 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
250 plugin "leaflet-maps-marker"
251 site "2012.stateofthemap.org"
254 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
255 plugin "sitepress-multilingual-cms"
256 site "2012.stateofthemap.org"
257 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
258 not_if { ENV["TEST_KITCHEN"] }
261 wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
263 site "2012.stateofthemap.org"
266 %w[2013].each do |year|
267 git "/srv/#{year}.stateofthemap.org" do
269 repository "https://git.openstreetmap.org/public/stateofthemap.git"
270 revision "site-#{year}"
275 ssl_certificate "#{year}.stateofthemap.org" do
276 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
277 notifies :reload, "service[apache2]"
280 apache_site "#{year}.stateofthemap.org" do
281 template "apache.static.erb"
282 directory "/srv/#{year}.stateofthemap.org"
283 variables :year => year
295 apache_module "expires"
296 apache_module "rewrite"
298 gem_package "bundler" do
302 %w[2016 2017 2018 2019 2020].each do |year|
303 git "/srv/#{year}.stateofthemap.org" do
305 repository "git://github.com/openstreetmap/stateofthemap-#{year}.git"
308 notifies :run, "execute[/srv/#{year}.stateofthemap.org/Gemfile]"
311 directory "/srv/#{year}.stateofthemap.org/_site" do
317 # Workaround https://github.com/jekyll/jekyll/issues/7804
318 # by creating a .jekyll-cache folder
319 directory "/srv/#{year}.stateofthemap.org/.jekyll-cache" do
325 execute "/srv/#{year}.stateofthemap.org/Gemfile" do
327 command "bundle install --deployment"
328 cwd "/srv/#{year}.stateofthemap.org"
331 notifies :run, "execute[/srv/#{year}.stateofthemap.org]"
332 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
335 execute "/srv/#{year}.stateofthemap.org" do
337 command "bundle exec jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
338 cwd "/srv/#{year}.stateofthemap.org"
343 ssl_certificate "#{year}.stateofthemap.org" do
344 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
345 notifies :reload, "service[apache2]"
348 apache_site "#{year}.stateofthemap.org" do
349 template "apache.jekyll.erb"
350 directory "/srv/#{year}.stateofthemap.org/_site"
351 variables :year => year
355 template "/etc/cron.daily/sotm-backup" do
356 source "backup.cron.erb"
360 variables :passwords => passwords