Commit 17fd0fbf authored by Hardik Juneja's avatar Hardik Juneja

stack: Make monitor apache optional using a slap parameter

parent f89c42fb
...@@ -23,15 +23,15 @@ md5sum = dc974bd74cf967ae6250d81322629c44 ...@@ -23,15 +23,15 @@ md5sum = dc974bd74cf967ae6250d81322629c44
[template-mariadb] [template-mariadb]
filename = instance-mariadb.cfg.in filename = instance-mariadb.cfg.in
md5sum = 3b6c19686ac52c2d452597dbacc88888 md5sum = 1894a05674a7f670692bb2e12ff44d9c
[template-kumofs] [template-kumofs]
filename = instance-kumofs.cfg.in filename = instance-kumofs.cfg.in
md5sum = 253027f37c4e5bd908e6af551848f03a md5sum = 5ac90bdfd30156822b9702a8b73a4d8e
[template-cloudooo] [template-cloudooo]
filename = instance-cloudoo.cfg.in filename = instance-cloudoo.cfg.in
md5sum = 43253cbfd5d361047ba6a99b116b2370 md5sum = 53a669a7fd42c14596ad7d3a79dfe760
[template-zope-conf] [template-zope-conf]
filename = zope.conf.in filename = zope.conf.in
...@@ -83,19 +83,19 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e ...@@ -83,19 +83,19 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 929b87c01aaf6ea1bbf6ff906ce9c0d9 md5sum = b8cb62bbbcbd7d85258aa63b14be9a20
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
md5sum = 2248d249cfc53c73e7c65665d4d53be0 md5sum = d04d0f67e399543004f5f363ff448052
[template-zope] [template-zope]
filename = instance-zope.cfg.in filename = instance-zope.cfg.in
md5sum = 6a64d1615c3ef9f6311c863d5aa0c58f md5sum = f08e4750f66a3aa27c9379ae278bdd8c
[template-balancer] [template-balancer]
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
md5sum = a3ad32c46bb56076895441edbd66018d md5sum = 865efaf767a747d263edad9108a76191
[template-haproxy-cfg] [template-haproxy-cfg]
filename = haproxy.cfg.in filename = haproxy.cfg.in
......
...@@ -230,6 +230,9 @@ monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} ...@@ -230,6 +230,9 @@ monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port() }} monitor-httpd-port = {{ next_port() }}
monitor-title = Balancer monitor monitor-title = Balancer monitor
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
{% if slapparameter_dict.get('monitor-disable-apache') -%}
monitor-base-url =
{% endif -%}
instance-configuration = instance-configuration =
file apachedex-default ${apachedex-parameters:default} file apachedex-default ${apachedex-parameters:default}
file apachedex-base-list ${apachedex-parameters:base-list} file apachedex-base-list ${apachedex-parameters:base-list}
......
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%} {% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
[buildout] [buildout]
extends = extends =
{{ parameter_dict['template-monitor'] }} {{ parameter_dict['template-monitor'] }}
...@@ -112,6 +113,9 @@ framebuffer = ${:srv}/framebuffer ...@@ -112,6 +113,9 @@ framebuffer = ${:srv}/framebuffer
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ tcpv4_port + 2 }} monitor-httpd-port = {{ tcpv4_port + 2 }}
monitor-title = Cloudooo monitor monitor-title = Cloudooo monitor
{% if slapparameter_dict.get('monitor-disable-apache') -%}
monitor-base-url =
{% endif -%}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
[binary-link] [binary-link]
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
{% set jupyter_dict = slapparameter_dict.get('jupyter', {}) -%} {% set jupyter_dict = slapparameter_dict.get('jupyter', {}) -%}
{% set has_jupyter = jupyter_dict.get('enable', jupyter_enable_default.lower() in ('true', 'yes')) -%} {% set has_jupyter = jupyter_dict.get('enable', jupyter_enable_default.lower() in ('true', 'yes')) -%}
{% set jupyter_zope_family = jupyter_dict.get('zope-family', '') -%} {% set jupyter_zope_family = jupyter_dict.get('zope-family', '') -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
{% set monitor_base_url_dict = {} -%} {% set monitor_base_url_dict = {} -%}
[request-common] [request-common]
<= request-common-base <= request-common-base
...@@ -38,10 +39,10 @@ config-{{ k }} = {{ '${' ~ v ~ '}' }} ...@@ -38,10 +39,10 @@ config-{{ k }} = {{ '${' ~ v ~ '}' }}
{% endfor -%} {% endfor -%}
{% endmacro -%} {% endmacro -%}
{{ request('memcached-persistent', 'kumofs', 'kumofs', {'tcpv4-port': 2000}, {'url': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }} {{ request('memcached-persistent', 'kumofs', 'kumofs', {'tcpv4-port': 2000, 'monitor-disable-apache': monitor_dict.get('disable-apache')}, {'url': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }}
{{ request('memcached-volatile', 'kumofs', 'memcached', {'tcpv4-port': 2010, 'ram-storage-size': 64}, {'url': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }} {{ request('memcached-volatile', 'kumofs', 'memcached', {'tcpv4-port': 2010, 'ram-storage-size': 64, 'monitor-disable-apache': monitor_dict.get('disable-apache')}, {'url': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }}
{{ request('cloudooo', 'cloudooo', 'cloudooo', {'tcpv4-port': 2020}, {'url': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }} {{ request('cloudooo', 'cloudooo', 'cloudooo', {'tcpv4-port': 2020, 'monitor-disable-apache': monitor_dict.get('disable-apache')}, {'url': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }}
{{ request('mariadb', 'mariadb', 'mariadb', {'tcpv4-port': 2099}, {'database-list': True, 'test-database-list': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }} {{ request('mariadb', 'mariadb', 'mariadb', {'tcpv4-port': 2099, 'monitor-disable-apache': monitor_dict.get('disable-apache')}, {'database-list': True, 'test-database-list': True, 'monitor-base-url': False}, key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }}
{% if has_posftix -%} {% if has_posftix -%}
{{ request('smtp', 'postfix', 'smtp', {'tcpv4-port': 2025, 'smtpd-sasl-user': 'erp5@nowhere'}, key_config={'smtpd-sasl-password': 'publish-early:smtpd-sasl-password'}) }} {{ request('smtp', 'postfix', 'smtp', {'tcpv4-port': 2025, 'smtpd-sasl-user': 'erp5@nowhere'}, key_config={'smtpd-sasl-password': 'publish-early:smtpd-sasl-password'}) }}
{%- else %} {%- else %}
...@@ -78,7 +79,7 @@ connection-url = smtp://127.0.0.2:0/ ...@@ -78,7 +79,7 @@ connection-url = smtp://127.0.0.2:0/
{% else -%} {% else -%}
{{ assert(server_type == 'zeo', server_type) -}} {{ assert(server_type == 'zeo', server_type) -}}
{# BBB: for compatibility, keep 'zodb' as partition_reference for ZEO -#} {# BBB: for compatibility, keep 'zodb' as partition_reference for ZEO -#}
{{ request('zodb', 'zodb-' ~ server_type, 'zodb-' ~ server_type, {'tcpv4-port': 2100, 'zodb-dict': server_dict}, dict.fromkeys(('storage-dict', 'tidstorage-ip', 'tidstorage-port', 'monitor-base-url')), key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }} {{ request('zodb', 'zodb-' ~ server_type, 'zodb-' ~ server_type, {'tcpv4-port': 2100, 'zodb-dict': server_dict, 'monitor-disable-apache': monitor_dict.get('disable-apache')}, dict.fromkeys(('storage-dict', 'tidstorage-ip', 'tidstorage-port', 'monitor-base-url')), key_config={'monitor-passwd': 'monitor-htpasswd:passwd'}) }}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
...@@ -146,6 +147,7 @@ config-inituser-login = {{ dumps(inituser_login) }} ...@@ -146,6 +147,7 @@ config-inituser-login = {{ dumps(inituser_login) }}
config-inituser-password = ${publish-early:inituser-password} config-inituser-password = ${publish-early:inituser-password}
config-kumofs-url = ${request-memcached-persistent:connection-url} config-kumofs-url = ${request-memcached-persistent:connection-url}
config-memcached-url = ${request-memcached-volatile:connection-url} config-memcached-url = ${request-memcached-volatile:connection-url}
config-monitor-disable-apache = monitor_dict.get('disable-apache')
config-monitor-passwd = ${monitor-htpasswd:passwd} config-monitor-passwd = ${monitor-htpasswd:passwd}
config-mysql-test-url-list = ${request-mariadb:connection-test-database-list} config-mysql-test-url-list = ${request-mariadb:connection-test-database-list}
config-mysql-url-list = ${request-mariadb:connection-database-list} config-mysql-url-list = ${request-mariadb:connection-database-list}
...@@ -258,6 +260,7 @@ config-{{ name }} = {{ ' ${' ~ zope_section_id ~ ':connection-zope-address-list} ...@@ -258,6 +260,7 @@ config-{{ name }} = {{ ' ${' ~ zope_section_id ~ ':connection-zope-address-list}
config-haproxy-server-check-path = {{ dumps(balancer_dict.get('haproxy-server-check-path', '/') % {'site-id': site_id}) }} config-haproxy-server-check-path = {{ dumps(balancer_dict.get('haproxy-server-check-path', '/') % {'site-id': site_id}) }}
config-backend-path = {{ dumps(balancer_dict.get('apache-backend-path', '/') % {'site-id': site_id}) }} config-backend-path = {{ dumps(balancer_dict.get('apache-backend-path', '/') % {'site-id': site_id}) }}
config-ssl = {{ dumps(balancer_dict.get('ssl', {})) }} config-ssl = {{ dumps(balancer_dict.get('ssl', {})) }}
config-monitor-disable-apache = monitor_dict.get('disable-apache')
config-monitor-passwd = ${monitor-htpasswd:passwd} config-monitor-passwd = ${monitor-htpasswd:passwd}
...@@ -315,6 +318,9 @@ parts += ...@@ -315,6 +318,9 @@ parts +=
[monitor-conf-parameters] [monitor-conf-parameters]
monitor-title = ERP5 monitor monitor-title = ERP5 monitor
password = ${monitor-htpasswd:passwd} password = ${monitor-htpasswd:passwd}
{% if monitor_dict.get('disable-apache') == True -%}
monitor-base-url =
{% endif -%}
[monitor-base-url-dict] [monitor-base-url-dict]
{% for key, value in monitor_base_url_dict.items() -%} {% for key, value in monitor_base_url_dict.items() -%}
......
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%} {% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
[buildout] [buildout]
extends = extends =
{{ logrotate_cfg }} {{ logrotate_cfg }}
...@@ -113,4 +114,7 @@ port = ${kumofs-instance:manager-port} ...@@ -113,4 +114,7 @@ port = ${kumofs-instance:manager-port}
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ tcpv4_port + 4 }} monitor-httpd-port = {{ tcpv4_port + 4 }}
monitor-title = Kumofs monitor monitor-title = Kumofs monitor
{% if slapparameter_dict.get('monitor-disable-apache') -%}
monitor-base-url =
{% endif -%}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
{% set ip = (ipv4_set | list)[0] -%} {% set ip = (ipv4_set | list)[0] -%}
{% endif -%} {% endif -%}
{% set dash = parameter_dict['dash-location'] ~ '/bin/dash' %} {% set dash = parameter_dict['dash-location'] ~ '/bin/dash' %}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
[{{ section('publish') }}] [{{ section('publish') }}]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
...@@ -302,6 +303,9 @@ parameters-extra = true ...@@ -302,6 +303,9 @@ parameters-extra = true
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ port + 1 }} monitor-httpd-port = {{ port + 1 }}
monitor-title = Mariadb monitor monitor-title = Mariadb monitor
{% if slapparameter_dict.get('monitor-disable-apache') -%}
monitor-base-url =
{% endif -%}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
[buildout] [buildout]
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
{% set default_zodb_path = buildout_directory ~ '/srv/zodb' -%} {% set default_zodb_path = buildout_directory ~ '/srv/zodb' -%}
{% set default_backup_path = buildout_directory ~ '/srv/backup/zodb' -%} {% set default_backup_path = buildout_directory ~ '/srv/backup/zodb' -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
[zeo-base] [zeo-base]
recipe = slapos.cookbook:zeo recipe = slapos.cookbook:zeo
...@@ -186,6 +187,9 @@ tidstorage = {{ tidstorage_repozo_path }} ...@@ -186,6 +187,9 @@ tidstorage = {{ tidstorage_repozo_path }}
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port() }} monitor-httpd-port = {{ next_port() }}
monitor-title = ZODB monitor monitor-title = ZODB monitor
{% if monitor_dict.get('disable-apache') == True -%}
monitor-base-url =
{% endif -%}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
[buildout] [buildout]
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
{% set longrequest_logger_base_path = buildout_directory ~ '/var/log/longrequest_logger_' -%} {% set longrequest_logger_base_path = buildout_directory ~ '/var/log/longrequest_logger_' -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%} {% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{% set monitor_dict = slapparameter_dict.get('monitor', {}) %}
{# {#
XXX: This template only supports exactly one IPv4 and one IPv6 per 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).
...@@ -395,6 +396,9 @@ bt5-repository-url = {{ dumps(slapparameter_dict['bt5-repository-url']) }} ...@@ -395,6 +396,9 @@ bt5-repository-url = {{ dumps(slapparameter_dict['bt5-repository-url']) }}
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port() }} monitor-httpd-port = {{ next_port() }}
monitor-title = Zope monitor monitor-title = Zope monitor
{% if monitor_dict.get('disable-apache') == True -%}
monitor-base-url =
{% endif -%}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
[buildout] [buildout]
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
# not need these here). # not need these here).
[monitor2-template] [monitor2-template]
filename = instance-monitor.cfg.jinja2.in filename = instance-monitor.cfg.jinja2.in
md5sum = 5027f0b1abcc28ce3817cd70fb667a3b md5sum = 054cedcee5e3b82dca992c9ff45b85cd
...@@ -289,13 +289,25 @@ monitor-url = ${:monitor-base-url}/public/feeds ...@@ -289,13 +289,25 @@ monitor-url = ${:monitor-base-url}/public/feeds
monitor-user = ${monitor-instance-parameter:username} monitor-user = ${monitor-instance-parameter:username}
monitor-password = ${monitor-instance-parameter:password} monitor-password = ${monitor-instance-parameter:password}
[install-monitor-apache]
recipe = plone.recipe.command
command = true
update-command =
monitor-base-url = ${monitor-frontend-promise:url}
monitor-base-url-ipv6 = ${monitor-httpd-conf-parameter:url}
depends =
${certificate-authority:wrapper}
${ca-monitor-httpd:wrapper}
${monitor-httpd-promise:filename}
${promise-monitor-httpd-is-process-older-than-dependency-set:wrapper-path}
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-title = ${slap-configuration:instance-title} monitor-title = ${slap-configuration:instance-title}
monitor-httpd-ipv6 = ${slap-configuration:ipv6-random} monitor-httpd-ipv6 = ${slap-configuration:ipv6-random}
monitor-httpd-port = 8196 monitor-httpd-port = 8196
# XXX - Set monitor-base-url = ${monitor-httpd-conf-parameter:url} => https://[ipv6]:port # XXX - Set monitor-base-url = ${install-monitor-apache:monitor-base-url} => https://[ipv6]:port
monitor-base-url = ${monitor-frontend-promise:url} monitor-base-url = ${install-monitor-apache:monitor-base-url}
#monitor-base-url = ${monitor-httpd-conf-parameter:url} #monitor-base-url = ${install-monitor-apache:monitor-base-url-ipv6}
root-instance-title = ${slap-configuration:root-instance-title} root-instance-title = ${slap-configuration:root-instance-title}
monitor-url-list = monitor-url-list =
cors-domains = monitor.app.officejs.com cors-domains = monitor.app.officejs.com
...@@ -387,7 +399,6 @@ context = ...@@ -387,7 +399,6 @@ context =
raw python_bin {{ python_with_eggs }} raw python_bin {{ python_with_eggs }}
config-file = ${directory:etc}/min-free-disk-size config-file = ${directory:etc}/min-free-disk-size
[monitor-base] [monitor-base]
# create dependencies between required monitor parts # create dependencies between required monitor parts
recipe = plone.recipe.command recipe = plone.recipe.command
...@@ -399,14 +410,10 @@ depends = ...@@ -399,14 +410,10 @@ depends =
${monitor-configurator-cron-entry:name} ${monitor-configurator-cron-entry:name}
${cron-entry-logrotate:name} ${cron-entry-logrotate:name}
${logrotate-entry-cron:name} ${logrotate-entry-cron:name}
${certificate-authority:wrapper}
${monitor-conf:rendered} ${monitor-conf:rendered}
${start-monitor:wrapper-path} ${start-monitor:wrapper-path}
${ca-monitor-httpd:wrapper}
${monitor-httpd-promise:filename}
${monitor-bootstrap-promise:file} ${monitor-bootstrap-promise:file}
${promise-check-slapgrid:output} ${promise-check-slapgrid:output}
${promise-monitor-httpd-is-process-older-than-dependency-set:wrapper-path}
[monitor-publish] [monitor-publish]
monitor-base-url = ${monitor-publish-parameters:monitor-base-url} monitor-base-url = ${monitor-publish-parameters:monitor-base-url}
......
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