Merge branch 'erp5'
[slapos.git] / stack / lapp / 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   slapmonitor
14   slapmonitor-xml
15
16   frontend-promise
17   content-promise
18   publish-connection-informations
19   ${custom-application-deployment:part-list}
20
21 eggs-directory = ${buildout:eggs-directory}
22 develop-eggs-directory = ${buildout:develop-eggs-directory}
23 offline = true
24
25
26 #----------------
27 #--
28 #-- Creation of all needed directories.
29
30 [rootdirectory]
31 recipe = slapos.cookbook:mkdirectory
32 etc = $${buildout:directory}/etc
33 var = $${buildout:directory}/var
34 srv = $${buildout:directory}/srv
35 bin = $${buildout:directory}/bin
36 tmp = $${buildout:directory}/tmp
37
38 [basedirectory]
39 recipe = slapos.cookbook:mkdirectory
40 log = $${rootdirectory:var}/log
41 services = $${rootdirectory:etc}/service
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 = $${postgres-urlparse:host}
124 remote-port = $${postgres-urlparse:port}
125 local-host = $${slap-network-information:local-ipv4}
126 local-port = 33060
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 Postgres instance and parse its URL.
174
175 [request-postgres]
176 <= slap-connection
177 recipe = slapos.cookbook:request
178 name = Postgres
179 software-url = $${slap-connection:software-release-url}
180 software-type = postgres
181 return = url
182 sla = computer_guid
183 sla-computer_guid = $${slap-connection:computer-id}
184
185 [postgres-urlparse]
186 recipe = slapos.cookbook:urlparse
187 url = $${request-postgres:connection-url}
188
189
190 #----------------
191 #--
192 #-- Deploy Apache + PHP application.
193 #-- Despite the names of mysql-* parameters, they are not really specific to mysql.
194
195 [apache-php]
196 recipe = slapos.cookbook:apachephp
197 source = ${application:location}
198
199 htdocs = $${directory:www}
200 pid-file = $${basedirectory:run}/apache.pid
201 lock-file = $${basedirectory:run}/apache.lock
202 ip = $${slap-network-information:global-ipv6}
203 port = 8080
204 url = http://[$${:ip}]:$${:port}/
205 error-log = $${directory:httpd-log}/error.log
206 access-log = $${directory:httpd-log}/access.log
207 php-ini-dir = $${directory:php-ini-dir}
208 tmp-dir = $${directory:tmp-php}
209 httpd-conf = $${rootdirectory:etc}/apache.conf
210 wrapper = $${basedirectory:services}/apache
211
212 httpd-binary = ${apache:location}/bin/httpd
213
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 slapmonitor-path = ${buildout:bin-directory}/slapmonitor
253 path = $${basedirectory:services}/slapmonitor
254
255 [slapmonitor-xml]
256 recipe = slapos.cookbook:slapmonitor-xml
257 database-path = $${basedirectory:log}/slapmonitor.db
258 slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
259 path = $${directory:report}/slapmonitor-xml
260
261
262 #----------------
263 #--
264 #-- Publish instance parameters.
265
266 [publish-connection-informations]
267 recipe = slapos.cookbook:publish
268 backend_url = $${apache-php:url}
269 url = $${request-frontend:connection-site_url}
270
271
272 #----------------
273 #--
274 #-- Deploy promises scripts.
275
276 [promise]
277 recipe = slapos.cookbook:check_port_listening
278 path = $${basedirectory:promises}/apache
279 hostname = $${apache-php:ip}
280 port = $${apache-php:port}
281
282 [frontend-promise]
283 recipe = slapos.cookbook:check_url_available
284 path = $${basedirectory:promises}/frontend
285 url = $${request-frontend:connection-site_url}
286 dash_path = ${dash:location}/bin/dash
287 curl_path = ${curl:location}/bin/curl
288
289 [content-promise]
290 recipe = slapos.cookbook:check_page_content
291 path = $${basedirectory:promises}/content
292 url = $${request-frontend:connection-site_url}
293 dash_path = ${dash:location}/bin/dash
294 curl_path = ${curl:location}/bin/curl
295
296
297
298
299 [slap-parameter]
300 # Default value if no domain is specified
301 domain =
302 # Default value if no ssh parameter is specified
303 logbox-ip =
304 logbox-port =
305 logbox-user =
306 logbox-passwd =
307