Commit ad71146a authored by Alain Takoudjou's avatar Alain Takoudjou

slaprunner resilient: fix monitor parameters propagation to instance import, export and pbs

parent 1e553524
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
# not need these here). # not need these here).
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 78e4c796b15a9c5b9b41c79a3c995ee7 md5sum = 713db528880282d568278f09458d2aab
[template-runner] [template-runner]
filename = instance-runner.cfg filename = instance-runner.cfg
md5sum = 605d7821234ded60e4651fbe25a41a5a md5sum = 8f49df215a1596efcec94e2cca009711
[template-runner-import-script] [template-runner-import-script]
filename = template/runner-import.sh.jinja2 filename = template/runner-import.sh.jinja2
...@@ -27,7 +27,7 @@ md5sum = 3be3ff484a5aaa202f2ea72489a73285 ...@@ -27,7 +27,7 @@ md5sum = 3be3ff484a5aaa202f2ea72489a73285
[instance-runner-import] [instance-runner-import]
filename = instance-runner-import.cfg.in filename = instance-runner-import.cfg.in
md5sum = 44c029ac2e30930d3017fb9503a77e36 md5sum = 5cfa49bcf20612844e1c50a85740d0b3
[template-runner-export-script] [template-runner-export-script]
filename = template/runner-export.sh.jinja2 filename = template/runner-export.sh.jinja2
...@@ -35,7 +35,7 @@ md5sum = ef87691a9675beb646ae1c99ef69e551 ...@@ -35,7 +35,7 @@ md5sum = ef87691a9675beb646ae1c99ef69e551
[instance-runner-export] [instance-runner-export]
filename = instance-runner-export.cfg.in filename = instance-runner-export.cfg.in
md5sum = 22a5dfe9bfc8533f8eab851e0996a6d7 md5sum = 00ddcaa6e571505d1930612d12de8fde
[template-resilient] [template-resilient]
filename = instance-resilient.cfg.jinja2 filename = instance-resilient.cfg.jinja2
......
...@@ -79,14 +79,14 @@ output = ${buildout:directory}/template-runner.cfg.in ...@@ -79,14 +79,14 @@ output = ${buildout:directory}/template-runner.cfg.in
< = template-download-base < = template-download-base
filename = runner-import.sh.jinja2 filename = runner-import.sh.jinja2
[instance-runner-import]
< = template-base
output = ${buildout:directory}/instance-runner-import.cfg
[template-runner-export-script] [template-runner-export-script]
< = template-download-base < = template-download-base
filename = runner-export.sh.jinja2 filename = runner-export.sh.jinja2
[instance-runner-import]
< = download-base
recipe = slapos.recipe.build:download
[instance-runner-export] [instance-runner-export]
< = download-base < = download-base
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
......
...@@ -84,11 +84,25 @@ minimum = 8437 ...@@ -84,11 +84,25 @@ minimum = 8437
maximum = 8446 maximum = 8446
ip = ${slap-network-information:global-ipv6} ip = ${slap-network-information:global-ipv6}
# XXX Redefine Monitor parameters for runner-export
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-httpd-port = ${monitor-httpd-free-port:port} monitor-httpd-port = ${monitor-httpd-free-port:port}
# Pass some parameter to dispay in monitoring interface {% if slapparameter_dict.get('name', '') -%}
monitor-title = {{ slapparameter_dict['name'] }}
{% endif -%}
cors-domains = {{ slapparameter_dict.get('monitor-cors-domains', 'monitor.app.officejs.com') }}
{% if slapparameter_dict.get('monitor-username', '') -%}
username = {{ slapparameter_dict['monitor-username'] }}
{% endif -%}
{% if slapparameter_dict.get('monitor-password', '') -%}
password = {{ slapparameter_dict['monitor-password'] }}
{% endif -%}
{% if slapparameter_dict.get('monitor-url-list', '') -%}
monitor-url-list = {{ slapparameter_dict['monitor-url-list'] }}
{% endif -%}
instance-configuration = instance-configuration =
httpdcors cors-domain ${slaprunner-httpd-cors:location} ${httpd-graceful-wrapper:output} httpdcors cors-domain ${slaprunner-httpd-cors:location} ${httpd-graceful-wrapper:output}
configuration-file-path = ${buildout:directory}/knowledge0.cfg
# Extends publish section with resilient parameters # Extends publish section with resilient parameters
[publish-connection-information] [publish-connection-information]
......
[buildout] [buildout]
extends = template-runner.cfg extends = {{ template_runner_path }}
${pbsready-import:output} {{ pbsready_import_template_path }}
parts += parts +=
nginx_conf nginx_conf
...@@ -42,26 +42,26 @@ parts += ...@@ -42,26 +42,26 @@ parts +=
recipe = slapos.cookbook:free_port recipe = slapos.cookbook:free_port
minimum = 49990 minimum = 49990
maximum = 49999 maximum = 49999
ip = $${slap-network-information:local-ipv4} ip = ${slap-network-information:local-ipv4}
[runner-free-port] [runner-free-port]
recipe = slapos.cookbook:free_port recipe = slapos.cookbook:free_port
minimum = 50015 minimum = 50015
maximum = 50024 maximum = 50024
ip = $${slap-network-information:global-ipv6} ip = ${slap-network-information:global-ipv6}
[slaprunner] [slaprunner]
proxy_port = $${proxy-free-port:port} proxy_port = ${proxy-free-port:port}
runner_port = $${runner-free-port:port} runner_port = ${runner-free-port:port}
[supervisord-free-port] [supervisord-free-port]
recipe = slapos.cookbook:free_port recipe = slapos.cookbook:free_port
minimum = 39996 minimum = 39996
maximum = 40005 maximum = 40005
ip = $${slaprunner:ipv4} ip = ${slaprunner:ipv4}
[supervisord] [supervisord]
port = $${supervisord-free-port:port} port = ${supervisord-free-port:port}
[runner-sshd-port] [runner-sshd-port]
minimum = 22232 minimum = 22232
...@@ -74,14 +74,14 @@ recipe = ...@@ -74,14 +74,14 @@ recipe =
[importer] [importer]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${template-runner-import-script:location}/${template-runner-import-script:filename} template = {{ importer_script_path }}
rendered = $${directory:bin}/$${slap-parameter:namebase}-importer rendered = ${directory:bin}/${slap-parameter:namebase}-importer
# backward compatibility for resilient stack # backward compatibility for resilient stack
wrapper = $${:rendered} wrapper = ${:rendered}
mode = 700 mode = 700
restore-exit-code-file = $${directory:srv}/$${:restore-exit-code-file-basename} restore-exit-code-file = ${directory:srv}/${:restore-exit-code-file-basename}
restore-exit-code-file-basename = importer-exit-code-file restore-exit-code-file-basename = importer-exit-code-file
restore-error-message-file = $${directory:srv}/$${:restore-error-message-file-basename} restore-error-message-file = ${directory:srv}/${:restore-error-message-file-basename}
restore-error-message-file-basename = importer-error-message-file restore-error-message-file-basename = importer-error-message-file
resilient-log-basename = resilient.log resilient-log-basename = resilient.log
context = context =
...@@ -94,20 +94,20 @@ context = ...@@ -94,20 +94,20 @@ context =
key instance_folder slaprunner:instance_root key instance_folder slaprunner:instance_root
section directory directory section directory directory
section supervisord supervisord section supervisord supervisord
raw output_log_file $${directory:log}/$${:resilient-log-basename} raw output_log_file ${directory:log}/${:resilient-log-basename}
raw shell_binary ${bash:location}/bin/bash raw shell_binary {{ bash_executable_location }}
raw rsync_binary ${rsync:location}/bin/rsync raw rsync_binary {{ rsync_executable_location }}
raw restore_exit_code_file $${:restore-exit-code-file} raw restore_exit_code_file ${:restore-exit-code-file}
raw restore_error_message_file $${:restore-error-message-file} raw restore_error_message_file ${:restore-error-message-file}
[importer-consistency-promise] [importer-consistency-promise]
# Test that the importer script and "after-import" subscripts # Test that the importer script and "after-import" subscripts
# are not older than 2 days (1 day + some slack), and have succeeded # are not older than 2 days (1 day + some slack), and have succeeded
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline: #!/bin/sh input = inline: #!/bin/sh
EXIT_CODE_FILE="$${importer:restore-exit-code-file}" EXIT_CODE_FILE="${importer:restore-exit-code-file}"
RECENT_EXIT_CODE_FILE=$(find $${directory:srv} -maxdepth 1 -name "$${importer:restore-exit-code-file-basename}" -mtime -2) RECENT_EXIT_CODE_FILE=$(find ${directory:srv} -maxdepth 1 -name "${importer:restore-exit-code-file-basename}" -mtime -2)
RESILIENT_LOG_URL=$${monitor-publish-parameters:monitor-base-url}/log/$${importer:resilient-log-basename} RESILIENT_LOG_URL=${monitor-publish-parameters:monitor-base-url}/log/${importer:resilient-log-basename}
if [ ! -f "$EXIT_CODE_FILE" ]; then if [ ! -f "$EXIT_CODE_FILE" ]; then
exit 0; exit 0;
else else
...@@ -115,25 +115,25 @@ input = inline: #!/bin/sh ...@@ -115,25 +115,25 @@ input = inline: #!/bin/sh
echo "Consistency check is too old."; echo "Consistency check is too old.";
exit 1; exit 1;
else else
if [ -f "$${importer:restore-error-message-file}" ]; then if [ -f "${importer:restore-error-message-file}" ]; then
cat $${importer:restore-error-message-file} cat ${importer:restore-error-message-file}
fi fi
echo "More information can be found here : $RESILIENT_LOG_URL"; echo "More information can be found here : $RESILIENT_LOG_URL";
exit $(cat $EXIT_CODE_FILE); exit $(cat $EXIT_CODE_FILE);
fi fi
fi fi
exit 1; # Something else went wrong exit 1; # Something else went wrong
output = $${directory:promises}/importer-consistency-promise output = ${directory:promises}/importer-consistency-promise
mode = 755 mode = 755
[software-release-deployment-promise] [software-release-deployment-promise]
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline: #!/bin/sh input = inline: #!/bin/sh
PROJECT_FILE=$(find "$${directory:etc}" -maxdepth 1 -name .project) PROJECT_FILE=$(find "${directory:etc}" -maxdepth 1 -name .project)
if [ -z "$PROJECT_FILE" ]; then if [ -z "$PROJECT_FILE" ]; then
exit 0; exit 0;
else else
INSTALLATION_FILE=$(find "$${runnerdirectory:software-root}" -mindepth 2 -maxdepth 2 -name .completed) INSTALLATION_FILE=$(find "${runnerdirectory:software-root}" -mindepth 2 -maxdepth 2 -name .completed)
if [ -n "$INSTALLATION_FILE" ]; then if [ -n "$INSTALLATION_FILE" ]; then
exit 0; exit 0;
else else
...@@ -141,41 +141,41 @@ input = inline: #!/bin/sh ...@@ -141,41 +141,41 @@ input = inline: #!/bin/sh
fi fi
fi fi
exit 1 exit 1
output = $${directory:promises}/software-release-deployment-promise output = ${directory:promises}/software-release-deployment-promise
mode = 755 mode = 755
[resilient-software-release-information] [resilient-software-release-information]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename} url = {{ software_release_information_template }}
output = $${directory:cgi-bin}/resilient_software_release_information.py output = ${directory:cgi-bin}/resilient_software_release_information.py
resilient-log-url = $${monitor-publish-parameters:monitor-base-url}/log/$${importer:resilient-log-basename} resilient-log-url = ${monitor-publish-parameters:monitor-base-url}/log/${importer:resilient-log-basename}
mode = 0600 mode = 0600
[slap-parameter] [slap-parameter]
auto-deploy-instance = false auto-deploy-instance = false
auto-deploy = true auto-deploy = true
name = Webrunner import
monitor-cors-domains =
monitor-username = $${monitor-instance-parameter:username}
monitor-password = $${monitor-htpasswd:passwd}
[resilient-publish-connection-parameter] [resilient-publish-connection-parameter]
monitor-base-url = $${monitor-publish-parameters:monitor-base-url} 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-instance-parameter] [monitor-instance-parameter]
monitor-httpd-port = 8360 monitor-httpd-port = 8360
#monitor-title = $${slap-parameter:name} monitor-title = {{ slapparameter_dict.get('name', 'Webrunner import') }}
#cors-domains = $${slap-parameter:monitor-cors-domains} cors-domains = {{ slapparameter_dict.get('monitor-cors-domains', 'monitor.app.officejs.com') }}
#username = $${slap-parameter:monitor-username} {% if slapparameter_dict.get('monitor-username', '') -%}
#password = $${slap-parameter:monitor-password} username = {{ slapparameter_dict['monitor-username'] }}
# Pass some parameter to dispay in monitoring interface {% endif -%}
{% if slapparameter_dict.get('monitor-password', '') -%}
password = {{ slapparameter_dict['monitor-password'] }}
{% endif -%}
instance-configuration = instance-configuration =
raw takeover-url http://[$${resilient-web-takeover-httpd-configuration-file:listening-ip}]:$${resilient-web-takeover-httpd-configuration-file:listening-port}/ raw takeover-url http://[${resilient-web-takeover-httpd-configuration-file:listening-ip}]:${resilient-web-takeover-httpd-configuration-file:listening-port}/
raw takeover-password $${resilient-web-takeover-password:passwd} raw takeover-password ${resilient-web-takeover-password:passwd}
configuration-file-path = ${buildout:directory}/knowledge0.cfg
[monitor-conf-parameters] [monitor-conf-parameters]
private-path-list += private-path-list +=
$${directory:logrotate-backup} ${directory:logrotate-backup}
...@@ -809,12 +809,8 @@ password = $${runner-htpasswd:password} ...@@ -809,12 +809,8 @@ password = $${runner-htpasswd:password}
{% if slapparameter_dict.get('monitor-url-list', '') -%} {% if slapparameter_dict.get('monitor-url-list', '') -%}
monitor-url-list = {{ slapparameter_dict['monitor-url-list'] }} monitor-url-list = {{ slapparameter_dict['monitor-url-list'] }}
{% endif -%} {% endif -%}
# check if not resilient runner
{% if not slapparameter_dict.get('authorized-key', '') -%}
# Pass some parameter to dispay in monitoring interface
instance-configuration = instance-configuration =
httpdcors cors-domain $${slaprunner-httpd-cors:location} $${httpd-graceful-wrapper:output} httpdcors cors-domain $${slaprunner-httpd-cors:location} $${httpd-graceful-wrapper:output}
{% endif -%}
configuration-file-path = $${buildout:directory}/knowledge0.cfg configuration-file-path = $${buildout:directory}/knowledge0.cfg
[monitor-check-webrunner-internal-instance] [monitor-check-webrunner-internal-instance]
......
...@@ -12,7 +12,7 @@ recipe = slapos.cookbook:softwaretype ...@@ -12,7 +12,7 @@ recipe = slapos.cookbook:softwaretype
default = $${instance-base-runner:rendered} default = $${instance-base-runner:rendered}
resilient = $${instance-resilient:rendered} resilient = $${instance-resilient:rendered}
runner = $${instance-base-runner:rendered} runner = $${instance-base-runner:rendered}
runner-import = ${instance-runner-import:output} runner-import = $${template-runner-import:rendered}
runner-export = $${template-runner-export:rendered} runner-export = $${template-runner-export:rendered}
frozen = ${instance-frozen:output} frozen = ${instance-frozen:output}
...@@ -55,6 +55,7 @@ mode = 640 ...@@ -55,6 +55,7 @@ mode = 640
context = context =
key pbsready_export_template_path template-pbsready-export:rendered key pbsready_export_template_path template-pbsready-export:rendered
key template_runner_path instance-base-runner:rendered key template_runner_path instance-base-runner:rendered
key slapparameter_dict slap-configuration:configuration
raw backup_wait_time ${exporter-default-configuration:backup_wait_time} raw backup_wait_time ${exporter-default-configuration:backup_wait_time}
raw exporter_script_path ${template-runner-export-script:location}/${template-runner-export-script:filename} raw exporter_script_path ${template-runner-export-script:location}/${template-runner-export-script:filename}
raw monitor_check_resilient_feed_template_path ${template-monitor-check-resilient-feed:location}/${template-monitor-check-resilient-feed:filename} raw monitor_check_resilient_feed_template_path ${template-monitor-check-resilient-feed:location}/${template-monitor-check-resilient-feed:filename}
...@@ -62,6 +63,21 @@ context = ...@@ -62,6 +63,21 @@ context =
raw bash_executable_location ${bash:location}/bin/bash raw bash_executable_location ${bash:location}/bin/bash
raw rsync_executable_location ${rsync:location}/bin/rsync raw rsync_executable_location ${rsync:location}/bin/rsync
[template-runner-import]
recipe = slapos.recipe.template:jinja2
template = ${instance-runner-import:target}
rendered = $${buildout:directory}/instance-runner-import.cfg
mode = 640
context =
key template_runner_path instance-base-runner:rendered
key slapparameter_dict slap-configuration:configuration
raw importer_script_path ${template-runner-import-script:location}/${template-runner-import-script:filename}
raw buildout_executable_location ${buildout:executable}
raw bash_executable_location ${bash:location}/bin/bash
raw rsync_executable_location ${rsync:location}/bin/rsync
raw pbsready_import_template_path ${pbsready-import:output}
raw software_release_information_template ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename}
[slap-configuration] [slap-configuration]
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id} computer = $${slap-connection:computer-id}
......
...@@ -27,7 +27,7 @@ md5sum = c6c11db5372150019debb1ce519b907d ...@@ -27,7 +27,7 @@ md5sum = c6c11db5372150019debb1ce519b907d
[template-pull-backup] [template-pull-backup]
filename = instance-pull-backup.cfg.in filename = instance-pull-backup.cfg.in
md5sum = 2727a34b7c67f6aa4f1aef0acc5ee18d md5sum = fe4811540683bfcfac5ac12de084b623
[template-replicated] [template-replicated]
filename = template-replicated.cfg.in filename = template-replicated.cfg.in
......
...@@ -260,11 +260,6 @@ parameters-extra = true ...@@ -260,11 +260,6 @@ parameters-extra = true
#---------------- #----------------
#-- #--
#-- Slave instance list (empty default). #-- Slave instance list (empty default).
[htpasswd]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:etc}/.monitor_user
bytes = 8
username = admin
[slap-parameter] [slap-parameter]
slave_instance_list = [] slave_instance_list = []
...@@ -272,8 +267,8 @@ ignore-known-hosts-file = false ...@@ -272,8 +267,8 @@ ignore-known-hosts-file = false
monitor-cors-domains = monitor-cors-domains =
monitor-httpd-port = 8070 monitor-httpd-port = 8070
monitor-title = PBS Instance monitor-title = PBS Instance
monitor-password = $${htpasswd:passwd} monitor-password = $${monitor-htpasswd:passwd}
monitor-username = $${htpasswd:username} monitor-username = admin
#---------------- #----------------
#-- #--
......
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