instance-apache-php.cfg.in 7.84 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
[buildout]

parts =
  certificate-authority
  ca-stunnel
  logrotate
  logrotate-entry-apache
  logrotate-entry-stunnel
  cron
  cron-entry-logrotate
11
  promise
12
  slapmonitor
13 14
  slapmonitor-xml

15
  frontend-promise
16
  content-promise
17
  publish-connection-informations
18 19 20 21 22 23

eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true


24 25 26 27
#----------------
#--
#-- Creation of all needed directories.

28 29
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
30 31 32 33 34
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
35

36 37
[basedirectory]
recipe = slapos.cookbook:mkdirectory
38 39 40 41 42
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/run
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
43

44 45
[directory]
recipe = slapos.cookbook:mkdirectory
46 47 48
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
cronstamps = $${rootdirectory:etc}/cronstamps
49 50 51 52 53 54
ca-dir = $${rootdirectory:srv}/ssl
httpd-log = $${basedirectory:log}/apache
php-ini-dir = $${rootdirectory:etc}/php
tmp-php = $${rootdirectory:tmp}/php
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
55
report = $${rootdirectory:etc}/report
56
stunnel-conf = $${rootdirectory:etc}/stunnel
57
xml-report = $${rootdirectory:var}/xml_report
58 59 60

[cadirectory]
recipe = slapos.cookbook:mkdirectory
61 62 63 64 65 66
requests = $${directory:ca-dir}/requests
private = $${directory:ca-dir}/private
certs = $${directory:ca-dir}/certs
newcerts = $${directory:ca-dir}/newcerts
crl = $${directory:ca-dir}/crl

67

68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
#----------------
#--
#-- Deploy cron.

[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${basedirectory:services}/crond

[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log


#----------------
#--
#-- Deploy logrotate.

[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}

[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip
# Directories
wrapper = $${rootdirectory:bin}/logrotate
conf = $${rootdirectory:etc}/logrotate.conf
logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup}
state-file = $${rootdirectory:srv}/logrotate.status


#----------------
#--
#-- Deploy stunnel.
115 116 117 118 119 120 121 122

[stunnel]
recipe = slapos.cookbook:stunnel
client = true
stunnel-binary = ${stunnel:location}/bin/stunnel
remote-host = $${mariadb-urlparse:host}
remote-port = $${mariadb-urlparse:port}
local-host = $${slap-network-information:local-ipv4}
123
local-port = 33060
124 125 126 127 128 129
log-file = $${basedirectory:log}/stunnel.log
config-file = $${directory:stunnel-conf}/stunnel.conf
key-file = $${directory:stunnel-conf}/stunnel.key
cert-file = $${directory:stunnel-conf}/stunnel.crt
pid-file = $${basedirectory:run}/stunnel.pid
wrapper = $${rootdirectory:bin}/raw_stunnel
130
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
131

132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
[logrotate-entry-stunnel]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = stunnel
log = $${stunnel:log-file}
frequency = daily
rotate-num = 30
notifempty = true
create = true
post = $${stunnel:post-rotate-script}


#----------------
#--
#-- Certificate stuff.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167

[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${directory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory:services}/ca
ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}

[ca-stunnel]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
executable = $${stunnel:wrapper}
wrapper = $${basedirectory:services}/stunnel
key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file}


168 169 170 171
#----------------
#--
#-- Request MariaDB instance and parse its URL.

172 173 174 175 176 177 178
[request-mariadb]
<= slap-connection
recipe = slapos.cookbook:request
name = MariaDB
software-url = $${slap-connection:software-release-url}
software-type = mariadb
return = url
179
sla = computer_guid
180
sla-computer_guid = $${slap-connection:computer-id}
181

182 183 184 185 186
[mariadb-urlparse]
recipe = slapos.cookbook:urlparse
url = $${request-mariadb:connection-url}


187 188 189 190
#----------------
#--
#-- Deploy Apache + PHP application.

191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
[apache-php]
recipe = slapos.cookbook:apachephp
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}

htdocs = $${rootdirectory:srv}/www/
pid-file = $${basedirectory:run}/apache.pid
lock-file = $${basedirectory:run}/apache.lock
ip = $${slap-network-information:global-ipv6}
port = 8080
url = http://[$${:ip}]:$${:port}/
error-log = $${directory:httpd-log}/error.log
access-log = $${directory:httpd-log}/access.log
php-ini-dir = $${directory:php-ini-dir}
tmp-dir = $${directory:tmp-php}
httpd-conf = $${rootdirectory:etc}/apache.conf
wrapper = $${basedirectory:services}/apache
209

210 211 212 213 214 215 216 217
httpd-binary = ${apache:location}/bin/httpd

mysql-username = $${mariadb-urlparse:username}
mysql-password = $${mariadb-urlparse:password}
mysql-database = $${mariadb-urlparse:path}
mysql-host = $${stunnel:local-host}
mysql-port = $${stunnel:local-port}

218 219 220 221 222 223 224 225 226 227 228 229
[logrotate-entry-apache]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = apache
log = $${apache-php:error-log} $${apache-php:access-log}
frequency = daily
rotate-num = 30
sharedscripts = true
notifempty = true
create = true


230 231 232
#----------------
#--
#-- Request frontend.
233

234 235
[request-frontend]
<= slap-connection
236
recipe = slapos.cookbook:requestoptional
237 238 239 240
name = Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
241
config = url custom_domain
242 243
config-url = http://[$${apache-php:ip}]:$${apache-php:port}/
return = site_url
244
config-custom_domain = $${slap-parameter:domain}
245

246

247 248 249 250
#----------------
#--
#-- Deploy slapmonitor.

251 252 253 254 255 256 257
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/apache.pid
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor

258 259
[slapmonitor-xml]
recipe = slapos.cookbook:slapmonitor-xml
260
database-path = $${basedirectory:log}/slapmonitor.db
261 262
slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
path = $${directory:report}/slapmonitor-xml
263 264


265 266
#----------------
#--
267
#-- Publish instance parameters.
268

269 270 271
[publish-connection-informations]
recipe = slapos.cookbook:publish
backend_url = $${apache-php:url}
272
url = $${request-frontend:connection-site_url}
273 274


275 276 277 278
#----------------
#--
#-- Deploy promises scripts.

279 280 281 282 283 284 285 286 287 288 289
[promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/apache
hostname = $${apache-php:ip}
port = $${apache-php:port}

[frontend-promise]
recipe = slapos.cookbook:check_url_available
path = $${basedirectory:promises}/frontend
url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
Romain Courteaud's avatar
Romain Courteaud committed
290
curl_path = ${curl:location}/bin/curl
291

292 293 294 295 296 297
[content-promise]
recipe = slapos.cookbook:check_page_content
path = $${basedirectory:promises}/content
url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
298

299 300 301



302
[slap-parameter]
303
# Default value if no domain is specified
Cédric de Saint Martin's avatar
Cédric de Saint Martin committed
304
domain =
305
# Default value if no ssh parameter is specified
306 307 308 309
logbox-ip =
logbox-port =
logbox-user =
logbox-passwd =
310