Decouple ip/port from apache-php section so that we actually can request the frontend...
[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 #--
193 #-- Common network parameters
194 [apache-network-configuration]
195 listening-ip = $${slap-network-information:global-ipv6}
196 listening-port = 8080
197
198
199 #----------------
200 #--
201 #-- Deploy Apache + PHP application.
202
203 [apache-php]
204 recipe = slapos.cookbook:apachephp
205 source = ${application:location}
206 template = ${application-template:location}/${application-template:filename}
207 configuration = ${application-configuration:location}
208
209 htdocs = $${directory:www}
210 pid-file = $${basedirectory:run}/apache.pid
211 lock-file = $${basedirectory:run}/apache.lock
212 ip = $${apache-network-configuration:listening-ip}
213 port = $${apache-network-configuration:listening-port}
214 url = http://[$${:ip}]:$${:port}/
215 error-log = $${directory:httpd-log}/error.log
216 access-log = $${directory:httpd-log}/access.log
217 php-ini-dir = $${directory:php-ini-dir}
218 tmp-dir = $${directory:tmp-php}
219 httpd-conf = $${rootdirectory:etc}/apache.conf
220 wrapper = $${basedirectory:services}/apache
221
222 httpd-binary = ${apache:location}/bin/httpd
223
224 mysql-username = $${mariadb-urlparse:username}
225 mysql-password = $${mariadb-urlparse:password}
226 mysql-database = $${mariadb-urlparse:path}
227 mysql-host = $${stunnel:local-host}
228 mysql-port = $${stunnel:local-port}
229
230 [logrotate-entry-apache]
231 <= logrotate
232 recipe = slapos.cookbook:logrotate.d
233 name = apache
234 log = $${apache-php:error-log} $${apache-php:access-log}
235 frequency = daily
236 rotate-num = 30
237 sharedscripts = true
238 notifempty = true
239 create = true
240
241
242 #----------------
243 #--
244 #-- Request frontend.
245
246 [request-frontend]
247 <= slap-connection
248 recipe = slapos.cookbook:requestoptional
249 name = Frontend
250 # XXX We have hardcoded SR URL here.
251 software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
252 slave = true
253 config = url custom_domain
254 config-url = http://[$${apache-network-configuration:listening-ip}]:$${apache-network-configuration:listening-port}/
255 return = site_url
256 config-custom_domain = $${slap-parameter:domain}
257
258
259 #----------------
260 #--
261 #-- Deploy slapmonitor.
262
263 #[slapmonitor]
264 #recipe = slapos.cookbook:slapmonitor
265 #pid-file = $${basedirectory:run}/apache.pid
266 #database-path = $${basedirectory:log}/slapmonitor.db
267 #slapmonitor-path = ${buildout:bin-directory}/slapmonitor
268 #path = $${basedirectory:services}/slapmonitor
269 #
270 #[slapmonitor-xml]
271 #recipe = slapos.cookbook:slapmonitor-xml
272 #database-path = $${basedirectory:log}/slapmonitor.db
273 #slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
274 #path = $${directory:report}/slapmonitor-xml
275
276
277 #----------------
278 #--
279 #-- Publish instance parameters.
280
281 [publish-connection-informations]
282 recipe = slapos.cookbook:publish
283 backend_url = $${apache-php:url}
284 url = $${request-frontend:connection-site_url}
285
286
287 #----------------
288 #--
289 #-- Deploy promises scripts.
290
291 [promise]
292 recipe = slapos.cookbook:check_port_listening
293 path = $${basedirectory:promises}/apache
294 hostname = $${apache-php:ip}
295 port = $${apache-php:port}
296
297 [frontend-promise]
298 recipe = slapos.cookbook:check_url_available
299 path = $${basedirectory:promises}/frontend
300 url = $${request-frontend:connection-site_url}
301 dash_path = ${dash:location}/bin/dash
302 curl_path = ${curl:location}/bin/curl
303
304 [content-promise]
305 recipe = slapos.cookbook:check_page_content
306 path = $${basedirectory:promises}/content
307 url = $${request-frontend:connection-site_url}
308 dash_path = ${dash:location}/bin/dash
309 curl_path = ${curl:location}/bin/curl
310
311
312
313
314 [slap-parameter]
315 # Default value if no domain is specified
316 domain =
317 # Default value if no ssh parameter is specified
318 logbox-ip =
319 logbox-port =
320 logbox-user =
321 logbox-passwd =
322