Commit 2025705b authored by Tristan Cavelier's avatar Tristan Cavelier

cloudooo: allow to configure the software

parent a7296367
{% set ipv4 = (ipv4_set | list)[0] -%} {% set ipv4 = (ipv4_set | list)[0] -%}
{% if ipv6_set %}{% set ipv6 = (ipv6_set | list)[0] %}{% endif -%} {% if ipv6_set %}{% set ipv6 = (ipv6_set | list)[0] %}{% endif -%}
{% set next_port = slapparameter_dict.get('tcpv4-port', 8000) | int -%} {% set instance_parameter_dict = parameter_dict['instance-parameter-dict'] -%}
{% set backend_count = slapparameter_dict.get('backend-count', 1) | int -%} {% macro assert(x) %}{{ ("",)[not x] }}{% endmacro -%}
{% set ssl_parameter_dict = slapparameter_dict.get('ssl', {}) %}
{% set publish_url_name = instance_parameter_dict.get('publish-url-name') or 'url' -%}
{% set next_port = instance_parameter_dict['port'] | int -%}
{% if instance_parameter_dict.get('port-parameter-name') -%}
{% set next_port = slapparameter_dict.get(instance_parameter_dict['port-parameter-name'], next_port) | int -%}
{% endif -%}
{% do assert(next_port > 0) -%}
{% set backend_count = instance_parameter_dict['backend-count'] | int -%}
{% if instance_parameter_dict.get('backend-count-parameter-name') -%}
{% set backend_count = slapparameter_dict.get(instance_parameter_dict['backend-count-parameter-name'], backend_count) | int -%}
{% endif -%}
{% do assert(backend_count > 0) -%}
{% set ssl_parameter_dict = instance_parameter_dict.get('ssl', {}) %}
{% if instance_parameter_dict.get('ssl-dict-parameter-name') -%}
{% set ssl_parameter_dict = slapparameter_dict.get(instance_parameter_dict['ssl-dict-parameter-name'], ssl_parameter_dict) -%}
{% endif -%}
{% set apache_port = next_port -%} {% set apache_port = next_port -%}
{% set haproxy_port = next_port + 1 -%} {% set haproxy_port = next_port + 1 -%}
...@@ -13,7 +31,7 @@ ...@@ -13,7 +31,7 @@
{% do apache_ip_list.append('[' ~ ipv6 ~ ']') -%} {% do apache_ip_list.append('[' ~ ipv6 ~ ']') -%}
{% endif -%} {% endif -%}
{% set apache_dict = {} -%} {% set apache_dict = {} -%}
{% do apache_dict.__setitem__("cloudooo", (apache_port, "https", 'http://' ~ ipv4 ~ ':' ~ haproxy_port)) -%} {% do apache_dict.__setitem__(publish_url_name, (apache_port, "https", 'http://' ~ ipv4 ~ ':' ~ haproxy_port)) -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{% set section_list = [] -%} {% set section_list = [] -%}
......
...@@ -42,6 +42,7 @@ glib = {{ glib_location }} ...@@ -42,6 +42,7 @@ glib = {{ glib_location }}
glu = {{ glu_location }} glu = {{ glu_location }}
haproxy = {{ haproxy_location }} haproxy = {{ haproxy_location }}
imagemagick = {{ imagemagick_location }} imagemagick = {{ imagemagick_location }}
instance-parameter-dict = {{ dumps(cloudooo_parameter_dict) }}
libICE = {{ libICE_location }} libICE = {{ libICE_location }}
libSM = {{ libSM_location }} libSM = {{ libSM_location }}
libX11 = {{ libX11_location }} libX11 = {{ libX11_location }}
......
[cloudooo-software-parameter-dict]
publish-url-name = cloudooo
port-parameter-name = tcpv4-port
port = 8000
backend-count-parameter-name = backend-count
backend-count = 1
ssl-dict-parameter-name = ssl
#ssl-dict =
[buildout] [buildout]
extends = extends =
../../stack/cloudooo.cfg ../../stack/cloudooo.cfg
...@@ -31,6 +41,7 @@ context = ...@@ -31,6 +41,7 @@ context =
key bin_directory buildout:bin-directory key bin_directory 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
section cloudooo_parameter_dict cloudooo-software-parameter-dict
${:extra-context} ${:extra-context}
[template] [template]
...@@ -38,7 +49,7 @@ context = ...@@ -38,7 +49,7 @@ context =
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 295c1f58e761732fcc430dd5cd6467b1 md5sum = 918c97636fa56768ac01eb20cee6b7bc
extra-context = extra-context =
key apache_location apache:location key apache_location apache:location
key buildout_bin_directory buildout:bin-directory key buildout_bin_directory buildout:bin-directory
...@@ -85,5 +96,5 @@ extra-context = ...@@ -85,5 +96,5 @@ extra-context =
[template-cloudooo] [template-cloudooo]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-cloudoo.cfg.in url = ${:_profile_base_location_}/instance-cloudoo.cfg.in
md5sum = afb0ec2b44baa40814075f917c02aa0d md5sum = 5e8fb5070c873f8405ba72573a68854f
mode = 640 mode = 640
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