Commit 772ca020 authored by Alain Takoudjou's avatar Alain Takoudjou

Add parameters to Activate or desactivate monitor and to set port-base

parent 9ad09a63
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
{% set site_id = slapparameter_dict.get('site-id', 'erp5') -%} {% set site_id = slapparameter_dict.get('site-id', 'erp5') -%}
{% set inituser_login = slapparameter_dict.get('inituser-login', 'zope') -%} {% set inituser_login = slapparameter_dict.get('inituser-login', 'zope') -%}
{% set publish_dict = {'site-id': site_id, 'inituser-login': inituser_login} -%} {% set publish_dict = {'site-id': site_id, 'inituser-login': inituser_login} -%}
{% set mariadb_request_dict = {'tcpv4-port': mariadb_dict.get('tcpv4-port', 2099)} -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
{% set monitor_port = monitor_dict.get('port-base', 2600) %}
{% set monitor_count = 1 -%}
{% if mariadb_dict.get('monitor', False) -%}
{% do mariadb_request_dict.__setitem__('monitor-port', mariadb_dict.get('monitor-port', monitor_port)) -%}
{% endif -%}
[request-common] [request-common]
recipe = slapos.cookbook:request.serialised recipe = slapos.cookbook:request.serialised
software-url = ${slap-connection:software-release-url} software-url = ${slap-connection:software-release-url}
...@@ -36,7 +44,7 @@ config-{{ option }} = {{ dumps(value) }} ...@@ -36,7 +44,7 @@ config-{{ option }} = {{ dumps(value) }}
{{ request('memcached-persistent', 'kumofs', 'kumofs', {'tcpv4-port': 2000}) }} {{ request('memcached-persistent', 'kumofs', 'kumofs', {'tcpv4-port': 2000}) }}
{{ request('memcached-volatile', 'kumofs', 'memcached', {'tcpv4-port': 2010, 'ram-storage-size': 64}) }} {{ request('memcached-volatile', 'kumofs', 'memcached', {'tcpv4-port': 2010, 'ram-storage-size': 64}) }}
{{ request('cloudooo', 'cloudooo', 'cloudooo', {'tcpv4-port': 2020}) }} {{ request('cloudooo', 'cloudooo', 'cloudooo', {'tcpv4-port': 2020}) }}
{{ request('mariadb', 'mariadb', 'mariadb', {'tcpv4-port': mariadb_dict.get('tcpv4-port', 2099)}, {'database-list': True, 'test-database-list': True}) }} {{ request('mariadb', 'mariadb', 'mariadb', mariadb_request_dict, {'database-list': True, 'test-database-list': True}) }}
{{ request('http-monitor', 'http-monitor', 'http-monitor', {}, {'monitor-url': True}) }} {{ request('http-monitor', 'http-monitor', 'http-monitor', {}, {'monitor-url': True}) }}
{# Fail early if an unexpected value is provided -#} {# Fail early if an unexpected value is provided -#}
{% set zodb_type = slapparameter_dict.get('zodb-software-type') -%} {% set zodb_type = slapparameter_dict.get('zodb-software-type') -%}
...@@ -116,7 +124,12 @@ config-longrequest-logger-interval = {{ dumps(zope_parameter_dict.get('longreque ...@@ -116,7 +124,12 @@ config-longrequest-logger-interval = {{ dumps(zope_parameter_dict.get('longreque
config-longrequest-logger-timeout = {{ dumps(zope_parameter_dict.get('longrequest-logger-timeout', 1)) }} config-longrequest-logger-timeout = {{ dumps(zope_parameter_dict.get('longrequest-logger-timeout', 1)) }}
config-port-base = {{ dumps(zope_parameter_dict.get('port-base', 2200)) }} config-port-base = {{ dumps(zope_parameter_dict.get('port-base', 2200)) }}
config-webdav = {{ dumps(zope_parameter_dict.get('webdav', False)) }} config-webdav = {{ dumps(zope_parameter_dict.get('webdav', False)) }}
config-monitor = {{ dumps(zope_parameter_dict.get('monitor', False)) }}
{% if zope_parameter_dict.get('monitor', False) -%}
config-monitor-port = {{ zope_parameter_dict.get('monitor-port', monitor_port + monitor_count) }}
{% endif -%}
sla-computer_guid = {{ dumps(zope_parameter_dict.get('computer-guid', computer_id)) }} sla-computer_guid = {{ dumps(zope_parameter_dict.get('computer-guid', computer_id)) }}
{% set monitor_count = monitor_count + 1 -%}
{% endfor -%} {% endfor -%}
{# We need to concatenate lists that we cannot read as lists, so this gets hairy. -#} {# We need to concatenate lists that we cannot read as lists, so this gets hairy. -#}
......
...@@ -14,6 +14,10 @@ XXX: This template only supports exactly one IPv4 and one IPv6 per ...@@ -14,6 +14,10 @@ XXX: This template only supports exactly one IPv4 and one IPv6 per
partition. No more (undefined result), no less (IndexError). partition. No more (undefined result), no less (IndexError).
-#} -#}
{% set ipv4 = (ipv4_set | list)[0] -%} {% set ipv4 = (ipv4_set | list)[0] -%}
{% set monitor = slapparameter_dict['monitor'] -%}
{% if monitor -%}
{% set monitor_port = slapparameter_dict['monitor-port'] %}
{% endif -%}
{% if slapparameter_dict['mysql-test-url-list'] -%} {% if slapparameter_dict['mysql-test-url-list'] -%}
[{{ section('test-runner') }}] [{{ section('test-runner') }}]
...@@ -85,6 +89,7 @@ recipe = slapos.cookbook:symbolic.link ...@@ -85,6 +89,7 @@ recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:bin} target-directory = ${directory:bin}
link-binary = {{ dumps(parameter_dict['link-binary']) }} link-binary = {{ dumps(parameter_dict['link-binary']) }}
{% if monitor -%}
[{{ section('monitor-current-log-access') }}] [{{ section('monitor-current-log-access') }}]
< = monitor-directory-access < = monitor-directory-access
source = ${directory:log} source = ${directory:log}
...@@ -94,7 +99,8 @@ source = ${directory:log} ...@@ -94,7 +99,8 @@ source = ${directory:log}
source = ${directory:logrotate-backup} source = ${directory:logrotate-backup}
[monitor-parameters] [monitor-parameters]
port = {{ slapparameter_dict['port-base'] + 5000 }} port = {{ slapparameter_dict['monitor-port'] }}
{% endif -%}
[certificate-authority-common] [certificate-authority-common]
requests-directory = ${directory:ca-requests} requests-directory = ${directory:ca-requests}
...@@ -375,7 +381,9 @@ dict toward erp5 partition, violating the DRY principle and making the intent ...@@ -375,7 +381,9 @@ dict toward erp5 partition, violating the DRY principle and making the intent
hard to guess. hard to guess.
-#} -#}
hosts-dict = {{ dumps(hosts_dict) }} hosts-dict = {{ dumps(hosts_dict) }}
{% if monitor -%}
monitor-url = ${monitor-parameters:url} monitor-url = ${monitor-parameters:url}
{% endif -%}
[erp5-promise] [erp5-promise]
recipe = slapos.cookbook:erp5.promise recipe = slapos.cookbook:erp5.promise
...@@ -394,9 +402,14 @@ certificate-authority-path = {{ dumps(slapparameter_dict['ca-path']) }} ...@@ -394,9 +402,14 @@ certificate-authority-path = {{ dumps(slapparameter_dict['ca-path']) }}
[buildout] [buildout]
extends = extends =
{{ logrotate_cfg }} {{ logrotate_cfg }}
{% if monitor -%}
# Extends template for monitor
{{ parameter_dict['template-monitor'] }} {{ parameter_dict['template-monitor'] }}
{% endif -%}
parts += parts +=
erp5-promise erp5-promise
{% if monitor -%}
# Access to zope logs
certificate-authority certificate-authority
cron-entry-monitor cron-entry-monitor
cron-entry-rss cron-entry-rss
...@@ -407,6 +420,8 @@ parts += ...@@ -407,6 +420,8 @@ parts +=
cgi-httpd-graceful-wrapper cgi-httpd-graceful-wrapper
monitor-promise monitor-promise
monitor-instance-log-access monitor-instance-log-access
{% endif -%}
# Complete parts with sections
{{ part_list | join('\n ') }} {{ part_list | join('\n ') }}
publish-zope publish-zope
versions = versions versions = versions
......
...@@ -25,14 +25,14 @@ repository_id_list = erp5 vifib/master ...@@ -25,14 +25,14 @@ repository_id_list = erp5 vifib/master
[erp5] [erp5]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/erp5.git repository = http://git.erp5.org/repos/erp5.git
branch = erp5-vifib branch = erp5-slapos-upgrade
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
revision = revision =
[vifib] [vifib]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.core.git repository = http://git.erp5.org/repos/slapos.core.git
branch = master-dev branch = master
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
revision = revision =
...@@ -72,7 +72,7 @@ mode = 644 ...@@ -72,7 +72,7 @@ mode = 644
[template-erp5] [template-erp5]
< = download-base-part < = download-base-part
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 5f221cc3eee58e1541a86981f42d6d5f md5sum = 00c64cb7381892784da468b6ef43b99f
[template-balancer] [template-balancer]
< = download-base-part < = download-base-part
...@@ -82,7 +82,7 @@ md5sum = 2a8d46a2b1b8c2aae12e134cbcafa266 ...@@ -82,7 +82,7 @@ md5sum = 2a8d46a2b1b8c2aae12e134cbcafa266
[template-zope] [template-zope]
< = download-base-part < = download-base-part
filename = instance-zope.cfg.in filename = instance-zope.cfg.in
md5sum = 64566833e81dd4f7b5e5aad835982380 md5sum = 01cc08950b7f4358576dd049290c8cee
[template-apache-conf] [template-apache-conf]
< = download-base-part < = download-base-part
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment