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