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