Avoid duplicate resource names for wordpress plugins and themes
[chef.git] / cookbooks / stateofthemap / recipes / default.rb
1 #
2 # Cookbook Name:: stateofthemap
3 # Recipe:: default
4 #
5 # Copyright 2013, OpenStreetMap Foundation
6 #
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
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19
20 include_recipe "wordpress"
21
22 passwords = data_bag_item("stateofthemap", "passwords")
23
24 git "/srv/stateofthemap.org" do
25   action :sync
26   repository "git://git.openstreetmap.org/stateofthemap.git"
27   revision "chooser"
28   user "root"
29   group "root"
30 end
31
32 ssl_certificate "stateofthemap.org" do
33   domains ["stateofthemap.org", "www.stateofthemap.org",
34            "stateofthemap.com", "www.stateofthemap.com"]
35   notifies :reload, "service[apache2]"
36 end
37
38 apache_site "stateofthemap.org" do
39   template "apache.erb"
40   directory "/srv/stateofthemap.org"
41 end
42
43 directory "/srv/2007.stateofthemap.org" do
44   owner "wordpress"
45   group "wordpress"
46   mode 0o755
47 end
48
49 wordpress_site "2007.stateofthemap.org" do
50   aliases "2007.stateofthemap.com"
51   directory "/srv/2007.stateofthemap.org/wp"
52   ssl_enabled true
53   database_name "sotm2007"
54   database_user "sotm2007"
55   database_password passwords["sotm2007"]
56   database_prefix "wp_sotm_"
57 end
58
59 wordpress_theme "2007.stateofthemap.org-refreshwp-11" do
60   name "refreshwp-11"
61   site "2007.stateofthemap.org"
62   repository "git://git.openstreetmap.org/stateofthemap.git"
63   revision "theme-2007"
64 end
65
66 wordpress_plugin "2007.stateofthemap.org-geopress" do
67   name "geopress"
68   site "2007.stateofthemap.org"
69 end
70
71 directory "/srv/2008.stateofthemap.org" do
72   owner "wordpress"
73   group "wordpress"
74   mode 0o755
75 end
76
77 wordpress_site "2008.stateofthemap.org" do
78   aliases "2008.stateofthemap.com"
79   directory "/srv/2008.stateofthemap.org/wp"
80   ssl_enabled true
81   database_name "sotm2008"
82   database_user "sotm2008"
83   database_password passwords["sotm2008"]
84   database_prefix "wp_sotm08_"
85 end
86
87 wordpress_theme "2008.stateofthemap.org-refreshwp-11" do
88   name "refreshwp-11"
89   site "2008.stateofthemap.org"
90   repository "git://git.openstreetmap.org/stateofthemap.git"
91   revision "theme-2008"
92 end
93
94 wordpress_plugin "2008.stateofthemap.org-geopress" do
95   name "geopress"
96   site "2008.stateofthemap.org"
97 end
98
99 directory "/srv/2009.stateofthemap.org" do
100   owner "wordpress"
101   group "wordpress"
102   mode 0o755
103 end
104
105 git "/srv/2009.stateofthemap.org" do
106   action :sync
107   repository "git://git.openstreetmap.org/stateofthemap.git"
108   revision "resources-2009"
109   user "wordpress"
110   group "wordpress"
111 end
112
113 wordpress_site "2009.stateofthemap.org" do
114   aliases "2009.stateofthemap.com"
115   directory "/srv/2009.stateofthemap.org/wp"
116   ssl_enabled true
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"
123 end
124
125 wordpress_theme "2009.stateofthemap.org-aerodrome" do
126   name "aerodrome"
127   site "2009.stateofthemap.org"
128   repository "git://git.openstreetmap.org/stateofthemap.git"
129   revision "theme-2009"
130 end
131
132 wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
133   name "wp-sticky"
134   site "2009.stateofthemap.org"
135 end
136
137 directory "/srv/2010.stateofthemap.org" do
138   owner "wordpress"
139   group "wordpress"
140   mode 0o755
141 end
142
143 git "/srv/2010.stateofthemap.org" do
144   action :sync
145   repository "git://git.openstreetmap.org/stateofthemap.git"
146   revision "resources-2010"
147   user "wordpress"
148   group "wordpress"
149 end
150
151 wordpress_site "2010.stateofthemap.org" do
152   aliases "2010.stateofthemap.com"
153   directory "/srv/2010.stateofthemap.org/wp"
154   ssl_enabled true
155   database_name "sotm2010"
156   database_user "sotm2010"
157   database_password passwords["sotm2010"]
158   urls "/register" => "/srv/2010.stateofthemap.org/register"
159 end
160
161 wordpress_theme "2010.stateofthemap.org-aerodrome" do
162   name "aerodrome"
163   site "2010.stateofthemap.org"
164   repository "git://git.openstreetmap.org/stateofthemap.git"
165   revision "theme-2010"
166 end
167
168 wordpress_plugin "2010.stateofthemap.org-sitepress-multilingual-cms" do
169   name "sitepress-multilingual-cms"
170   site "2010.stateofthemap.org"
171   repository "git://chef.openstreetmap.org/sitepress-multilingual-cms.git"
172 end
173
174 wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
175   name "wp-sticky"
176   site "2010.stateofthemap.org"
177 end
178
179 directory "/srv/2011.stateofthemap.org" do
180   owner "wordpress"
181   group "wordpress"
182   mode 0o755
183 end
184
185 git "/srv/2011.stateofthemap.org" do
186   action :sync
187   repository "git://git.openstreetmap.org/stateofthemap.git"
188   revision "resources-2011"
189   user "wordpress"
190   group "wordpress"
191 end
192
193 wordpress_site "2011.stateofthemap.org" do
194   aliases "2011.stateofthemap.com"
195   directory "/srv/2011.stateofthemap.org/wp"
196   ssl_enabled true
197   database_name "sotm2011"
198   database_user "sotm2011"
199   database_password passwords["sotm2011"]
200   urls "/register" => "/srv/2011.stateofthemap.org/register"
201 end
202
203 wordpress_theme "2011.stateofthemap.org-aerodrome" do
204   name "aerodrome"
205   site "2011.stateofthemap.org"
206   repository "git://git.openstreetmap.org/stateofthemap.git"
207   revision "theme-2011"
208 end
209
210 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
211   name "sitepress-multilingual-cms"
212   site "2011.stateofthemap.org"
213   repository "git://chef.openstreetmap.org/sitepress-multilingual-cms.git"
214 end
215
216 wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
217   name "wp-sticky"
218   site "2011.stateofthemap.org"
219 end
220
221 directory "/srv/2012.stateofthemap.org" do
222   owner "wordpress"
223   group "wordpress"
224   mode 0o755
225 end
226
227 git "/srv/2012.stateofthemap.org" do
228   action :sync
229   repository "git://git.openstreetmap.org/stateofthemap.git"
230   revision "resources-2012"
231   user "wordpress"
232   group "wordpress"
233 end
234
235 wordpress_site "2012.stateofthemap.org" do
236   aliases "2012.stateofthemap.com"
237   directory "/srv/2012.stateofthemap.org/wp"
238   ssl_enabled true
239   database_name "sotm2012"
240   database_user "sotm2012"
241   database_password passwords["sotm2012"]
242   urls "/register" => "/srv/2012.stateofthemap.org/register"
243 end
244
245 wordpress_theme "2012.stateofthemap.org-aerodrome" do
246   name "aerodrome"
247   site "2012.stateofthemap.org"
248   repository "git://git.openstreetmap.org/stateofthemap.git"
249   revision "theme-2012"
250 end
251
252 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
253   name "leaflet-maps-marker"
254   site "2012.stateofthemap.org"
255 end
256
257 wordpress_plugin "2012.stateofthemap.org-sitepress-multilingual-cms" do
258   name "sitepress-multilingual-cms"
259   site "2012.stateofthemap.org"
260   repository "git://chef.openstreetmap.org/sitepress-multilingual-cms.git"
261 end
262
263 wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
264   name "wp-sticky"
265   site "2012.stateofthemap.org"
266 end
267
268 template "/etc/cron.daily/sotm-backup" do
269   source "backup.cron.erb"
270   owner "root"
271   group "root"
272   mode 0o750
273   variables :passwords => passwords
274 end