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_"
60 wordpress_theme "2007.stateofthemap.org-refreshwp-11" do
62 site "2007.stateofthemap.org"
63 repository "https://git.openstreetmap.org/public/stateofthemap.git"
67 wordpress_plugin "2007.stateofthemap.org-geopress" do
69 site "2007.stateofthemap.org"
72 directory "/srv/2008.stateofthemap.org" do
78 wordpress_site "2008.stateofthemap.org" do
79 aliases "2008.stateofthemap.com"
80 directory "/srv/2008.stateofthemap.org/wp"
81 database_name "sotm2008"
82 database_user "sotm2008"
83 database_password passwords["sotm2008"]
84 database_prefix "wp_sotm08_"
87 wordpress_theme "2008.stateofthemap.org-refreshwp-11" do
89 site "2008.stateofthemap.org"
90 repository "https://git.openstreetmap.org/public/stateofthemap.git"
94 wordpress_plugin "2008.stateofthemap.org-geopress" do
96 site "2008.stateofthemap.org"
99 directory "/srv/2009.stateofthemap.org" do
105 git "/srv/2009.stateofthemap.org" do
107 repository "https://git.openstreetmap.org/public/stateofthemap.git"
108 revision "resources-2009"
114 wordpress_site "2009.stateofthemap.org" do
115 aliases "2009.stateofthemap.com"
116 directory "/srv/2009.stateofthemap.org/wp"
117 database_name "sotm2009"
118 database_user "sotm2009"
119 database_password passwords["sotm2009"]
120 urls "/register" => "/srv/2009.stateofthemap.org/register",
121 "/register-pro-user" => "/srv/2009.stateofthemap.org/register-pro-user",
122 "/podcasts" => "/srv/2009.stateofthemap.org/podcasts"
125 wordpress_theme "2009.stateofthemap.org-aerodrome" do
127 site "2009.stateofthemap.org"
128 repository "https://git.openstreetmap.org/public/stateofthemap.git"
129 revision "theme-2009"
132 wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
134 site "2009.stateofthemap.org"
137 directory "/srv/2010.stateofthemap.org" do
143 git "/srv/2010.stateofthemap.org" do
145 repository "https://git.openstreetmap.org/public/stateofthemap.git"
146 revision "resources-2010"
152 wordpress_site "2010.stateofthemap.org" do
153 aliases "2010.stateofthemap.com"
154 directory "/srv/2010.stateofthemap.org/wp"
155 database_name "sotm2010"
156 database_user "sotm2010"
157 database_password passwords["sotm2010"]
158 urls "/register" => "/srv/2010.stateofthemap.org/register"
161 wordpress_theme "2010.stateofthemap.org-aerodrome" do
163 site "2010.stateofthemap.org"
164 repository "https://git.openstreetmap.org/public/stateofthemap.git"
165 revision "theme-2010"
168 wordpress_plugin "2010.stateofthemap.org-sitepress-multilingual-cms" do
169 plugin "sitepress-multilingual-cms"
170 site "2010.stateofthemap.org"
171 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
172 not_if { ENV["TEST_KITCHEN"] }
175 wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
177 site "2010.stateofthemap.org"
180 directory "/srv/2011.stateofthemap.org" do
186 git "/srv/2011.stateofthemap.org" do
188 repository "https://git.openstreetmap.org/public/stateofthemap.git"
189 revision "resources-2011"
195 wordpress_site "2011.stateofthemap.org" do
196 aliases "2011.stateofthemap.com"
197 directory "/srv/2011.stateofthemap.org/wp"
198 database_name "sotm2011"
199 database_user "sotm2011"
200 database_password passwords["sotm2011"]
201 urls "/register" => "/srv/2011.stateofthemap.org/register"
204 wordpress_theme "2011.stateofthemap.org-aerodrome" do
206 site "2011.stateofthemap.org"
207 repository "https://git.openstreetmap.org/public/stateofthemap.git"
208 revision "theme-2011"
211 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
212 plugin "sitepress-multilingual-cms"
213 site "2011.stateofthemap.org"
214 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
215 not_if { ENV["TEST_KITCHEN"] }
218 wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
220 site "2011.stateofthemap.org"
223 directory "/srv/2012.stateofthemap.org" do
229 git "/srv/2012.stateofthemap.org" do
231 repository "https://git.openstreetmap.org/public/stateofthemap.git"
232 revision "resources-2012"
238 wordpress_site "2012.stateofthemap.org" do
239 aliases "2012.stateofthemap.com"
240 directory "/srv/2012.stateofthemap.org/wp"
241 database_name "sotm2012"
242 database_user "sotm2012"
243 database_password passwords["sotm2012"]
244 urls "/register" => "/srv/2012.stateofthemap.org/register"
247 wordpress_theme "2012.stateofthemap.org-aerodrome" do
249 site "2012.stateofthemap.org"
250 repository "https://git.openstreetmap.org/public/stateofthemap.git"
251 revision "theme-2012"
254 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
255 plugin "leaflet-maps-marker"
256 site "2012.stateofthemap.org"
259 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
260 plugin "sitepress-multilingual-cms"
261 site "2012.stateofthemap.org"
262 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
263 not_if { ENV["TEST_KITCHEN"] }
266 wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
268 site "2012.stateofthemap.org"
271 %w[2013].each do |year|
272 git "/srv/#{year}.stateofthemap.org" do
274 repository "https://git.openstreetmap.org/public/stateofthemap.git"
275 revision "site-#{year}"
281 ssl_certificate "#{year}.stateofthemap.org" do
282 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
283 notifies :reload, "service[apache2]"
286 apache_site "#{year}.stateofthemap.org" do
287 template "apache.static.erb"
288 directory "/srv/#{year}.stateofthemap.org"
289 variables :year => year
304 apache_module "expires"
305 apache_module "rewrite"
307 gem_package "bundler" do
311 gem_package "bundler" do
315 %w[2016 2017 2018 2019 2020].each do |year|
316 git "/srv/#{year}.stateofthemap.org" do
318 repository "https://github.com/openstreetmap/stateofthemap-#{year}.git"
322 notifies :run, "execute[/srv/#{year}.stateofthemap.org/Gemfile]"
325 directory "/srv/#{year}.stateofthemap.org/_site" do
331 # Workaround https://github.com/jekyll/jekyll/issues/7804
332 # by creating a .jekyll-cache folder
333 directory "/srv/#{year}.stateofthemap.org/.jekyll-cache" do
339 execute "/srv/#{year}.stateofthemap.org/Gemfile" do
341 command "bundle install --deployment"
342 cwd "/srv/#{year}.stateofthemap.org"
345 notifies :run, "execute[/srv/#{year}.stateofthemap.org]"
346 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
349 execute "/srv/#{year}.stateofthemap.org" do
351 command "bundle exec jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
352 cwd "/srv/#{year}.stateofthemap.org"
357 ssl_certificate "#{year}.stateofthemap.org" do
358 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
359 notifies :reload, "service[apache2]"
362 apache_site "#{year}.stateofthemap.org" do
363 template "apache.jekyll.erb"
364 directory "/srv/#{year}.stateofthemap.org/_site"
365 variables :year => year
369 template "/etc/cron.daily/sotm-backup" do
370 source "backup.cron.erb"
374 variables :passwords => passwords