instance-apache-php.cfg.in 7.67 KB
Newer Older
1
[buildout]
2
extends = ${custom-application-deployment:path}
3 4 5 6 7 8 9 10 11

parts =
  certificate-authority
  ca-stunnel
  logrotate
  logrotate-entry-apache
  logrotate-entry-stunnel
  cron
  cron-entry-logrotate
12
  promise
13

14
  frontend-promise
15
  content-promise
16
  publish-connection-information
17
  ${custom-application-deployment:part-list}
18

19

20 21 22 23 24
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true


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

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

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

46 47
[directory]
recipe = slapos.cookbook:mkdirectory
48 49 50
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
cronstamps = $${rootdirectory:etc}/cronstamps
51 52 53 54 55 56
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
57
report = $${rootdirectory:etc}/report
58
stunnel-conf = $${rootdirectory:etc}/stunnel
59
xml-report = $${rootdirectory:var}/xml_report
60
www = $${rootdirectory:srv}/www/
61 62 63

[cadirectory]
recipe = slapos.cookbook:mkdirectory
64 65 66 67 68 69
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

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 115 116 117
#----------------
#--
#-- 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.
118 119 120 121 122 123 124 125

[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}
126
local-port = 3306
127 128 129 130 131 132
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
133
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
134

135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
[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.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170

[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}


171 172 173 174
#----------------
#--
#-- Request MariaDB instance and parse its URL.

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

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


189 190 191 192 193 194 195 196 197

#----------------
#--
#-- Common network parameters
[apache-network-configuration]
listening-ip = $${slap-network-information:global-ipv6}
listening-port = 8080


198 199 200 201
#----------------
#--
#-- Deploy Apache + PHP application.

202 203 204 205 206 207
[apache-php]
recipe = slapos.cookbook:apachephp
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}

208
htdocs = $${directory:www}
209 210
pid-file = $${basedirectory:run}/apache.pid
lock-file = $${basedirectory:run}/apache.lock
211 212
ip = $${apache-network-configuration:listening-ip}
port = $${apache-network-configuration:listening-port}
213 214 215 216 217 218 219
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
220

221 222 223 224 225 226 227 228
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}

229 230 231 232 233 234 235 236 237 238 239 240
[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


241 242 243
#----------------
#--
#-- Request frontend.
244

245 246
[request-frontend]
<= slap-connection
247
recipe = slapos.cookbook:requestoptional
248 249
name = Frontend
# XXX We have hardcoded SR URL here.
250
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
251
slave = true
252
config-url = http://[$${apache-network-configuration:listening-ip}]:$${apache-network-configuration:listening-port}/
253
return = site_url
254
config-custom_domain = $${slap-parameter:domain}
255

256

257 258
#----------------
#--
259
#-- Publish instance parameters.
260

261
[publish-connection-information]
262 263
recipe = slapos.cookbook:publish
backend_url = $${apache-php:url}
264
url = $${request-frontend:connection-site_url}
265 266


267 268 269 270
#----------------
#--
#-- Deploy promises scripts.

271 272 273 274 275 276 277 278 279 280 281
[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
282
curl_path = ${curl:location}/bin/curl
283

284 285 286 287 288 289
[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
290

291 292 293



294
[slap-parameter]
295
# Default value if no domain is specified
Cédric de Saint Martin's avatar
Cédric de Saint Martin committed
296
domain =
297
# Default value if no ssh parameter is specified
298 299 300 301
logbox-ip =
logbox-port =
logbox-user =
logbox-passwd =
302