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.
21 include_recipe "wordpress"
23 passwords = data_bag_item("stateofthemap", "passwords")
25 git "/srv/stateofthemap.org" do
27 repository "https://git.openstreetmap.org/public/stateofthemap.git"
34 ssl_certificate "stateofthemap.org" do
35 domains ["stateofthemap.org", "www.stateofthemap.org",
36 "stateofthemap.com", "www.stateofthemap.com",
37 "sotm.org", "www.sotm.org"]
38 notifies :reload, "service[apache2]"
41 apache_site "stateofthemap.org" do
43 directory "/srv/stateofthemap.org"
46 directory "/srv/2007.stateofthemap.org" do
52 wordpress_site "2007.stateofthemap.org" do
53 aliases "2007.stateofthemap.com"
54 directory "/srv/2007.stateofthemap.org/wp"
55 database_name "sotm2007"
56 database_user "sotm2007"
57 database_password passwords["sotm2007"]
58 database_prefix "wp_sotm_"
59 fpm_prometheus_port 12007
62 wordpress_theme "2007.stateofthemap.org-refreshwp-11" do
64 site "2007.stateofthemap.org"
65 repository "https://git.openstreetmap.org/public/stateofthemap.git"
69 # wordpress_plugin "2007.stateofthemap.org-geopress" do
71 # site "2007.stateofthemap.org"
74 directory "/srv/2008.stateofthemap.org" do
80 wordpress_site "2008.stateofthemap.org" do
81 aliases "2008.stateofthemap.com"
82 directory "/srv/2008.stateofthemap.org/wp"
83 database_name "sotm2008"
84 database_user "sotm2008"
85 database_password passwords["sotm2008"]
86 database_prefix "wp_sotm08_"
87 fpm_prometheus_port 12008
90 wordpress_theme "2008.stateofthemap.org-refreshwp-11" do
92 site "2008.stateofthemap.org"
93 repository "https://git.openstreetmap.org/public/stateofthemap.git"
97 # wordpress_plugin "2008.stateofthemap.org-geopress" do
99 # site "2008.stateofthemap.org"
102 directory "/srv/2009.stateofthemap.org" do
108 git "/srv/2009.stateofthemap.org" do
110 repository "https://git.openstreetmap.org/public/stateofthemap.git"
111 revision "resources-2009"
117 wordpress_site "2009.stateofthemap.org" do
118 aliases "2009.stateofthemap.com"
119 directory "/srv/2009.stateofthemap.org/wp"
120 database_name "sotm2009"
121 database_user "sotm2009"
122 database_password passwords["sotm2009"]
123 urls "/register" => "/srv/2009.stateofthemap.org/register",
124 "/register-pro-user" => "/srv/2009.stateofthemap.org/register-pro-user",
125 "/podcasts" => "/srv/2009.stateofthemap.org/podcasts"
126 fpm_prometheus_port 12009
129 wordpress_theme "2009.stateofthemap.org-aerodrome" do
131 site "2009.stateofthemap.org"
132 repository "https://git.openstreetmap.org/public/stateofthemap.git"
133 revision "theme-2009"
136 # wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
138 # site "2009.stateofthemap.org"
141 directory "/srv/2010.stateofthemap.org" do
147 git "/srv/2010.stateofthemap.org" do
149 repository "https://git.openstreetmap.org/public/stateofthemap.git"
150 revision "resources-2010"
156 wordpress_site "2010.stateofthemap.org" do
157 aliases "2010.stateofthemap.com"
158 directory "/srv/2010.stateofthemap.org/wp"
159 database_name "sotm2010"
160 database_user "sotm2010"
161 database_password passwords["sotm2010"]
162 urls "/register" => "/srv/2010.stateofthemap.org/register"
163 fpm_prometheus_port 12010
166 wordpress_theme "2010.stateofthemap.org-aerodrome" do
168 site "2010.stateofthemap.org"
169 repository "https://git.openstreetmap.org/public/stateofthemap.git"
170 revision "theme-2010"
173 wordpress_plugin "2010.stateofthemap.org-sitepress-multilingual-cms" do
174 plugin "sitepress-multilingual-cms"
175 site "2010.stateofthemap.org"
176 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
181 # wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
183 # site "2010.stateofthemap.org"
186 directory "/srv/2011.stateofthemap.org" do
192 git "/srv/2011.stateofthemap.org" do
194 repository "https://git.openstreetmap.org/public/stateofthemap.git"
195 revision "resources-2011"
201 wordpress_site "2011.stateofthemap.org" do
202 aliases "2011.stateofthemap.com"
203 directory "/srv/2011.stateofthemap.org/wp"
204 database_name "sotm2011"
205 database_user "sotm2011"
206 database_password passwords["sotm2011"]
207 urls "/register" => "/srv/2011.stateofthemap.org/register"
208 fpm_prometheus_port 12011
211 wordpress_theme "2011.stateofthemap.org-aerodrome" do
213 site "2011.stateofthemap.org"
214 repository "https://git.openstreetmap.org/public/stateofthemap.git"
215 revision "theme-2011"
218 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
219 plugin "sitepress-multilingual-cms"
220 site "2011.stateofthemap.org"
221 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
226 # wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
228 # site "2011.stateofthemap.org"
231 directory "/srv/2012.stateofthemap.org" do
237 git "/srv/2012.stateofthemap.org" do
239 repository "https://git.openstreetmap.org/public/stateofthemap.git"
240 revision "resources-2012"
246 wordpress_site "2012.stateofthemap.org" do
247 aliases "2012.stateofthemap.com"
248 directory "/srv/2012.stateofthemap.org/wp"
249 database_name "sotm2012"
250 database_user "sotm2012"
251 database_password passwords["sotm2012"]
252 urls "/register" => "/srv/2012.stateofthemap.org/register"
253 fpm_prometheus_port 12012
256 wordpress_theme "2012.stateofthemap.org-aerodrome" do
258 site "2012.stateofthemap.org"
259 repository "https://git.openstreetmap.org/public/stateofthemap.git"
260 revision "theme-2012"
263 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
264 plugin "leaflet-maps-marker"
265 site "2012.stateofthemap.org"
268 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
269 plugin "sitepress-multilingual-cms"
270 site "2012.stateofthemap.org"
271 repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
276 # wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
278 # site "2012.stateofthemap.org"
281 %w[2013].each do |year|
282 git "/srv/#{year}.stateofthemap.org" do
284 repository "https://git.openstreetmap.org/public/stateofthemap.git"
285 revision "site-#{year}"
291 ssl_certificate "#{year}.stateofthemap.org" do
292 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
293 notifies :reload, "service[apache2]"
296 apache_site "#{year}.stateofthemap.org" do
297 template "apache.static.erb"
298 directory "/srv/#{year}.stateofthemap.org"
299 variables :year => year
312 apache_module "expires"
313 apache_module "rewrite"
315 %w[2016 2017 2018 2019 2020 2021 2022].each do |year|
316 git "/srv/#{year}.stateofthemap.org" do
318 repository "https://github.com/openstreetmap/stateofthemap-#{year}.git"
322 notifies :run, "bundle_install[/srv/#{year}.stateofthemap.org]"
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 bundle_install "/srv/#{year}.stateofthemap.org" do
341 options "--deployment --jobs #{node[:cpu][:total]}"
344 notifies :run, "bundle_exec[/srv/#{year}.stateofthemap.org]"
345 only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
348 bundle_exec "/srv/#{year}.stateofthemap.org" do
350 command "jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
353 environment "LANG" => "C.UTF-8"
356 ssl_certificate "#{year}.stateofthemap.org" do
357 domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"]
358 notifies :reload, "service[apache2]"
361 apache_site "#{year}.stateofthemap.org" do
362 template "apache.jekyll.erb"
363 directory "/srv/#{year}.stateofthemap.org/_site"
364 variables :year => year
368 template "/etc/cron.daily/sotm-backup" do
369 source "backup.cron.erb"
373 variables :passwords => passwords