instance-apache-frontend.cfg 27.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
[buildout]
parts =
  directory
  configtest
  logrotate
  cron
  cron-entry-logrotate
  ca-frontend
  certificate-authority
  logrotate-entry-apache
11
  logrotate-entry-nginx
12 13 14
  apache-frontend
  switch-apache-softwaretype
  frontend-apache-graceful
15
  frontend-nginx-graceful
16 17
  dynamic-template-default-vh
  not-found-html
18
  promise-frontend-apache-configuration
19 20 21 22
  promise-apache-frontend-v4-https
  promise-apache-frontend-v4-http
  promise-apache-frontend-v6-https
  promise-apache-frontend-v6-http
23
  promise-apache-frontend-cached
24
  promise-apache-frontend-ssl-cached
25
  promise-apache-is-process-older-than-dependency-set
26
  promise-apache-mpm-watchdog
27 28 29 30 31 32

  promise-nginx-frontend-v4-https
  promise-nginx-frontend-v4-http
  promise-nginx-frontend-v6-https
  promise-nginx-frontend-v6-http
  promise-nginx-configuration
33
  promise-nginx-is-process-older-than-dependency-set
34 35 36 37 38 39

  trafficserver-launcher
  trafficserver-reload
  trafficserver-configuration-directory
  trafficserver-records-config
  trafficserver-remap-config
40
  trafficserver-plugin-config
41
  trafficserver-storage-config
42
  trafficserver-promise-listen-port
43
  trafficserver-promise-cache-availability
44

45 46 47
## Nginx
  nginx-frontend

48
## Monitor for apache
49
  monitor-base
50
  monitor-ats-cache-stats-wrapper
51 52
  monitor-traffic-summary-last-stats-wrapper
  monitor-apache-server-status-wrapper
53
  monitor-verify-re6st-connectivity
54

55
extends = ${monitor-template:output}
56

57

58 59 60 61 62 63 64 65 66 67 68 69 70 71
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true

# Create all needed directories
[directory]
recipe = slapos.cookbook:mkdirectory

bin = $${buildout:directory}/bin/
etc = $${buildout:directory}/etc/
srv = $${buildout:directory}/srv/
var = $${buildout:directory}/var/
template = $${buildout:directory}/template/

72 73 74
backup = $${:srv}/backup
log = $${:var}/log
run = $${:var}/run
75 76 77 78 79 80 81 82 83 84 85 86
service = $${:etc}/service
etc-run = $${:etc}/run
promise = $${:etc}/promise

logrotate-backup = $${:backup}/logrotate
logrotate-entries = $${:etc}/logrotate.d

cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
ca-dir = $${:srv}/ssl

87
varnginx = $${:var}/nginx
88

89 90
[switch-apache-softwaretype]
recipe = slapos.cookbook:softwaretype
91
single-default = $${dynamic-custom-personal-template-slave-list:rendered}
92
single-custom-personal = $${dynamic-custom-personal-template-slave-list:rendered}
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110

[instance-parameter]
# Fetches parameters defined in SlapOS Master for this instance.
# Always the same.
recipe = slapos.cookbook:slapconfiguration.serialised
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
# Define default parameter(s) that will be used later, in case user didn't
# specify it
# All parameters are available through the configuration.XX syntax.
# All possible parameters should have a default.
configuration.domain = example.org
configuration.public-ipv4 =
configuration.port = 4443
configuration.plain_http_port = 8080
111 112
configuration.plain_nginx_port = 8081
configuration.nginx_port = 9443
113 114 115 116 117
configuration.server-admin = admin@example.com
configuration.apache_custom_https = ""
configuration.apache_custom_http = ""
configuration.apache-key =
configuration.apache-certificate =
118
configuration.apache-ca-certificate =
119 120
configuration.open-port = 80 443
configuration.extra_slave_instance_list =
121
configuration.disk-cache-size = 8G
122
configuration.ram-cache-size = 1G
123 124
configuration.trafficserver-autoconf-port = 8083
configuration.trafficserver-mgmt-port = 8084
125
configuration.re6st-verification-url = http://[2001:67c:1254:4::1]/index.html
126

127 128 129
[frontend-configuration]
template-log-access = ${template-log-access:target}
log-access-configuration = $${directory:etc}/apache-log-access.conf
130
apache-directory = ${apache:location}
131 132 133
apache-ipv6 = $${instance-parameter:ipv6-random}
apache-https-port = $${instance-parameter:configuration.port}

134 135 136 137 138 139 140 141 142 143
[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
rendered = $${buildout:directory}/$${:filename}
extra-context =
context =
    import json_module json
    key eggs_directory buildout:eggs-directory
    key develop_eggs_directory buildout:develop-eggs-directory
    key slap_software_type instance-parameter:slap-software-type
    key slapparameter_dict instance-parameter:configuration
144
    section directory directory
145 146 147 148 149 150 151 152 153 154 155
    $${:extra-context}

[dynamic-template-default-vh]
< = jinja2-template-base
template = ${template-default-virtualhost:target}
rendered = $${apache-directory:slave-configuration}/000.conf
extensions = jinja2.ext.do
extra-context =
    key http_port instance-parameter:configuration.plain_http_port
    key https_port instance-parameter:configuration.port

156 157 158 159 160 161 162
[software-release-path]
template-empty = ${template-empty:target}
template-slave-configuration = ${template-slave-configuration:target}
template-default-slave-virtualhost = ${template-default-slave-virtualhost:target}
template-cached-slave-virtualhost = ${template-cached-slave-virtualhost:target}
template-nginx-eventsource-slave-virtualhost = ${template-nginx-eventsource-slave-virtualhost:target}
template-nginx-notebook-slave-virtualhost = ${template-nginx-notebook-slave-virtualhost:target}
163
apache-location = ${apache:location}
164

165 166 167 168 169 170 171
[dynamic-custom-personal-template-slave-list]
< = jinja2-template-base
template = ${template-slave-list:target}
filename = custom-personal-instance-slave-list.cfg
extensions = jinja2.ext.do
extra-context =
    key apache_configuration_directory apache-directory:slave-configuration
172
    key nginx_configuration_directory apache-directory:nginx-slave-configuration
173
    key apache_cached_configuration_directory apache-directory:slave-with-cache-configuration
174
    key slave_with_cache_configuration_directory apache-directory:slave-with-cache-configuration
175 176
    key http_port instance-parameter:configuration.plain_http_port
    key https_port instance-parameter:configuration.port
177 178
    key nginx_http_port instance-parameter:configuration.plain_nginx_port
    key nginx_https_port instance-parameter:configuration.nginx_port
179 180 181 182 183 184
    key public_ipv4 instance-parameter:configuration.public-ipv4
    key slave_instance_list instance-parameter:slave-instance-list
    key extra_slave_instance_list instance-parameter:configuration.extra_slave_instance_list
    key custom_ssl_directory apache-directory:vh-ssl
    key apache_log_directory apache-directory:slave-log
    key local_ipv4 instance-parameter:ipv4-random
185 186
    key global_ipv6 slap-network-information:global-ipv6
    key varnginx directory:varnginx
187 188 189 190 191 192
    key empty_template software-release-path:template-empty
    key template_custom_slave_configuration software-release-path:template-slave-configuration
    key template_default_slave_configuration software-release-path:template-default-slave-virtualhost
    key template_cached_slave_configuration software-release-path:template-cached-slave-virtualhost
    key template_eventsource_slave_configuration software-release-path:template-nginx-eventsource-slave-virtualhost
    key template_notebook_slave_configuration software-release-path:template-nginx-notebook-slave-virtualhost
193
    raw software_type single-custom-personal
194
    key frontend_lazy_graceful_reload frontend-apache-lazy-graceful:rendered
195 196 197
    section logrotate_dict logrotate
    section frontend_configuration frontend-configuration
    section apache_configuration apache-configuration
198
    section nginx_configuration nginx-configuration
199
    key monitor_base_url monitor-instance-parameter:monitor-base-url 
200 201 202
    key promise_directory monitor-directory:promises
    key report_directory monitor-directory:reports
    raw bin_directory ${buildout:bin-directory}
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220

[dynamic-virtualhost-template-slave]
<= jinja2-template-base
template = ${template-slave-configuration:target}
rendered = $${directory:template}/slave-virtualhost.conf.in
extensions = jinja2.ext.do
extra-context =
    key https_port instance-parameter:configuration.port
    key http_port instance-parameter:configuration.plain_http_port
    key apache_custom_https instance-parameter:configuration.apache_custom_https
    key apache_custom_http instance-parameter:configuration.apache_custom_http

# Deploy Apache Frontend (new way, no recipe, jinja power)
[dynamic-apache-frontend-template]
< = jinja2-template-base
template = ${template-apache-frontend-configuration:target}
rendered = $${apache-configuration:frontend-configuration}
extra-context =
221
    key httpd_home software-release-path:apache-location
222 223 224 225 226 227 228 229 230 231 232 233 234
    key httpd_mod_ssl_cache_directory apache-directory:mod-ssl
    key domain instance-parameter:configuration.domain
    key document_root apache-directory:document-root
    key instance_home buildout:directory
    key ipv4_addr instance-parameter:ipv4-random
    key ipv6_addr instance-parameter:ipv6-random
    key http_port instance-parameter:configuration.plain_http_port
    key https_port instance-parameter:configuration.port
    key server_admin instance-parameter:configuration.server-admin
    key protected_path apache-configuration:protected-path
    key access_control_string apache-configuration:access-control-string
    key login_certificate ca-frontend:cert-file
    key login_key ca-frontend:key-file
235
    key login_ca_crt ca-custom-frontend:rendered
236 237 238 239 240 241
    key ca_dir  certificate-authority:ca-dir
    key ca_crl certificate-authority:ca-crl
    key access_log apache-configuration:access-log
    key error_log apache-configuration:error-log
    key pid_file apache-configuration:pid-file
    key slave_configuration_directory apache-directory:slave-configuration
242 243 244
    key cached_port apache-configuration:cache-through-port
    key ssl_cached_port apache-configuration:ssl-cache-through-port
    key slave_with_cache_configuration_directory apache-directory:slave-with-cache-configuration
245
    section frontend_configuration frontend-configuration
246 247 248

[apache-frontend]
recipe = slapos.cookbook:wrapper
249
command-line = ${apache:location}/bin/httpd -f $${dynamic-apache-frontend-template:rendered} -DFOREGROUND
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
wrapper-path = $${directory:service}/frontend_apache
wait-for-files =
	       $${ca-frontend:cert-file}
	       $${ca-frontend:key-file}

[not-found-html]
recipe = slapos.cookbook:symbolic.link
target-directory = $${apache-directory:document-root}
link-binary =
	    ${template-not-found-html:target}

[apache-directory]
recipe = slapos.cookbook:mkdirectory
document-root = $${directory:srv}/htdocs
slave-configuration = $${directory:etc}/apache-slave-conf.d/
265
slave-with-cache-configuration = $${directory:etc}/apache-slave-with-cache-conf.d/
266 267 268 269
cache = $${directory:var}/cache
mod-ssl = $${:cache}/httpd_mod_ssl
vh-ssl = $${:slave-configuration}/ssl
slave-log = $${directory:log}/httpd
270
nginx-slave-configuration = $${directory:etc}/nginx-slave-conf.d/
271 272 273 274 275 276 277 278

[apache-configuration]
frontend-configuration = $${directory:etc}/apache_frontend.conf
access-log = $${directory:log}/frontend-apache-access.log
error-log = $${directory:log}/frontend-apache-error.log
pid-file = $${directory:run}/httpd.pid
protected-path = /
access-control-string = none
279
frontend-configuration-verification = ${apache:location}/bin/httpd -Sf $${:frontend-configuration} > /dev/null
280
frontend-graceful-command = $${:frontend-configuration-verification}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${:pid-file}); fi
281

