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