]> git.openstreetmap.org Git - chef.git/blob - cookbooks/stateofthemap/recipes/wordpress.rb
b2e34c47b1feb2a82ec5a51095e3469f321295ef
[chef.git] / cookbooks / stateofthemap / recipes / wordpress.rb
1 #
2 # Cookbook:: stateofthemap
3 # Recipe:: wordpress
4 #
5 # Copyright:: 2022, 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 #     https://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 "stateofthemap"
21 include_recipe "wordpress"
22
23 passwords = data_bag_item("stateofthemap", "passwords")
24 wp2fa_encrypt_keys = data_bag_item("stateofthemap", "wp2fa_encrypt_keys")
25
26 directory "/srv/2007.stateofthemap.org" do
27   owner "wordpress"
28   group "wordpress"
29   mode "755"
30 end
31
32 wordpress_site "2007.stateofthemap.org" do
33   aliases "2007.stateofthemap.com"
34   directory "/srv/2007.stateofthemap.org/wp"
35   database_name "sotm2007"
36   database_user "sotm2007"
37   database_password passwords["sotm2007"]
38   database_prefix "wp_sotm_"
39   wp2fa_encrypt_key wp2fa_encrypt_keys["sotm2007"]
40   fpm_prometheus_port 12007
41 end
42
43 wordpress_theme "2007.stateofthemap.org-refreshwp-11" do
44   theme "refreshwp-11"
45   site "2007.stateofthemap.org"
46   repository "https://git.openstreetmap.org/public/stateofthemap.git"
47   revision "theme-2007"
48 end
49
50 # wordpress_plugin "2007.stateofthemap.org-geopress" do
51 #   plugin "geopress"
52 #   site "2007.stateofthemap.org"
53 # end
54
55 directory "/srv/2008.stateofthemap.org" do
56   owner "wordpress"
57   group "wordpress"
58   mode "755"
59 end
60
61 wordpress_site "2008.stateofthemap.org" do
62   aliases "2008.stateofthemap.com"
63   directory "/srv/2008.stateofthemap.org/wp"
64   database_name "sotm2008"
65   database_user "sotm2008"
66   database_password passwords["sotm2008"]
67   database_prefix "wp_sotm08_"
68   wp2fa_encrypt_key wp2fa_encrypt_keys["sotm2008"]
69   fpm_prometheus_port 12008
70 end
71
72 wordpress_theme "2008.stateofthemap.org-refreshwp-11" do
73   theme "refreshwp-11"
74   site "2008.stateofthemap.org"
75   repository "https://git.openstreetmap.org/public/stateofthemap.git"
76   revision "theme-2008"
77 end
78
79 # wordpress_plugin "2008.stateofthemap.org-geopress" do
80 #   plugin "geopress"
81 #   site "2008.stateofthemap.org"
82 # end
83
84 directory "/srv/2009.stateofthemap.org" do
85   owner "wordpress"
86   group "wordpress"
87   mode "755"
88 end
89
90 git "/srv/2009.stateofthemap.org" do
91   action :sync
92   repository "https://git.openstreetmap.org/public/stateofthemap.git"
93   revision "resources-2009"
94   depth 1
95   user "wordpress"
96   group "wordpress"
97 end
98
99 wordpress_site "2009.stateofthemap.org" do
100   aliases "2009.stateofthemap.com"
101   directory "/srv/2009.stateofthemap.org/wp"
102   database_name "sotm2009"
103   database_user "sotm2009"
104   database_password passwords["sotm2009"]
105   wp2fa_encrypt_key wp2fa_encrypt_keys["sotm2009"]
106   urls "/register" => "/srv/2009.stateofthemap.org/register",
107        "/register-pro-user" => "/srv/2009.stateofthemap.org/register-pro-user",
108        "/podcasts" => "/srv/2009.stateofthemap.org/podcasts"
109   fpm_prometheus_port 12009
110 end
111
112 wordpress_theme "2009.stateofthemap.org-aerodrome" do
113   theme "aerodrome"
114   site "2009.stateofthemap.org"
115   repository "https://git.openstreetmap.org/public/stateofthemap.git"
116   revision "theme-2009"
117 end
118
119 # wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
120 #   plugin "wp-sticky"
121 #   site "2009.stateofthemap.org"
122 # end
123
124 directory "/srv/2010.stateofthemap.org" do
125   owner "wordpress"
126   group "wordpress"
127   mode "755"
128 end
129
130 git "/srv/2010.stateofthemap.org" do
131   action :sync
132   repository "https://git.openstreetmap.org/public/stateofthemap.git"
133   revision "resources-2010"
134   depth 1
135   user "wordpress"
136   group "wordpress"
137 end
138
139 wordpress_site "2010.stateofthemap.org" do
140   aliases "2010.stateofthemap.com"
141   directory "/srv/2010.stateofthemap.org/wp"
142   database_name "sotm2010"
143   database_user "sotm2010"
144   database_password passwords["sotm2010"]
145   wp2fa_encrypt_key wp2fa_encrypt_keys["sotm2010"]
146   urls "/register" => "/srv/2010.stateofthemap.org/register"
147   fpm_prometheus_port 12010
148 end
149
150 wordpress_theme "2010.stateofthemap.org-aerodrome" do
151   theme "aerodrome"
152   site "2010.stateofthemap.org"
153   repository "https://git.openstreetmap.org/public/stateofthemap.git"
154   revision "theme-2010"
155 end
156
157 wordpress_plugin "2010.stateofthemap.org-sitepress-multilingual-cms" do
158   plugin "sitepress-multilingual-cms"
159   site "2010.stateofthemap.org"
160   repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
161   revision "master"
162   not_if { kitchen? }
163 end
164
165 # wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
166 #   plugin "wp-sticky"
167 #   site "2010.stateofthemap.org"
168 # end
169
170 directory "/srv/2011.stateofthemap.org" do
171   owner "wordpress"
172   group "wordpress"
173   mode "755"
174 end
175
176 git "/srv/2011.stateofthemap.org" do
177   action :sync
178   repository "https://git.openstreetmap.org/public/stateofthemap.git"
179   revision "resources-2011"
180   depth 1
181   user "wordpress"
182   group "wordpress"
183 end
184
185 wordpress_site "2011.stateofthemap.org" do
186   aliases "2011.stateofthemap.com"
187   directory "/srv/2011.stateofthemap.org/wp"
188   database_name "sotm2011"
189   database_user "sotm2011"
190   database_password passwords["sotm2011"]
191   wp2fa_encrypt_key wp2fa_encrypt_keys["sotm2011"]
192   urls "/register" => "/srv/2011.stateofthemap.org/register"
193   fpm_prometheus_port 12011
194 end
195
196 wordpress_theme "2011.stateofthemap.org-aerodrome" do
197   theme "aerodrome"
198   site "2011.stateofthemap.org"
199   repository "https://git.openstreetmap.org/public/stateofthemap.git"
200   revision "theme-2011"
201 end
202
203 wordpress_plugin "2011.stateofthemap.org-sitepress-multilingual-cms" do
204   plugin "sitepress-multilingual-cms"
205   site "2011.stateofthemap.org"
206   repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
207   revision "master"
208   not_if { kitchen? }
209 end
210
211 # wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
212 #   plugin "wp-sticky"
213 #   site "2011.stateofthemap.org"
214 # end
215
216 directory "/srv/2012.stateofthemap.org" do
217   owner "wordpress"
218   group "wordpress"
219   mode "755"
220 end
221
222 git "/srv/2012.stateofthemap.org" do
223   action :sync
224   repository "https://git.openstreetmap.org/public/stateofthemap.git"
225   revision "resources-2012"
226   depth 1
227   user "wordpress"
228   group "wordpress"
229 end
230
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   wp2fa_encrypt_key wp2fa_encrypt_keys["sotm2012"]
238   urls "/register" => "/srv/2012.stateofthemap.org/register"
239   fpm_prometheus_port 12012
240 end
241
242 wordpress_theme "2012.stateofthemap.org-aerodrome" do
243   theme "aerodrome"
244   site "2012.stateofthemap.org"
245   repository "https://git.openstreetmap.org/public/stateofthemap.git"
246   revision "theme-2012"
247 end
248
249 wordpress_plugin "2012.stateofthemap.org-leaflet-maps-marker" do
250   plugin "leaflet-maps-marker"
251   site "2012.stateofthemap.org"
252 end
253
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   revision "master"
259   not_if { kitchen? }
260 end
261
262 # wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
263 #   plugin "wp-sticky"
264 #   site "2012.stateofthemap.org"
265 # end
266
267 template "/etc/cron.daily/sotm-backup" do
268   source "backup.cron.erb"
269   owner "root"
270   group "root"
271   mode "750"
272   variables :passwords => passwords
273 end