282 283
# Comunication with ats
cache-port = $${trafficserver-variable:input-port}
284
cache-through-port = 26011
285
ssl-cache-through-port = 26012
286 287 288 289

# Create wrapper for "apachectl conftest" in bin
[configtest]
recipe = slapos.cookbook:wrapper
290
command-line = ${apache:location}/bin/httpd -f $${directory:etc}/apache_frontend.conf -t
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
wrapper-path = $${directory:bin}/apache-configtest

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

[cadirectory]
recipe = slapos.cookbook:mkdirectory
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/

[ca-frontend]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${cadirectory:certs}/apache_frontend.key
cert-file = $${cadirectory:certs}/apache_frontend.crt
executable = $${directory:service}/frontend_apache
wrapper = $${directory:service}/frontend_apache
key-content = $${instance-parameter:configuration.apache-key}
cert-content = $${instance-parameter:configuration.apache-certificate}
# Put domain name
name = $${instance-parameter:configuration.domain}

324 325 326 327 328 329 330
[ca-custom-frontend]
< = jinja2-template-base
template = ${template-empty:target}
rendered = $${cadirectory:certs}/apache_frontend.ca.crt
extra-context =
    key content instance-parameter:configuration.apache-ca-certificate

331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
[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 = $${directory:service}/crond

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

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

# Deploy Logrotate
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
356
logrotate-binary = ${logrotate:location}/sbin/logrotate
357 358 359 360 361 362 363 364 365 366 367 368 369
gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip
# Directories
wrapper = $${directory:bin}/logrotate
conf = $${directory:etc}/logrotate.conf
logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup}
state-file = $${directory:srv}/logrotate.status

[logrotate-entry-apache]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = apache
370
log = $${apache-configuration:error-log} $${apache-configuration:access-log}
371 372
frequency = daily
rotatep-num = 30
373
post = $${frontend-apache-lazy-graceful:rendered} &
374 375 376 377
sharedscripts = true
notifempty = true
create = true

378
[logrotate-entry-nginx]
379 380
<= logrotate
recipe = slapos.cookbook:logrotate.d
381 382
name = apache-nginx
log = $${nginx-configuration:error_log} $${nginx-configuration:access_log}
383 384
frequency = daily
rotatep-num = 30
385
post = $${nginx-configuration:nginx-graceful-command}
386 387 388 389
sharedscripts = true
notifempty = true
create = true

390 391 392 393
#################
# Trafficserver
#################
[trafficserver-directory]
394
recipe = slapos.cookbook:mkdirectory
395 396 397 398 399 400 401 402 403 404 405
configuration = $${directory:etc}/trafficserver
local-state = $${directory:var}/trafficserver
bin_path = ${trafficserver:location}/bin
log = $${directory:log}/trafficserver
cache-path = $${directory:srv}/ats_cache

[trafficserver-variable]
wrapper-path = $${directory:service}/trafficserver
reload-path = $${directory:etc-run}/trafficserver-reload
local-ip = $${instance-parameter:ipv4-random}
input-port = 23432
406
hostname = $${instance-parameter:configuration.frontend-name}
407 408 409
remap = map /HTTPS/ http://$${instance-parameter:ipv4-random}:$${apache-configuration:ssl-cache-through-port}
  map / http://$${instance-parameter:ipv4-random}:$${apache-configuration:cache-through-port}

410
plugin-config = ${trafficserver:location}/libexec/trafficserver/rfc5861.so
411 412
cache-path = $${trafficserver-directory:cache-path}
disk-cache-size = $${instance-parameter:configuration.disk-cache-size}
413 414
autoconf-port = $${instance-parameter:configuration.trafficserver-autoconf-port}
mgmt-port = $${instance-parameter:configuration.trafficserver-mgmt-port}
415
ram-cache-size = $${instance-parameter:configuration.ram-cache-size}
416 417 418 419 420 421 422

