Commit a0dae9a4 authored by Xavier Thompson's avatar Xavier Thompson

software/theia: Configure resilient monitoring

Aggregate monitoring URLs from the main theia, clones and PBS.

Also add monitor-setup-url to the parameters published by the PBS.
parent dd5a541a
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
[instance-theia] [instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in _update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum = 8e4f43e603a5dd57752758c987465d41 md5sum = 002ca13ec4923d9efa7a99f58ea7917f
[instance] [instance]
_update_hash_filename_ = instance.cfg.in _update_hash_filename_ = instance.cfg.in
md5sum = a7d78b4002266c69ece05a476df82791 md5sum = 4d8d3a351f17c45048fd3ffaee978875
[instance-import] [instance-import]
_update_hash_filename_ = instance-import.cfg.jinja.in _update_hash_filename_ = instance-import.cfg.jinja.in
...@@ -31,7 +31,7 @@ md5sum = 190a736471f0e0cffcb2838968e01d84 ...@@ -31,7 +31,7 @@ md5sum = 190a736471f0e0cffcb2838968e01d84
[instance-resilient] [instance-resilient]
_update_hash_filename_ = instance-resilient.cfg.jinja _update_hash_filename_ = instance-resilient.cfg.jinja
md5sum = d78a9f885bdebf6720197209e0c21aa0 md5sum = 6f6b88d2802cd5eba6e3d2ebf435813a
[theia-common] [theia-common]
_update_hash_filename_ = theia_common.py _update_hash_filename_ = theia_common.py
......
{% import 'parts' as parts %} {% import 'parts' as parts -%}
{% import 'replicated' as replicated with context %} {% import 'replicated' as replicated with context -%}
{% set number_of_instances = slapparameter_dict.get('resilient-clone-number', 1)|int %} {% set clones_amount = slapparameter_dict.get('resilient-clone-number', 1)|int + 1 -%}
[buildout] [buildout]
eggs-directory = {{ eggs_directory }} eggs-directory = {{ eggs_directory }}
...@@ -11,59 +11,38 @@ extends = ...@@ -11,59 +11,38 @@ extends =
{{ monitor_template }} {{ monitor_template }}
parts += parts +=
# Generate the parts to request theia-export, pull-backup and theia-import publish
# See stack/resilient/template-parts.cfg.in and stack/resilient/template-replicated.cfg.in {#- Generate the parts to request the main theia, the clones and the PBS. #}
# See below for the generation of the sections corresponding to the parts generated here {#- See ../../stack/resilient/template-parts.cfg.in #}
{{ parts.replicate("theia", number_of_instances + 1) }} {{ parts.replicate("theia", clones_amount) }}
# Also publish some connection parameters
publish-connection-parameter
[ArgLeader]
[ArgBackup] {#- Prepare monitoring information to transmit to and request from the main theia, the clones and the PBS #}
{%- set monitor_cors_domains = slapparameter_dict.pop('monitor-cors-domains', 'monitor.app.officejs.com') %}
{%- set monitor_username = slapparameter_dict.get('monitor-username', '${monitor-instance-parameter:username}') %}
{%- set monitor_password = slapparameter_dict.get('monitor-password', '${monitor-htpasswd:passwd}') %}
{%- set monitor_return = ['monitor-base-url', 'monitor-setup-url'] %}
{%- set monitor_parameter = {'monitor-cors-domains': monitor_cors_domains, 'monitor-username' : monitor_username, 'monitor-password': monitor_password} %}
{%- set monitor_dict = {'parameter': monitor_parameter, 'return': monitor_return, 'set-monitor-url': True} %}
# Generate sections to request theia-export, pull-backup and theia-import
# See stack/resilient/template-replicated.cfg.in
# In particular:
#
# [request-theia]
# <= ArgLeader
# software-type = export
# ...
#
# [request-theia-pseudo-replicating-1]
# <= ArgBackup
# software-type = import
# ...
#
# [request-pbs-theia-1]
# software-type = pull-backup
# ...
#
{{ replicated.replicate("theia", number_of_instances + 1,
"export", "import",
"ArgLeader", "ArgBackup",
slapparameter_dict=slapparameter_dict) }}
# Extend the list of return parameters for the export request {# Generate the sections to request the main theia, the clones and the PBS. #}
# The monitor parameters are only there to assert they are {#- See ../../stack/resilient/template-replicated.cfg.in #}
# actually published by the export instance {{ replicated.replicate("theia", clones_amount, "export", "import", slapparameter_dict=slapparameter_dict, monitor_parameter_dict=monitor_dict) }}
# Ask for the connection parameters of the main theia
[request-theia] [request-theia]
return += url username password backend-url monitor-base-url monitor-setup-url return += url username password backend-url
# Extend the list of return parameters for the import request
# with the monitor parameters to assert they are actually published
[request-theia-pseudo-replicating-1]
return += monitor-base-url monitor-setup-url
# Publish some parameters from the export instance # Publish connection parameters of the main theia and resiliency parameters
[publish-connection-parameter] [publish]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
url = ${request-theia:connection-url} url = ${request-theia:connection-url}
username = ${request-theia:connection-username} username = ${request-theia:connection-username}
password = ${request-theia:connection-password} password = ${request-theia:connection-password}
backend-url = ${request-theia:connection-backend-url} backend-url = ${request-theia:connection-backend-url}
monitor-base-url = ${request-theia:connection-monitor-base-url}
# Publish resiliency parameters fetched by the resilient stack monitor-setup-url = ${request-theia:connection-monitor-setup-url}
[publish-connection-parameter]
<= publish-connection-information <= publish-connection-information
...@@ -63,6 +63,25 @@ bash-completions = $${:home}/.local/share/bash-completion/completions/ ...@@ -63,6 +63,25 @@ bash-completions = $${:home}/.local/share/bash-completion/completions/
fish-completions = $${:home}/.config/fish/completions/ fish-completions = $${:home}/.config/fish/completions/
# Monitor
# -------
[monitor-instance-parameter]
monitor-httpd-port = {{ parameter_dict['monitor-httpd-port'] }}
{%- for k in ('monitor-cors-domains', 'monitor-username', 'monitor-password') %}
{%- set v = parameter_dict.get(k) %}
{%- if v %}
{{ k[8:] }} = {{ v }}
{%- endif %}
{%- endfor %}
{%- for k in ('monitor-url-list', ) %}
{%- set v = parameter_dict.get(k) %}
{%- if v %}
{{ k }} = {{ v }}
{%- endif %}
{%- endfor %}
# Promises # Promises
# -------- # --------
......
...@@ -51,7 +51,8 @@ default-parameters = ...@@ -51,7 +51,8 @@ default-parameters =
"additional-frontend-name":"Theia Additional Frontend", "additional-frontend-name":"Theia Additional Frontend",
"additional-frontend-sr": "$${:frontend-sr}", "additional-frontend-sr": "$${:frontend-sr}",
"additional-frontend-sr-type": "RootSoftwareInstance", "additional-frontend-sr-type": "RootSoftwareInstance",
"additional-frontend-guid": null "additional-frontend-guid": null,
"monitor-httpd-port": 8386
} }
frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
......
...@@ -26,7 +26,7 @@ md5sum = 8f15263c4a27ec315eb3a12dbf7a7b34 ...@@ -26,7 +26,7 @@ md5sum = 8f15263c4a27ec315eb3a12dbf7a7b34
[template-pull-backup] [template-pull-backup]
filename = instance-pull-backup.cfg.in filename = instance-pull-backup.cfg.in
md5sum = 4425db50d551fb8a974e547308990bac md5sum = e7674770b85c983244255dd82642ebe8
[template-replicated] [template-replicated]
filename = template-replicated.cfg.in filename = template-replicated.cfg.in
......
...@@ -250,6 +250,7 @@ monitor-base-url = $${monitor-publish-parameters:monitor-base-url} ...@@ -250,6 +250,7 @@ monitor-base-url = $${monitor-publish-parameters:monitor-base-url}
monitor-url = $${monitor-publish-parameters:monitor-url} monitor-url = $${monitor-publish-parameters:monitor-url}
monitor-user = $${monitor-publish-parameters:monitor-user} monitor-user = $${monitor-publish-parameters:monitor-user}
monitor-password = $${monitor-publish-parameters:monitor-password} monitor-password = $${monitor-publish-parameters:monitor-password}
monitor-setup-url = $${monitor-publish:monitor-setup-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