Merge remote-tracking branch 'origin/erp5' into erp5-z2.13
[slapos.git] / stack / lamp / apache / instance-apache-php.cfg.in
1 [buildout]
2
3 parts =
4   certificate-authority
5   ca-stunnel
6   logrotate
7   logrotate-entry-apache
8   logrotate-entry-stunnel
9   cron
10   cron-entry-logrotate
11   promise
12   slapmonitor
13   slapmonitor-xml
14
15   frontend-promise
16   content-promise
17   publish-connection-informations
18
19 eggs-directory = ${buildout:eggs-directory}
20 develop-eggs-directory = ${buildout:develop-eggs-directory}
21 offline = true
22
23
24 #----------------
25 #--
26 #-- Creation of all needed directories.
27
28 [rootdirectory]
29 recipe = slapos.cookbook:mkdirectory
30 etc = $${buildout:directory}/etc
31 var = $${buildout:directory}/var
32 srv = $${buildout:directory}/srv
33 bin = $${buildout:directory}/bin
34 tmp = $${buildout:directory}/tmp
35
36 [basedirectory]
37 recipe = slapos.cookbook:mkdirectory
38 log = $${rootdirectory:var}/log
39 services = $${rootdirectory:etc}/service
40 run = $${rootdirectory:var}/run
41 backup = $${rootdirectory:srv}/backup
42 promises = $${rootdirectory:etc}/promise
43
44 [directory]
45 recipe = slapos.cookbook:mkdirectory
46 cron-entries = $${rootdirectory:etc}/cron.d
47 crontabs = $${rootdirectory:etc}/crontabs
48 cronstamps = $${rootdirectory:etc}/cronstamps
49 ca-dir = $${rootdirectory:srv}/ssl
50 httpd-log = $${basedirectory:log}/apache
51 php-ini-dir = $${rootdirectory:etc}/php
52 tmp-php = $${rootdirectory:tmp}/php
53 logrotate-entries = $${rootdirectory:etc}/logrotate.d
54 logrotate-backup = $${basedirectory:backup}/logrotate
55 report = $${rootdirectory:etc}/report
56 stunnel-conf = $${rootdirectory:etc}/stunnel
57 xml-report = $${rootdirectory:var}/xml_report
58
59 [cadirectory]
60 recipe = slapos.cookbook:mkdirectory
61 requests = $${directory:ca-dir}/requests
62 private = $${directory:ca-dir}/private
63 certs = $${directory:ca-dir}/certs
64 newcerts = $${directory:ca-dir}/newcerts
65 crl = $${directory:ca-dir}/crl
66
67
68 #----------------
69 #--
70 #-- Deploy cron.
71
72 [cron]
73 recipe = slapos.cookbook:cron
74 dcrond-binary = ${dcron:location}/sbin/crond
75 cron-entries = $${directory:cron-entries}
76 crontabs = $${directory:crontabs}
77 cronstamps = $${directory:cronstamps}
78 catcher = $${cron-simplelogger:wrapper}
79 binary = $${basedirectory:services}/crond
80
81 [cron-simplelogger]
82 recipe = slapos.cookbook:simplelogger
83 wrapper = $${rootdirectory:bin}/cron_simplelogger
84 log = $${basedirectory:log}/crond.log
85
86
87 #----------------
88 #--
89 #-- Deploy logrotate.
90
91 [cron-entry-logrotate]
92 <= cron
93 recipe = slapos.cookbook:cron.d
94 name = logrotate
95 frequency = 0 0 * * *
96 command = $${logrotate:wrapper}
97
98 [logrotate]
99 recipe = slapos.cookbook:logrotate
100 # Binaries
101 logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
102 gzip-binary = ${gzip:location}/bin/gzip
103 gunzip-binary = ${gzip:location}/bin/gunzip
104 # Directories
105 wrapper = $${rootdirectory:bin}/logrotate
106 conf = $${rootdirectory:etc}/logrotate.conf
107 logrotate-entries = $${directory:logrotate-entries}
108 backup = $${directory:logrotate-backup}
109 state-file = $${rootdirectory:srv}/logrotate.status
110
111
112 #----------------
113 #--
114 #-- Deploy stunnel.
115
116 [stunnel]
117 recipe = slapos.cookbook:stunnel
118 client = true
119 stunnel-binary = ${stunnel:location}/bin/stunnel
120 remote-host = $${mariadb-urlparse:host}
121 remote-port = $${mariadb-urlparse:port}
122 local-host = $${slap-network-information:local-ipv4}
123 local-port = 33060
124 log-file = $${basedirectory:log}/stunnel.log
125 config-file = $${directory:stunnel-conf}/stunnel.conf
126 key-file = $${directory:stunnel-conf}/stunnel.key
127 cert-file = $${directory:stunnel-conf}/stunnel.crt
128 pid-file = $${basedirectory:run}/stunnel.pid
129 wrapper = $${rootdirectory:bin}/raw_stunnel
130 post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
131
132 [logrotate-entry-stunnel]
133 <= logrotate
134 recipe = slapos.cookbook:logrotate.d
135 name = stunnel
136 log = $${stunnel:log-file}
137 frequency = daily
138 rotate-num = 30
139 notifempty = true
140 create = true
141 post = $${stunnel:post-rotate-script}
142
143
144 #----------------
145 #--
146 #-- Certificate stuff.
147
148 [certificate-authority]
149 recipe = slapos.cookbook:certificate_authority
150 openssl-binary = ${openssl:location}/bin/openssl
151 ca-dir = $${directory:ca-dir}
152 requests-directory = $${cadirectory:requests}
153 wrapper = $${basedirectory:services}/ca
154 ca-private = $${cadirectory:private}
155 ca-certs = $${cadirectory:certs}
156 ca-newcerts = $${cadirectory:newcerts}
157 ca-crl = $${cadirectory:crl}
158
159 [ca-stunnel]
160 <= certificate-authority
161 recipe = slapos.cookbook:certificate_authority.request
162 executable = $${stunnel:wrapper}
163 wrapper = $${basedirectory:services}/stunnel
164 key-file = $${stunnel:key-file}
165 cert-file = $${stunnel:cert-file}
166
167
168 #----------------
169 #--
170 #-- Request MariaDB instance and parse its URL.
171
172 [request-mariadb]
173 <= slap-connection
174 recipe = slapos.cookbook:request
175 name = MariaDB
176 software-url = $${slap-connection:software-release-url}
177 software-type = mariadb
178 return = url
179 sla = computer_guid
180 sla-computer_guid = $${slap-connection:computer-id}
181
182 [mariadb-urlparse]
183 recipe = slapos.cookbook:urlparse
184 url = $${request-mariadb:connection-url}
185
186
187 #----------------
188 #--
189 #-- Deploy Apache + PHP application.
190
191 [apache-php]
192 recipe = slapos.cookbook:apachephp
193 source = ${application:location}
194 template = ${application-template:location}/${application-template:filename}
195 configuration = ${application-configuration:location}
196
197 htdocs = $${rootdirectory:srv}/www/
198 pid-file = $${basedirectory:run}/apache.pid
199 lock-file = $${basedirectory:run}/apache.lock
200 ip = $${slap-network-information:global-ipv6}
201 port = 8080
202 url = http://[$${:ip}]:$${:port}/
203 error-log = $${directory:httpd-log}/error.log
204 access-log = $${directory:httpd-log}/access.log
205 php-ini-dir = $${directory:php-ini-dir}
206 tmp-dir = $${directory:tmp-php}
207 httpd-conf = $${rootdirectory:etc}/apache.conf
208 wrapper = $${basedirectory:services}/apache
209
210 httpd-binary = ${apache:location}/bin/httpd
211
212 mysql-username = $${mariadb-urlparse:username}
213 mysql-password = $${mariadb-urlparse:password}
214 mysql-database = $${mariadb-urlparse:path}
215 mysql-host = $${stunnel:local-host}
216 mysql-port = $${stunnel:local-port}
217
218 [logrotate-entry-apache]
219 <= logrotate
220 recipe = slapos.cookbook:logrotate.d
221 name = apache
222 log = $${apache-php:error-log} $${apache-php:access-log}
223 frequency = daily
224 rotate-num = 30
225 sharedscripts = true
226 notifempty = true
227 create = true
228
229
230 #----------------
231 #--
232 #-- Request frontend.
233
234 [request-frontend]
235 <= slap-connection
236 recipe = slapos.cookbook:requestoptional
237 name = Frontend
238 # XXX We have hardcoded SR URL here.
239 software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
240 slave = true
241 config = url custom_domain
242 config-url = http://[$${apache-php:ip}]:$${apache-php:port}/
243 return = site_url
244 config-custom_domain = $${slap-parameter:domain}
245
246
247 #----------------
248 #--
249 #-- Deploy slapmonitor.
250
251 [slapmonitor]
252 recipe = slapos.cookbook:slapmonitor
253 pid-file = $${basedirectory:run}/apache.pid
254 database-path = $${basedirectory:log}/slapmonitor.db
255 slapmonitor-path = ${buildout:bin-directory}/slapmonitor
256 path = $${basedirectory:services}/slapmonitor
257
258 [slapmonitor-xml]
259 recipe = slapos.cookbook:slapmonitor-xml
260 database-path = $${basedirectory:log}/slapmonitor.db
261 slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
262 path = $${directory:report}/slapmonitor-xml
263
264
265 #----------------
266 #--
267 #-- Publish instance parameters.
268
269 [publish-connection-informations]
270 recipe = slapos.cookbook:publish
271 backend_url = $${apache-php:url}
272 url = $${request-frontend:connection-site_url}
273
274
275 #----------------
276 #--
277 #-- Deploy promises scripts.
278
279 [promise]
280 recipe = slapos.cookbook:check_port_listening
281 path = $${basedirectory:promises}/apache
282 hostname = $${apache-php:ip}
283 port = $${apache-php:port}
284
285 [frontend-promise]
286 recipe = slapos.cookbook:check_url_available
287 path = $${basedirectory:promises}/frontend
288 url = $${request-frontend:connection-site_url}
289 dash_path = ${dash:location}/bin/dash
290 curl_path = ${curl:location}/bin/curl
291
292 [content-promise]
293 recipe = slapos.cookbook:check_page_content
294 path = $${basedirectory:promises}/content
295 url = $${request-frontend:connection-site_url}
296 dash_path = ${dash:location}/bin/dash
297 curl_path = ${curl:location}/bin/curl
298
299
300
301
302 [slap-parameter]
303 # Default value if no domain is specified
304 domain =
305 # Default value if no ssh parameter is specified
306 logbox-ip =
307 logbox-port =
308 logbox-user =
309 logbox-passwd =
310