[trafficserver-configuration-directory]
recipe = plone.recipe.command
command = cp -rn ${trafficserver:location}/etc/trafficserver/* $${:target}
target = $${trafficserver-directory:configuration}

[trafficserver-launcher]
423
recipe = slapos.cookbook:wrapper
424 425 426
command-line = ${trafficserver:location}/bin/traffic_cop
wrapper-path = $${trafficserver-variable:wrapper-path}
environment = TS_ROOT=$${buildout:directory}
427

428
[trafficserver-reload]
429
recipe = slapos.cookbook:wrapper
430 431 432
command-line = ${trafficserver:location}/bin/traffic_line -x
wrapper-path = $${trafficserver-variable:reload-path}
environment = TS_ROOT=$${buildout:directory}
433

434 435 436 437 438 439 440 441 442 443 444
# XXX Dedicated Jinja Section without slapparameter
[trafficserver-jinja2-template-base]
recipe = slapos.recipe.template:jinja2
rendered = $${trafficserver-directory:configuration}/$${:filename}
extra-context =
mode = 600
context =
    section ats_directory trafficserver-directory
    section ats_configuration trafficserver-variable
    $${:extra-context}

445
[trafficserver-records-config]
446
< = trafficserver-jinja2-template-base
447
template = ${template-trafficserver-records-config:location}/${template-trafficserver-records-config:filename}
448
filename = records.config
449
extra-context =
450
    import os_module os
451

452
[trafficserver-storage-config]
453
< = trafficserver-jinja2-template-base
454
template = ${template-trafficserver-storage-config:location}/${template-trafficserver-storage-config:filename}
455
filename = storage.config
456

457
[trafficserver-remap-config]
458
< = trafficserver-jinja2-template-base
459
template = ${template-empty:target}
460
filename = remap.config
461 462
context =
    key content trafficserver-variable:remap
463

464
[trafficserver-plugin-config]
465
< = trafficserver-jinja2-template-base
466
template = ${template-empty:target}
467
filename = plugin.config
468 469 470
context =
    key content trafficserver-variable:plugin-config

471 472 473 474 475 476
[trafficserver-promise-listen-port]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/trafficserver-port-listening
hostname = $${trafficserver-variable:local-ip}
port = $${trafficserver-variable:input-port}

477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
[trafficserver-line]
recipe = slapos.cookbook:wrapper
command-line = ${trafficserver:location}/bin/traffic_line
wrapper-path = $${directory:bin}/traffic_line
environment = TS_ROOT=$${buildout:directory}
parameters-extra = true

[trafficserver-promise-cache-availability]
recipe = collective.recipe.template
input =
  inline:#!${buildout:executable}
  import subprocess
  import sys
  traffic_line = "$${trafficserver-line:wrapper-path}"
  result = float(subprocess.check_output([traffic_line, '-r',  'proxy.node.cache.percent_free' ]))
  if result != 0: sys.exit(0)
  sys.stderr.write("Cache not available, availability: %s" % result)
  sys.exit(127)
output = $${directory:promise}/trafficserver-cache-availability
mode = 700

498 499
### End of ATS sections

500
### Apaches Graceful and promises
501
[frontend-apache-graceful-bin]
502
< = jinja2-template-base
503
template = ${template-wrapper:output}
504
rendered = $${directory:bin}/frontend-apache-safe-graceful
505 506 507
mode = 0700
extra-context =
    key content apache-configuration:frontend-graceful-command
508

509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
[frontend-apache-graceful]
< = jinja2-template-base
template = ${template-apache-graceful-script:target}
rendered = $${directory:etc-run}/frontend-apache-safe-graceful
mode = 0700
extra-context =
    key directory_run directory:run
    key directory_etc directory:etc
    key apache_graceful_reload_command apache-configuration:frontend-graceful-command

[frontend-apache-lazy-graceful]
< = jinja2-template-base
template = ${template-apache-lazy-script-call:target}
rendered = $${directory:bin}/frontend-apache-lazy-graceful
mode = 0700
pid-file = $${directory:run}/lazy-graceful.pid
extra-context =
    key pid_file :pid-file
    raw wait_time 60
    key lazy_command apache-configuration:frontend-graceful-command

530 531 532 533 534 535 536 537 538
# Promises checking configuration:
[promise-frontend-apache-configuration]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:promise}/frontend-apache-configuration-promise
mode = 0700
extra-context =
    key content apache-configuration:frontend-configuration-verification

539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
[promise-apache-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/apache_frontend_ipv4_https
hostname = $${instance-parameter:ipv4-random}
port = $${instance-parameter:configuration.port}

[promise-apache-frontend-v4-http]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/apache_frontend_ipv4_http
hostname = $${instance-parameter:ipv4-random}
port = $${instance-parameter:configuration.plain_http_port}

[promise-apache-frontend-v6-https]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/apache_frontend_ipv6_https
hostname = $${instance-parameter:ipv6-random}
port = $${instance-parameter:configuration.port}

[promise-apache-frontend-v6-http]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/apache_frontend_ipv6_http
hostname = $${instance-parameter:ipv6-random}
port = $${instance-parameter:configuration.plain_http_port}

563
[promise-apache-frontend-cached]
564 565 566 567 568
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/apache_cached
hostname = $${instance-parameter:ipv4-random}
port = $${apache-configuration:cache-through-port}

569
[promise-apache-frontend-ssl-cached]
570 571 572 573 574
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/apache_ssl_cached
hostname = $${instance-parameter:ipv4-random}
port = $${apache-configuration:ssl-cache-through-port}

575 576 577 578 579 580
[promise-apache-is-process-older-than-dependency-set]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/is-process-older-than-dependency-set $${apache-configuration:pid-file} 
wrapper-path = $${directory:promise}/apache-frontend-is-running-actual-software-release
parameters-extra = true

581 582 583 584 585 586
[promise-apache-mpm-watchdog]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/apache-mpm-watchdog --url http://$${instance-parameter:ipv4-random}:$${instance-parameter:configuration.plain_http_port}/server-status -u admin -p $${monitor-htpasswd:passwd} -d $${directory:run}/apache-mpm-watchdog.json 
wrapper-path = $${directory:promise}/apache-mpm-watchdog
parameters-extra = true

587

588 589 590 591 592 593 594 595
[slap_connection]
# Kept for backward compatiblity
computer_id = $${slap-connection:computer-id}
partition_id = $${slap-connection:partition-id}
server_url = $${slap-connection:server-url}
software_release_url = $${slap-connection:software-release-url}
key_file = $${slap-connection:key-file}
cert_file = $${slap-connection:cert-file}
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612

[slap-parameter]
# Define default parameter(s) that will be used later, in case user didn't
# specify it
# All parameters are available through the configuration.XX syntax.
# All possible parameters should have a default.
domain = example.org
public-ipv4 =
port = 4443
plain_http_port = 8080
server-admin = admin@example.com
apache_custom_https = ""
apache_custom_http = ""
apache-key =
apache-certificate =
open-port = 80 443
extra_slave_instance_list =
613
frontend-name =
614 615
monitor-cors-domains =
monitor-httpd-port = 8072
616
monitor-username = $${monitor-instance-parameter:username}
617
monitor-password = $${monitor-htpasswd:passwd}
618 619 620 621 622

#######
# Monitoring sections
#

623 624 625 626 627 628
[monitor-instance-parameter]
monitor-httpd-port = $${slap-parameter:monitor-httpd-port}
cors-domains = $${slap-parameter:monitor-cors-domains}
username = $${slap-parameter:monitor-username}
password = $${slap-parameter:monitor-password}

629 630 631
[monitor-conf-parameters]
private-path-list += 
  $${directory:logrotate-backup}
632

633 634 635 636 637 638 639 640 641 642

[monitor-traffic-summary-last-stats-wrapper]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${monitor-directory:reports}/traffic-summary-last-stats_every_1_hour
mode = 0700
command = export TS_ROOT=$${buildout:directory} && echo "<pre>$(${trafficserver:location}/bin/traffic_logstats -f $${trafficserver-directory:log}/squid.blog)</pre>"
extra-context =
  key content monitor-traffic-summary-last-stats-wrapper:command

643 644 645 646
# Produce ATS Cache stats
[monitor-ats-cache-stats-wrapper]
< = jinja2-template-base
template = ${template-wrapper:output}
647
rendered = $${monitor-directory:reports}/ats-cache-stats_every_1_hour
648 649 650 651 652
mode = 0700
command = export TS_ROOT=$${buildout:directory} && echo "<pre>$(${trafficserver:location}/bin/traffic_shell $${monitor-ats-cache-stats-config:rendered})</pre>"
extra-context =
  key content monitor-ats-cache-stats-wrapper:command

653 654 655 656 657
[monitor-apache-server-status-wrapper]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${monitor-directory:reports}/monitor-apache-server-status-wrapper
mode = 0700
658
command = ${curl:location}/bin/curl -s http://$${instance-parameter:ipv4-random}:$${instance-parameter:configuration.plain_http_port}/server-status -u $${monitor-instance-parameter:username}:$${monitor-htpasswd:passwd} 2>&1
659 660 661
extra-context =
  key content monitor-apache-server-status-wrapper:command

662 663 664 665 666 667 668
[monitor-ats-cache-stats-config]
< = jinja2-template-base
template = ${template-empty:target}
rendered = $${trafficserver-configuration-directory:target}/cache-config.stats
mode = 644
context =
    raw content show:cache-stats
669

670 671
[monitor-verify-re6st-connectivity]
recipe = slapos.cookbook:check_url_available
672
path = $${directory:promise}/re6st-connectivity
673
url = $${instance-parameter:configuration.re6st-verification-url}
674 675
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742

#######################
# Nginx
#
[nginx-frontend]
recipe = slapos.cookbook:wrapper
command-line = ${nginx-push-stream:location}/sbin/nginx -c $${nginx-configuration:output}
wrapper-path = $${directory:service}/frontend_nginx

[nginx-configuration]
recipe = slapos.recipe.template
url = ${template-nginx-configuration:output}
output = $${directory:etc}/nginx.cfg
mode = 0600
access_log = $${directory:log}/nginx-access.log
error_log = $${directory:log}/nginx-error.log
ip = $${slap-network-information:global-ipv6}
local_ip = $${slap-network-information:local-ipv4}
port = $${instance-parameter:configuration.nginx_port}
plain_port = $${instance-parameter:configuration.plain_nginx_port}
worker_processes = 4
worker_connections = 1024
slave-configuration-directory = $${apache-directory:nginx-slave-configuration}
pid-file = $${directory:run}/nginx.pid 
nginx-graceful-command = $${:nginx-configuration-verification}; if [ $? -eq 0 ]; then kill -HUP $(cat $${:pid-file}); fi
nginx-configuration-verification = ${nginx-push-stream:location}/sbin/nginx -t -c $${nginx-configuration:output}

[frontend-nginx-graceful]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:etc-run}/frontend-nginx-safe-graceful
mode = 0700
extra-context =
    key content nginx-configuration:nginx-graceful-command

[promise-nginx-configuration]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:promise}/nginx-configuration-promise
mode = 0700
extra-context =
    key content nginx-configuration:nginx-configuration-verification

[promise-nginx-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/nginx_frontend_ipv4_https
hostname = $${instance-parameter:ipv4-random}
port = $${instance-parameter:configuration.nginx_port}

[promise-nginx-frontend-v4-http]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/nginx_frontend_ipv4_http
hostname = $${instance-parameter:ipv4-random}
port = $${instance-parameter:configuration.plain_nginx_port}

[promise-nginx-frontend-v6-https]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/nginx_frontend_ipv6_https
hostname = $${instance-parameter:ipv6-random}
port = $${instance-parameter:configuration.nginx_port}

[promise-nginx-frontend-v6-http]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/nginx_frontend_ipv6_http
hostname = $${instance-parameter:ipv6-random}
port = $${instance-parameter:configuration.plain_nginx_port}

743 744 745 746 747
[promise-nginx-is-process-older-than-dependency-set]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/is-process-older-than-dependency-set $${nginx-configuration:pid-file} 
wrapper-path = $${directory:promise}/promise-nginx-is-process-older-than-dependency-set
parameters-extra = true