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