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