cluster.cfg.in 2.7 KB
Newer Older
Vincent Pelletier's avatar
Vincent Pelletier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
{% if slap_software_type not in (
    mysql_storage_software_type,
    admin_software_type,
) -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set part_list = [] -%}
{% set master_list = [] -%}
{% set admin_list = [] -%}
[request-common]
recipe = slapos.cookbook:request
software-url = ${slap-connection:software-release-url}
sla = computer_guid
sla-computer_guid = ${slap-connection:computer-id}
server-url = ${slap-connection:server-url}
key-file = ${slap-connection:key-file}
cert-file = ${slap-connection:cert-file}
computer-id = ${slap-connection:computer-id}
partition-id = ${slap-connection:partition-id}
config-cluster = {{ slapparameter_dict['cluster'] }}
config-partitions = {{ slapparameter_dict.get('partitions', 12) }}
config-replicas = {{ slapparameter_dict.get('replicas', 0) }}
config-verbose = {{ dumps(slapparameter_dict.get('verbose', 0)) }}

[request-config]
base = cluster verbose
master = partitions replicas
node = masters

[node-base]
< = request-common
config = ${request-config:base} ${request-config:node}
config-masters = ${all-masters:addresses}

[mysql-storage-base]
< = request-common
config = ${request-config:base} ${request-config:master}
software-type = {{ mysql_storage_software_type }}

[mysql-storage-request-base]
< = mysql-storage-base
return = master

[admin-base]
< = node-base
return = admin
software-type = {{ admin_software_type }}

[publish]
recipe = slapos.cookbook:publish
masters = ${all-masters:addresses}
admins = ${all-admins:addresses}

{% for node_number in range(slapparameter_dict.get('mysql-storage-count', 1)) -%}
{%   set section_id = 'storage-%i' % (node_number, ) -%}
{%   set final_section_id = 'final-' ~ section_id -%}
{%   do master_list.append(section_id) -%}
[{{ section_id }}]
< = mysql-storage-request-base
name = {{ section_id }}

[{{ section(final_section_id) }}]
< = mysql-storage-base
	node-base
name = {{ section_id }}
config = ${request-config:base} ${request-config:master} ${request-config:node}

{% endfor -%}
{% for node_number in range(slapparameter_dict.get('admin-count', 1)) -%}
{%   set section_id = 'admin-%i' % (node_number, ) -%}
{%   do admin_list.append(section_id)%}
[{{ section(section_id) }}]
< = admin-base
name = {{ section_id }}

{% endfor -%}
[buildout]
parts = 
	{{ part_list | join('\n\t') }}
	publish
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true

[all-masters]
addresses = {% for master in master_list -%}
{{   '${' + master + ':connection-master}' -}}
{%   if not loop.last %} {% endif -%}
{% endfor %}

[all-admins]
addresses = {% for admin in admin_list -%}
{{  '${' + admin + ':connection-admin}' -}}
{%  if not loop.last %} {% endif -%}
{% endfor %}
{% endif -%}