Commit 59966611 authored by Alain Takoudjou's avatar Alain Takoudjou

slaprunner: fix resiliency test, add development-mode (bool) parameter for...

slaprunner: fix resiliency test, add development-mode (bool) parameter for easy build webrunner in webrunner
parent 3514553b
...@@ -47,14 +47,14 @@ parts = ...@@ -47,14 +47,14 @@ parts =
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
md5sum = bb7e0bf9959c4437ff1e23e645315ccf md5sum = 37fe35675039e29c20838aedb8005fd0
mode = 0644 mode = 0644
[template-runner] [template-runner]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner.cfg url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg.in output = ${buildout:directory}/template-runner.cfg.in
md5sum = 5fbdf6f9996d6cb948ba042e9dd6e43e md5sum = e0661b2532ecd36a56f18b7390d25599
mode = 0644 mode = 0644
[template-runner-import-script] [template-runner-import-script]
...@@ -101,7 +101,7 @@ recipe = hexagonit.recipe.download ...@@ -101,7 +101,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true ignore-existing = true
url = ${:_profile_base_location_}/instance-resilient-test.cfg.jinja2 url = ${:_profile_base_location_}/instance-resilient-test.cfg.jinja2
download-only = true download-only = true
md5sum = fb8c45e5c35548331fb06c4633ec592a md5sum = 51248bb1bbf54ad11d0674ba40be18b4
filename = instance-resilient-test.cfg.jinja2 filename = instance-resilient-test.cfg.jinja2
mode = 0644 mode = 0644
......
...@@ -42,8 +42,8 @@ mode = 755 ...@@ -42,8 +42,8 @@ mode = 755
# Used to manually run the resilient test if we don't have a running testnode. # Used to manually run the resilient test if we don't have a running testnode.
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
test-suite-title = slaprunner test-suite-title = slaprunner
command-line = {{ bin_directory }}/runStandaloneResiliencyTestSuite --test-suite-title=${:test-suite-title} ${deploy-scalability-test:test-parameters} command-line = {{ bin_directory }}/runStandaloneResiliencyTest --test-suite-title=${:test-suite-title} ${deploy-scalability-test:test-parameters}
wrapper-path = ${directory:bin}/runStandaloneResiliencyTestSuite wrapper-path = ${directory:bin}/runStandaloneResiliencyTest
[request-resilient-instance] [request-resilient-instance]
<= slap-connection <= slap-connection
...@@ -57,10 +57,11 @@ config-{{ key }} = {{ dumps(value) }} ...@@ -57,10 +57,11 @@ config-{{ key }} = {{ dumps(value) }}
config-resiliency-backup-periodicity = */10 * * * * config-resiliency-backup-periodicity = */10 * * * *
config-resilient-clone-number = 1 config-resilient-clone-number = 1
config-ignore-known-hosts-file = true config-ignore-known-hosts-file = true
config-development-mode = {{ slapparameter_dict.get('development-mode', '') }}
# XXX hardcoded # XXX hardcoded
#config-frontend-domain = google.com #config-frontend-domain = google.com
# XXX Hack to deploy Root Instance on the same computer as the type-test Instance # XXX Hack to deploy Root Instance on the same computer as the type-test Instance
sla-computer_guid = ${slap-connection:computer-id} sla-computer_guid = ${slap-connection:computer-id}
return = backend_url return = backend-url
[slap-parameter] [slap-parameter]
{% set runner_port = 50005 -%}
  • I don't like introduce special parameters like this w/o actual meaning for a production instance. We often take this decision, to avoid resolve dynamicaly the conflicts.

    I prefer all ports work are dynamic selected from a range, like the one @Nicolas already implemented on his branch for resilience. Please rework this patch to replace this development mode by dynamic port selection.

    I don't like use software types and parameters to differ real and test environment. Let's solve the problems with code, it prevent us to document yet another parameters.

  • Hello,

    Indeed I've been working on a new buildout recipe to select a port from a range, only if it's free. The recipe loops from the lowest port number of the range to the highest one, which give always the same result for the same deployment case (for exemple, for a webrunner deployed on a bare slapos node, the SSHD service will always run on port 22222) : free_port buildout recipe.

    To prevent race condition in the case of developping the webrunner inside a webrunner (iow, runner-exporter and runner-importer share the same IP), I use different port ranges for any service running both in exporter and importer. For exemple, in the resilient stack : pbsready-export.cfg.in and pbsready-import.cfg.in. (It seems it works well without always defining different port ranges for different instances, but I should apply this policy everywhere to prevent bad surprises later).

    As we are using potentially a wider range of ports than before, review should focus on "could it possibly use a port from a standard service, as zope server, bdd server, ...".

    The advantages are :

    • anyone can deploy a webrunner and develop it, without reading document/readme first (because nobody does). Single-click-deployment.
    • the deployment recipe is more dynamic : I can deploy a webrunner into a webrunner into a webrunner. Useful if I need to fix slapos.core into my 2 webrunner, to be sure that my new version of webrunner (level 3) deploys correctly.
    • even if there still is a conflict when starting the service, at least we had an opportunity to fix it : there is still an improvement for defining a constant as a port (in that case neither nothing can be done). And eventually the sysadmin can change the value in the .installed.cfg file (when nothing could be done before).

    The disavantages so far:

    • To prevent the port from being recalculated during a "slapos node instance", I read the .intalled.cfg file to see if the recipe was already processed. There should be a cleaner way (but I don't want to save it in yet another file, in a more or less random path).

    Clearly we are going in complete different directions, and we should discuss about which one should be picked before any of us do more work on our respective branch.

  • I think the Nicolas solution is more generic than having a parameter for development mode. I new he had a problem to run webrunner inside webrunner like me but I didn't knew he was working on a solution for it. I did this commit quickly to simplify the development of webrunner recipe because it was always hard to have everything running without port conflict. I will just revert my commit and let Nicolas merge his one changes as he has something already working.

Please register or sign in to reply
{% set proxy_port = 50000 -%}
{% set dropbear_port = 22222 -%}
{% set supervisord_port = 39986 -%}
{% set runner_http_port = 9686 -%}
{% set monitor_http_port = 8386 -%}
{% set runner_software_type_list = ['runner-export', 'runner', 'default'] -%}
{% if slapparameter_dict.get('development-mode', '') == 'true' -%}
{% if slap_software_type in runner_software_type_list -%}
{% set runner_port = 50025 -%}
{% set proxy_port = 50020 -%}
{% set dropbear_port = 22242 -%}
{% set supervisord_port = 39996 -%}
{% set runner_http_port = 9696 -%}
{% set monitor_http_port = 8396 -%}
{% elif slap_software_type == 'runner-import' -%}
{% set runner_port = 50026 -%}
{% set proxy_port = 50021 -%}
{% set dropbear_port = 22243 -%}
{% set supervisord_port = 39997 -%}
{% set runner_http_port = 9697 -%}
{% set monitor_http_port = 8397 -%}
{% endif -%}
{% endif -%}
[buildout] [buildout]
parts = parts =
nginx_conf nginx_conf
...@@ -141,8 +167,8 @@ private_key = $${sshkeys-dropbear-runner:private-key} ...@@ -141,8 +167,8 @@ private_key = $${sshkeys-dropbear-runner:private-key}
ipv4 = $${slap-network-information:local-ipv4} ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6} ipv6 = $${slap-network-information:global-ipv6}
instance_root = $${runnerdirectory:instance-root} instance_root = $${runnerdirectory:instance-root}
proxy_port = 50000 proxy_port = {{ proxy_port }}
runner_port = 50005 runner_port = {{ runner_port }}
partition-amount = $${slap-parameter:instance-amount} partition-amount = $${slap-parameter:instance-amount}
wrapper = $${directory:services}/slaprunner wrapper = $${directory:services}/slaprunner
debug = $${slap-parameter:debug} debug = $${slap-parameter:debug}
...@@ -212,7 +238,7 @@ keygen-binary = ${dropbear:location}/bin/dropbearkey ...@@ -212,7 +238,7 @@ keygen-binary = ${dropbear:location}/bin/dropbearkey
[dropbear-runner-server] [dropbear-runner-server]
recipe = slapos.cookbook:dropbear recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
port = 22222 port = {{ dropbear_port }}
home = $${buildout:directory} home = $${buildout:directory}
wrapper = $${directory:bin}/runner_sshd wrapper = $${directory:bin}/runner_sshd
shell = ${bash:location}/bin/bash shell = ${bash:location}/bin/bash
...@@ -542,12 +568,12 @@ auto-deploy-instance = true ...@@ -542,12 +568,12 @@ auto-deploy-instance = true
autorun = false autorun = false
slaprunner-httpd-port = $${:monitor-port} slaprunner-httpd-port = $${:monitor-port}
# XXX - for backward compatibility, monitor-port was for slaprunner httpd server # XXX - for backward compatibility, monitor-port was for slaprunner httpd server
monitor-port = 9686 monitor-port = {{ runner_http_port }}
instance-name = instance-name =
monitor-cors-domains = monitor-cors-domains =
monitor-interface-url = monitor-interface-url =
# XXX - define a new port for monitor here and use monitor-port for backward compatibility # XXX - define a new port for monitor here and use monitor-port for backward compatibility
monitor-httpd-port = 8386 monitor-httpd-port = {{ monitor_http_port }}
[monitor-parameters] [monitor-parameters]
port = $${slap-parameter:monitor-port} port = $${slap-parameter:monitor-port}
...@@ -671,7 +697,7 @@ numprocs = 1 ...@@ -671,7 +697,7 @@ numprocs = 1
path = $${shell:path} path = $${shell:path}
pidfile = $${directory:run}/supervisord.pid pidfile = $${directory:run}/supervisord.pid
server = $${slaprunner:ipv4}:$${:port} server = $${slaprunner:ipv4}:$${:port}
port = 39986 port = {{ supervisord_port }}
slapgrid-cp = slapgrid-cp slapgrid-cp = slapgrid-cp
slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log} slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log}
slapgrid-cp-log = $${runnerdirectory:home}/instance.log slapgrid-cp-log = $${runnerdirectory:home}/instance.log
......
...@@ -26,6 +26,7 @@ context = key buildout buildout:bin-directory ...@@ -26,6 +26,7 @@ context = key buildout buildout:bin-directory
key develop_eggs_directory buildout:develop-eggs-directory key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory key eggs_directory buildout:eggs-directory
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key slap_software_type slap-configuration:slap-software-type
raw curl_executable_location ${curl:location}/bin/curl raw curl_executable_location ${curl:location}/bin/curl
raw dash_executable_location ${dash:location}/bin/dash raw dash_executable_location ${dash:location}/bin/dash
raw dcron_executable_location ${dcron:location}/sbin/crond raw dcron_executable_location ${dcron:location}/sbin/crond
......
...@@ -69,7 +69,7 @@ mode = 0644 ...@@ -69,7 +69,7 @@ mode = 0644
[template-replicated] [template-replicated]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/template-replicated.cfg.in url = ${:_profile_base_location_}/template-replicated.cfg.in
md5sum = 7a6234465ae845cb262d4f94c158764e md5sum = e66b3f2316ac58348c35541b939b5656
mode = 0644 mode = 0644
destination = ${buildout:directory}/template-replicated.cfg.in destination = ${buildout:directory}/template-replicated.cfg.in
......
...@@ -90,6 +90,10 @@ config-number = {{id}} ...@@ -90,6 +90,10 @@ config-number = {{id}}
config-name = {{namebase}}{{id}} config-name = {{namebase}}{{id}}
config-authorized-key = ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key} config-authorized-key = ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${:pbs-notification-id} config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${:pbs-notification-id}
# set development mode
{% if slapparameter_dict.has_key('development-mode') -%}
config-development-mode = {{ slapparameter_dict.get('development-mode') }}
{% endif -%}
{% for key, value in monitor_dict.iteritems() -%} {% for key, value in monitor_dict.iteritems() -%}
config-{{ key }} = {{ value }} config-{{ key }} = {{ value }}
{% endfor -%} {% endfor -%}
......
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