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"
171 wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
173 site "2010.stateofthemap.org"
176 directory "/srv/2011.stateofthemap.org" do
182 git "/srv/2011.stateofthemap.org" do
184 repository "https://git.openstreetmap.org/public/stateofthemap.git"
185 revision "resources-2011"
190 wordpress_site "2011.stateofthemap.org" do
191 aliases "2011.stateofthemap.com"
192 directory "/srv/2011.stateofthemap.org/wp"
193 database_name "sotm2011"
194 database_user "sotm2011"
195 database_password passwords["sotm2011"]
196 urls "/register" => "/srv/2011.stateofthemap.org/register"
199 wordpress_theme "2011.stateofthemap.org-aerodrome" do
201 site "2011.stateofthemap.org"
202 repository "https://git.openstreetmap.org/public/stateofthemap.git"
203 revision "theme-2011"
206 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
207 plugin "sitepress-multilingual-cms"
208 site "2011.stateofthemap.org"
209 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
212 wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
214 site "2011.stateofthemap.org"
217 directory "/srv/2012.stateofthemap.org" do
223 git "/srv/2012.stateofthemap.org" do
225 repository "https://git.openstreetmap.org/public/stateofthemap.git"
226 revision "resources-2012"
231 wordpress_site "2012.stateofthemap.org" do
232 aliases "2012.stateofthemap.com"
233 directory "/srv/2012.stateofthemap.org/wp"
234 database_name "sotm2012"
235 database_user "sotm2012"
236 database_password passwords["sotm2012"]
237 urls "/register" => "/srv/2012.stateofthemap.org/register"
240 wordpress_theme "2012.stateofthemap.org-aerodrome" do
242 site "2012.stateofthemap.org"
243 repository "https://git.openstreetmap.org/public/stateofthemap.git"
244 revision "theme-2012"
247 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
248 plugin "leaflet-maps-marker"
249 site "2012.stateofthemap.org"
252 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
253 plugin "sitepress-multilingual-cms"
254 site "2012.stateofthemap.org"
255 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
258 wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
260 site "2012.stateofthemap.org"
263 %w[2013].each do |year|
264 git "/srv/#{year}.stateofthemap.org" do
266 repository "https://git.openstreetmap.org/public/stateofthemap.git"
267 revision "site-#{year}"
272 ssl_certificate "#{year}.stateofthemap.org" do
273 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
274 notifies :reload, "service[apache2]"
277 apache_site "#{year}.stateofthemap.org" do
278 template "apache.static.erb"
279 directory "/srv/#{year}.stateofthemap.org"
280 variables :year => year
290 gem_package "bundler" do
294 %w[2016 2017 2018 2019 2020].each do |year|
295 git "/srv/#{year}.stateofthemap.org" do
297 repository "git://github.com/openstreetmap/stateofthemap-#{year}.git"
300 notifies :run, "execute[/srv/#{year}.stateofthemap.org/Gemfile]"
303 directory "/srv/#{year}.stateofthemap.org/_site" do
309 # Workaround https://github.com/jekyll/jekyll/issues/7804
310 # by creating a .jekyll-cache folder
311 directory "/srv/#{year}.stateofthemap.org/.jekyll-cache" do
317 execute "/srv/#{year}.stateofthemap.org/Gemfile" do
319 command "bundle install --deployment"
320 cwd "/srv/#{year}.stateofthemap.org"
323 notifies :run, "execute[/srv/#{year}.stateofthemap.org]"
324 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
327 execute "/srv/#{year}.stateofthemap.org" do
329 command "bundle exec jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
330 cwd "/srv/#{year}.stateofthemap.org"
335 ssl_certificate "#{year}.stateofthemap.org" do
336 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
337 notifies :reload, "service[apache2]"
340 apache_site "#{year}.stateofthemap.org" do
341 template "apache.jekyll.erb"
342 directory "/srv/#{year}.stateofthemap.org/_site"
343 variables :year => year
347 template "/etc/cron.daily/sotm-backup" do
348 source "backup.cron.erb"
352 variables :passwords => passwords