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