instance-zope.cfg.in 21.4 KB
Newer Older
1 2
{% set wsgi = slapparameter_dict['wsgi'] -%}
{% set webdav = slapparameter_dict['webdav'] -%}
3
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
4
{% set next_port = itertools.count(slapparameter_dict['port-base']).next -%}
5
{% set site_id = slapparameter_dict['site-id'] -%}
6
{% set zodb_dict = slapparameter_dict['zodb-dict'] -%}
7
{% set instance_index_list = range(slapparameter_dict['instance-count']) -%}
8
{% set node_id_base = slapparameter_dict['name'] -%}
9
{% set selenium_server_configuration_dict = slapparameter_dict.get('selenium-server-configuration-dict', None) -%}
10
{% set node_id_index_format = '-%%0%ii' % (len(str(instance_index_list[-1])), ) -%}
11 12
{% set part_list = [] -%}
{% set publish_list = [] -%}
13
{% set test_runner_address_list = [] -%}
14
{% set test_runner_enabled = slapparameter_dict['test-runner-enabled'] -%}
15
{% set test_runner_node_count = slapparameter_dict['test-runner-node-count'] -%}
16 17 18 19 20 21 22 23 24
{% set longrequest_logger_base_path = buildout_directory ~ '/var/log/longrequest_logger_' -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{#
XXX: This template only supports exactly one IPv4 and one IPv6 per
partition. No more (undefined result), no less (IndexError).
-#}
{% set ipv4 = (ipv4_set | list)[0] -%}

25
{% set publishable_hosts_dict = {} -%}
26 27 28 29 30 31 32 33 34
{% set port_dict = {} -%}
{% for alias, url in (
    ('erp5-memcached-volatile', slapparameter_dict['memcached-url']),
    ('erp5-memcached-persistent', slapparameter_dict['kumofs-url']),
    ('erp5-cloudooo', slapparameter_dict['cloudooo-url']),
    ('erp5-smtp', slapparameter_dict['smtp-url']),
  ) -%}
{%   set parsed_url = urlparse.urlparse(url) -%}
{%   do port_dict.__setitem__(alias, parsed_url.port)  -%}
35
{%   do publishable_hosts_dict.__setitem__(alias, parsed_url.hostname)  -%}
36 37
{%- endfor %}
{% for i, url in enumerate(slapparameter_dict['mysql-url-list']) -%}
38
{%   do publishable_hosts_dict.__setitem__(
39 40 41 42
       'erp5-catalog-' ~ i,
       urlparse.urlparse(url).hostname,
     ) -%}
{%- endfor %}
43 44 45
{% do publishable_hosts_dict.update(slapparameter_dict['hosts-dict']) -%}
{% set hosts_dict = publishable_hosts_dict.copy() -%}
{% do hosts_dict.update(slapparameter_dict['computer-hosts-dict'].get(computer, {})) -%}
46

47 48 49 50
[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
mode = 644

51
[run-common]
52
<= userhosts-wrapper-base
53 54 55 56 57
environment-extra =
environment +=
  TMP=${directory:tmp}
  TMPDIR=${directory:tmp}
  HOME=${buildout:directory}
58
  PATH=${binary-link:target-directory}:{{ parameter_dict['coreutils'] }}/bin:{{ parameter_dict['perl_dbd_mariadb_path'] }}
59 60 61
  TZ={{ slapparameter_dict['timezone'] }}
  MATPLOTLIBRC={{ parameter_dict['matplotlibrc'] }}
  INSTANCE_HOME=${:instance-home}
62
  CAUCASE={{ slapparameter_dict['caucase-url'] }}
63
  FONTCONFIG_FILE=${fontconfig-conf:rendered}
64 65 66 67
{% if slapparameter_dict.get('wendelin-core-zblk-fmt') %}
  WENDELIN_CORE_ZBLK_FMT={{ slapparameter_dict['wendelin-core-zblk-fmt'] }}
{% endif %}
  ${:environment-extra}
68

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
[directory]
recipe = slapos.cookbook:mkdirectory
bin = ${buildout:directory}/bin
etc = ${buildout:directory}/etc
instance = ${:srv}/erp5shared
instance-constraint = ${:instance}/Constraint
instance-document = ${:instance}/Document
instance-etc = ${:instance}/etc
instance-etc-package-include = ${:instance}/etc/package-include
instance-extensions = ${:instance}/Extensions
instance-import = ${:instance}/import
instance-lib = ${:instance}/lib
instance-products = ${:instance}/Products
instance-propertysheet = ${:instance}/PropertySheet
instance-tests = ${:instance}/tests
log = ${:var}/log
run = ${:var}/run
services = ${:etc}/run
87
service-on-watch = ${:etc}/service
88
srv = ${buildout:directory}/srv
89
ca-dir = ${:srv}/ssl
90 91
tmp = ${buildout:directory}/tmp
var = ${buildout:directory}/var
92
plugin = ${:etc}/plugin
93
unit-test-path = ${:srv}/test-instance/unit_test
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
fontconfig-cache = ${buildout:directory}/.fontconfig

[fontconfig-conf]
recipe = slapos.recipe.template:jinja2
template = {{ parameter_dict['template-fonts-conf'] }}
rendered = ${directory:etc}/fonts.conf
context =
    key cachedir directory:fontconfig-cache
    key fonts :fonts
    key includes :includes
fonts =
{% for font in parameter_dict['fonts'].splitlines() %}
   {{ font }}
{% endfor %}
includes =
{% for include in parameter_dict['fontconfig-includes'].splitlines() %}
   {{ include }}
{% endfor %}
112

113 114 115 116 117 118
# Used for ERP5 resiliency or (more probably)
# webrunner resiliency with erp5 inside.
[{{ section("resiliency-exclude-file") }}]
# Generate rdiff exclude file
recipe = slapos.recipe.template:jinja2
mode = 644
119
template = {{ 'inline:{{ "${directory:log}/**\\n${directory:tmp}/**\\n" }}' }}
120 121
rendered = ${directory:srv}/exporter.exclude

122 123 124
[{{ section("resiliency-identity-signature-script")}}]
# Generate identity script used by webrunner to check data integrity
recipe = slapos.cookbook:wrapper
125
command-line = {{ bin_directory }}/backup-identity-script-excluding-path --exclude-path "srv/backup/logrotate/**"
126 127 128
wrapper-path = ${directory:srv}/.backup_identity_script
mode = 770

129 130 131
[binary-link]
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:bin}
132
link-binary = {{ dumps(parameter_dict['link-binary']) }}
133 134 135 136 137 138 139 140 141 142 143 144 145

{% if use_ipv6 -%}
{%   set ipv6 = (ipv6_set | list)[0] -%}

[ipv6toipv4-base]
recipe = slapos.cookbook:ipv6toipv4
runner-path = ${directory:services}/${:base-name}
6tunnel-path = {{ parameter_dict['6tunnel'] }}/bin/6tunnel
shell-path = {{ parameter_dict['dash'] }}/bin/dash
ipv4 = {{ ipv4 }}
ipv6 = {{ ipv6 }}
{% endif -%}

146
[hosts-parameter]
147
# Used for both hosts and hostaliases sections.
148
host-dict = {{ dumps(hosts_dict) }}
149 150 151 152 153 154 155 156 157
hostalias-dict = {{ dumps(slapparameter_dict['hostalias-dict']) }}

# Note: there is a subtle difference between hosts and hostaliases files:
# - hosts files start with resolved, followed by alias(es) (only one alias per
#   line in this case)
# - hostaliases start with alias, followed by resolved
# ...so it's not possible to merge these templates (not a big deal anyway).

[hostaliases]
158
< = jinja2-template-base
159 160 161 162 163 164 165
template = inline: {{ '
  {% for alias, aliased in host_dict.items() -%}
  {{ alias }} {{ aliased }}
  {% endfor %}
' }}
rendered = ${directory:etc}/hostaliases
context = key host_dict hosts-parameter:hostalias-dict
166 167

[hosts]
168
< = jinja2-template-base
169 170 171 172 173 174 175 176
template = inline: {{ '
  {% for alias, aliased in host_dict.items() -%}
  {{ aliased }} {{ alias }}
  {% endfor %}
' }}
rendered = ${directory:etc}/hosts
context = key host_dict hosts-parameter:host-dict

177 178 179 180 181 182 183 184 185
[userhosts-bin]
recipe = slapos.recipe.template:jinja2
mode = 755
template = inline:#!{{ parameter_dict['dash'] }}/bin/dash
  export HOSTS=${hosts:rendered}
  export LD_PRELOAD={{ parameter_dict['userhosts'] }}:$LD_PRELOAD
  exec "$@"
rendered = ${directory:bin}/userhosts

186 187 188 189
[userhosts-wrapper-base]
recipe = slapos.cookbook:wrapper
environment =
  HOSTALIASES=${hostaliases:rendered}
190
command-line = '${userhosts-bin:rendered}' ${:wrapped-command-line}
191

192 193 194 195 196 197 198 199 200
{# Hack to deploy SSL certs via instance parameters -#}
{% for zodb in zodb_dict.itervalues() -%}
{%   set storage_dict = zodb.setdefault('storage-dict', {}) -%}
{%   if zodb['type'] == 'neo' and storage_dict.get('ssl', 1) -%}
{%     for k, v in (('_ca', 'ca.crt'),
                    ('_cert', 'neo.crt'),
                    ('_key', 'neo.key')) -%}
{%       if k in storage_dict -%}
[{{ section('neo-ssl-' + k[1:]) }}]
201
< = jinja2-template-base
202 203 204 205 206 207 208 209 210 211 212
rendered = ${directory:etc}/{{v}}
template = inline:{{'{{'}}pem}}
context = key pem :pem
pem = {{dumps(storage_dict.pop(k))}}

{%       endif -%}
{%     endfor -%}
{%   endif -%}
{% endfor -%}
{# endhack -#}

213
[runzope-base]
214 215
<= run-common
instance-home = ${directory:instance}
216 217 218
{% if wsgi -%}
wrapped-command-line = '{{ bin_directory }}/runwsgi' {% if webdav %}-w{% endif %} {{ ipv4 }}:${:port} '${:configuration-file}'
{% else -%}
219
wrapped-command-line = '{{ bin_directory }}/runzope' -C '${:configuration-file}'
220
{%- endif %}
221 222 223 224
{%- set private_dev_shm = slapparameter_dict['private-dev-shm'] %}
{%- if private_dev_shm %}
private-tmpfs = {{ private_dev_shm }} /dev/shm
{%- endif %}
225 226

[{{ section('zcml') }}]
227
recipe = slapos.cookbook:copyfilelist
228
target-directory = ${directory:instance-etc}
229
file-list = {{ parameter_dict['site-zcml'] }}
230 231

[{{ section('zope-inituser') }}]
232
< = jinja2-template-base
233 234 235 236
rendered = ${directory:instance}/inituser
template = inline:{{ slapparameter_dict['inituser-login'] }}:{SHA}{{ hashlib.sha1(slapparameter_dict['inituser-password']).digest().encode('base64').rstrip() }}
mode = 600
once = ${:rendered}_done
237 238 239 240

[zope-conf-parameter-base]
ip = {{ ipv4 }}
site-id = {{ site_id }}
241 242 243 244
{% if site_id -%}
mysql-url = {{ slapparameter_dict['mysql-url-list'][0] }}
inituser = {{ slapparameter_dict['inituser-login'] }}
{%  set mysql = urlparse.urlsplit(slapparameter_dict['mysql-url-list'][0]) -%}
245
{%  set mysql_db = mysql.path.split('/')[1] -%}
246
sql-connection-string = {{ '%s@erp5-catalog-0:%s %s %s' % (
247
    mysql_db, mysql.port, mysql.username, mysql.password) }}
248 249
bt5 = {{ slapparameter_dict['bt5'] }}
bt5-repository-url = {{ slapparameter_dict['bt5-repository-url'] }}
250
id-store-interval = {{ dumps(slapparameter_dict['id-store-interval']) }}
251 252 253 254 255 256 257 258 259
home = ${buildout:directory}
# We only want to change the hostname to 'erp5-cloudooo' if we use the internal
# cloudooo. We plan to remove the ability to have an internal one, so this
# heuristic is enough.
{%  set cloudooo = urlparse.urlsplit(slapparameter_dict['cloudooo-url']) -%}
cloudooo-url = {{ (cloudooo if cloudooo.port == None else
  cloudooo._replace(netloc='erp5-cloudooo:%s' % cloudooo.port)).geturl() }}

{% endif -%}
260
{% set zeo_dict = slapparameter_dict.get('zodb-zeo', {}) -%}
261
{% for name, zodb in zodb_dict.iteritems() -%}
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
{%   set storage_dict = zodb.setdefault('storage-dict', {}) -%}
{%   if zodb['type'] == 'zeo' -%}
{%     do storage_dict.update(zeo_dict.get(name, ())) -%}
{%   else -%}
{%     if name == slapparameter_dict.get('neo-name') -%}
{%       do storage_dict.update(master_nodes=slapparameter_dict['neo-masters'],
                                name=slapparameter_dict['neo-cluster']) -%}
{%     endif -%}
{{     assert(storage_dict['master_nodes'], name) }}
{%     if storage_dict.pop('ssl', 1) -%}
{%       do storage_dict.update(ca='~/etc/ca.crt',
                                cert='~/etc/neo.crt',
                                key='~/etc/neo.key') -%}
{%     endif -%}
{%   endif -%}
277
{% endfor -%}
278
developer-list = {{ dumps(slapparameter_dict['developer-list']) }}
279 280
publication-deadline = {{ dumps(slapparameter_dict['publication-deadline']) }}
activity-deadline = {{ dumps(slapparameter_dict['activity-deadline']) }}
281 282 283 284
instance = ${directory:instance}
instance-products = ${directory:instance-products}
deadlock-path = /manage_debug_threads
deadlock-debugger-password = {{ dumps(slapparameter_dict['deadlock-debugger-password']) }}
285 286 287 288
{% if slapparameter_dict.get('tidstorage-ip') -%}
tidstorage-ip = {{ dumps(slapparameter_dict['tidstorage-ip']) }}
tidstorage-port = {{ dumps(slapparameter_dict['tidstorage-port']) }}
{% endif -%}
289
{% set thread_amount = slapparameter_dict['thread-amount'] -%}
290
{% set large_file_threshold = slapparameter_dict['large-file-threshold']  -%}
291
thread-amount = {{ thread_amount }}
292 293 294 295 296 297
webdav = {{ dumps(webdav) }}
{% if webdav -%}
{%   set timerserver_interval = 0 -%}
{% else -%}
{%   set timerserver_interval = slapparameter_dict['timerserver-interval'] -%}
{%- endif %}
298
wsgi = {{ dumps(wsgi) }}
299
timerserver-interval = {{ dumps(timerserver_interval) }}
300 301

[zope-conf-base]
302
< = jinja2-template-base
303
template = {{ parameter_dict['zope-conf-template'] }}
304 305 306 307 308
extensions =
    jinja2.ext.do
    jinja2.ext.loopcontrols
import-list =
    rawfile root_common {{ root_common }}
309 310

{% macro zope(
311
  index,
312 313 314 315
  port,
  longrequest_logger_timeout,
  longrequest_logger_interval
) -%}
316
{% set name = 'zope-' ~ index -%}
317 318 319 320 321 322 323 324 325 326 327
{% set conf_name = name ~ '-conf' -%}
{% set conf_parameter_name = conf_name ~ '-param' -%}
{% set zope_tunnel_section_name = name ~ '-ipv6toipv4' -%}
{% set zope_tunnel_base_name = zope_tunnel_section_name -%}
[{{ conf_parameter_name }}]
< = zope-conf-parameter-base
pid-file = ${directory:run}/{{ name }}.pid
lock-file = ${directory:run}/{{ name }}.lock
port = {{ port }}
event-log = ${directory:log}/{{ name }}-event.log
z2-log = ${directory:log}/{{ name }}-Z2.log
328
node-id = {{ dumps(node_id_base ~ (node_id_index_format % index)) }}
329
{% set log_list = [] -%}
330 331
{% set import_set = set() -%}
{% for db_name, zodb in zodb_dict.iteritems() -%}
332
{%   do zodb.setdefault('pool-size', thread_amount) -%}
333 334
{%   if zodb['type'] == 'neo' -%}
{%     do import_set.add('neo.client') -%}
335 336 337
{%     set log = name ~ '-neo-' ~ db_name ~ '.log' -%}
{%     do log_list.append('${directory:log}/' + log) -%}
{%     do zodb['storage-dict'].update(logfile='~/var/log/'+log) -%}
338 339
{%   endif -%}
{% endfor -%}
340 341
import-list = {{ dumps(list(import_set)) }}
zodb-dict = {{ dumps(zodb_dict) }}
342
large-file-threshold = {{ large_file_threshold }}
343 344 345 346 347 348 349
{% if longrequest_logger_interval > 0 -%}
longrequest-logger-file = {{ longrequest_logger_base_path ~ name ~ ".log" }}
longrequest-logger-timeout = {{ longrequest_logger_timeout }}
longrequest-logger-interval = {{ longrequest_logger_interval }}
{% else -%}
longrequest-logger-file =
{% endif -%}
350 351 352 353

[{{ conf_name }}]
< = zope-conf-base
rendered = ${directory:etc}/{{ name }}.conf
354
context =
355
  section parameter_dict {{ conf_parameter_name }}
356
  import os os
357
  import re re
358

359
[{{ section(name) }}]
360 361
< = runzope-base
wrapper-path = ${directory:service-on-watch}/{{ name }}
362
configuration-file = {{ '${' ~ conf_name ~ ':rendered}' }}
363 364 365
{%- if wsgi %}
port = {{ port }}
{%- endif %}
366 367 368 369
hash-files =
  ${:configuration-file}
hash-existing-files =
  ${buildout:directory}/software_release/buildout.cfg
370 371

[{{ section("promise-" ~ name) }}]
372 373 374 375 376
<= monitor-promise-base
module = check_port_listening
name = {{ name }}.py
config-hostname = {{ ipv4 }}
config-port = {{ port }}
377 378 379 380 381 382 383

{% if use_ipv6 -%}
[{{ zope_tunnel_section_name }}]
< = ipv6toipv4-base
base-name = {{ zope_tunnel_base_name }}
ipv6-port = {{ port }}
ipv4-port = {{ port }}
384
{%   do publish_list.append(("[" ~ ipv6 ~ "]:" ~ port, thread_amount, webdav)) -%}
385 386

[{{ section("promise-tunnel-" ~ name) }}]
387 388 389 390 391
<= monitor-promise-base
module = check_port_listening
name = {{ zope_tunnel_base_name }}.py
config-hostname = {{ '${' ~ zope_tunnel_section_name ~ ':ipv6}' }}
config-port = {{ '${' ~ zope_tunnel_section_name ~ ':ipv6-port}' }}
392
{% else -%}
393
{%   do publish_list.append((ipv4 ~ ":" ~ port, thread_amount, webdav)) -%}
394 395
{% endif -%}

396 397
{% if longrequest_logger_interval > 0 -%}
[{{ section('promise-check-' ~name ~ '-longrequest-error-log') }}]
398 399 400
<= monitor-promise-base
module = check_error_on_zope_longrequest_log
name = {{'check-' ~ name ~ '-longrequest-error-log.py'}}
401 402 403 404 405
config-log-file = {{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }}
config-error-threshold = {{ slapparameter_dict["zope-longrequest-logger-error-threshold"] }}
config-maximum-delay = {{ slapparameter_dict["zope-longrequest-logger-maximum-delay"] }}
{% endif -%}

406 407 408
[{{ section('logrotate-entry-' ~ name) }}]
< = logrotate-entry-base
name = {{ name }}
409
log = {{ '${' ~ conf_parameter_name ~ ':event-log}' }} {{ '${' ~ conf_parameter_name ~ ':z2-log}' }} {{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }} {{ ' '.join(log_list) }}
410
post = test ! -s {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} || {{ bin_directory }}/slapos-kill --pidfile {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} -s USR2
411 412
{% endmacro -%}

413
{% for i in instance_index_list -%}
414 415
{{   zope(
       i,
416
       next_port(),
417 418 419
       slapparameter_dict['longrequest-logger-timeout'],
       slapparameter_dict['longrequest-logger-interval'],
     ) }}
420 421
{% endfor -%}

422 423 424 425 426 427 428 429 430 431
[{{ section("watch_activities") }}]
<= userhosts-wrapper-base
environment +=
  MYSQL=${binary-link:target-directory}/mysql
wrapped-command-line = {{ parameter_dict['erp5-location'] }}/product/CMFActivity/bin/${:_buildout_section_name_} "-h erp5-catalog-0 -P  {{ mysql.port }}  -u {{ mysql.username }} -p{{ mysql.password}} {{ mysql_db }}" 5 3600
wrapper-path = ${buildout:bin-directory}/${:_buildout_section_name_}

[{{ section("wait_activities") }}]
<= watch_activities

432 433 434 435
{% if test_runner_enabled and test_runner_node_count -%}
{% for _ in range(test_runner_node_count) %}
{%   do test_runner_address_list.append((ipv4, next_port())) %}
{% endfor %}
436

437
{% if selenium_server_configuration_dict -%}
438
[test-zelenium-runner-parameter]
439
configuration = {{ dumps(selenium_server_configuration_dict) }}
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
user = {{ dumps(slapparameter_dict['inituser-login']) }}
password = {{ dumps(slapparameter_dict['inituser-password']) }}
bin-path = {{ bin_directory }}/{{ parameter_dict['egg-interpreter'] }}

[{{ section('test-zelenium-runner') }}]
<= jinja2-template-base
template = {{ parameter_dict['run-zelenium-template'] }}
rendered = ${directory:bin}/runTestSuite
mode = 755
context =
    import json_module json
    key configuration test-zelenium-runner-parameter:configuration
    key user test-zelenium-runner-parameter:user
    key password test-zelenium-runner-parameter:password
    key bin_path test-zelenium-runner-parameter:bin-path
{% else -%}
[{{ section('run-unit-test-userhosts-wrapper') }}]
<= userhosts-wrapper-base
wrapped-command-line = ${runUnitTest:wrapper-path}
wrapper-path = ${buildout:bin-directory}/runUnitTest

[{{ section('run-test-suite-userhosts-wrapper') }}]
<= userhosts-wrapper-base
wrapped-command-line = ${runTestSuite:wrapper-path}
wrapper-path = ${buildout:bin-directory}/runTestSuite

{%   set connection_string_list = [] -%}
{%   for url in slapparameter_dict['mysql-test-url-list'] -%}
{%     set parsed_url = urlparse.urlparse(url) -%}
{%     do connection_string_list.append(
         '%s@%s:%s %s %s' % (
           parsed_url.path.lstrip('/'),
           parsed_url.hostname,
           parsed_url.port,
           parsed_url.username,
           parsed_url.password,
         ),
       ) -%}
{%   endfor -%}
[run-test-common]
< = run-common
environment-extra =
  REAL_INSTANCE_HOME=${:instance-home}
483
  SQLBENCH_PATH={{ parameter_dict['sqlbench_path'] }}
484
  TEST_CA_PATH=${directory:ca-dir}
485 486 487
{%- if wsgi %}
  erp5_wsgi=1
{%- endif %}
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
instance-home = ${directory:unit-test-path}
wrapper-path = ${directory:bin}/${:command-name}.real
command-line =
  '{{ parameter_dict['bin-directory'] }}/${:command-name}'
  ${:command-line-extra}
  --conversion_server_url={{ slapparameter_dict['cloudooo-url'] }}
  --conversion_server_retry_count={{ slapparameter_dict.get('cloudooo-retry-count', 2) }}
{#- BBB: We still have test suites that only accept the following 2 options. #}
  --conversion_server_hostname=erp5-cloudooo
  --conversion_server_port={{ port_dict['erp5-cloudooo'] }}
  --volatile_memcached_server_hostname=erp5-memcached-volatile
  --volatile_memcached_server_port={{ port_dict['erp5-memcached-volatile'] }}
  --persistent_memcached_server_hostname=erp5-memcached-persistent
  --persistent_memcached_server_port={{ port_dict['erp5-memcached-persistent'] }}

[{{ section('runUnitTest') }}]
< = run-test-common
command-name = runUnitTest
command-line-extra =
  --erp5_sql_connection_string '{{ connection_string_list[0] }}'
  --extra_sql_connection_string_list '{{ ','.join(connection_string_list[1:]) }}'
  --zserver {{ test_runner_address_list[0][0] ~ ':' ~ test_runner_address_list[0][1] }}
  --zserver_frontend_url {{ slapparameter_dict['test-runner-apache-url-list'][0] }}

[{{ section('runTestSuite') }}]
< = run-test-common
command-name = runTestSuite
command-line-extra =
  --db_list '{{ ','.join(connection_string_list) }}'
environment-extra +=
  {#- turn a list of (ip, port) in a list of 'ip:port' #}
  {% set zserver_address_list = [] -%}
  {% for ip, port in test_runner_address_list %}
  {%   do zserver_address_list.append(ip ~ ':' ~ port) %}
  {% endfor -%}
  zserver_address_list={{ ','.join(zserver_address_list) }}
  zserver_frontend_url_list={{ ','.join(slapparameter_dict['test-runner-apache-url-list']) }}

526
[promise-test-runner-apache-url-executable]
527 528 529 530
# promise to wait for apache partition to have returned the parameter
recipe = slapos.cookbook:check_parameter
value = {{ slapparameter_dict['test-runner-apache-url-list'] }}
expected-not-value = not-ready
531
path = ${directory:bin}/${:_buildout_section_name_}
532 533
expected-value =

534 535 536 537 538 539
[{{ section("promise-test-runner-apache-url") }}]
<= monitor-promise-base
module = check_command_execute
name = ${:_buildout_section_name_}.py
config-command = ${promise-test-runner-apache-url-executable:path}

540 541 542
{%-   endif %}
{%- endif %}

543
[{{ section('promise-check-computer-memory') }}]
544 545 546 547
<= monitor-promise-base
module = check_command_execute
name = check-computer-memory.py
config-command = "{{ parameter_dict["check-computer-memory-binary"] }}" -db ${monitor-instance-parameter:collector-db} --threshold "{{ slapparameter_dict["computer-memory-percent-threshold"] }}" --unit percent
548 549


550
[publish]
551 552
recipe = slapos.cookbook:publish.serialised
zope-address-list = {{ dumps(publish_list) }}
553 554 555 556 557 558 559
{#
Note: hosts_dist is generated at zope level rather than at erp5 (root partition)
level, as it is easier: we can access urls as python values trivially here.
This has the downside of making each zope partition publish the (hopefuly) same
dict toward erp5 partition, violating the DRY principle and making the intent
hard to guess.
-#}
560
hosts-dict = {{ dumps(publishable_hosts_dict) }}
561
monitor-base-url = ${monitor-publish-parameters:monitor-base-url}
562
test-runner-address-list = {{ dumps(test_runner_address_list) }}
563
software-release-url = ${slap-connection:software-release-url}
564

565 566
[monitor-instance-parameter]
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
567
monitor-httpd-port = {{ next_port() }}
568
monitor-title = {{ slapparameter_dict['name'] }}
569
password = {{ slapparameter_dict['monitor-passwd'] }}
570

571
[buildout]
572
extends =
573
  {{ template_monitor }}
574
parts +=
575
  {{ '\n  '.join(part_list) }}
576
  publish