Merge remote-tracking branch 'origin/erp5' into erp5-z2.13
[slapos.git] / software / neoppod / cluster.cfg.in
1 {% if slap_software_type not in (
2     mysql_storage_software_type,
3     admin_software_type,
4 ) -%}
5 {% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
6 {% set part_list = [] -%}
7 {% set master_list = [] -%}
8 {% set admin_list = [] -%}
9 [request-common]
10 recipe = slapos.cookbook:request
11 software-url = ${slap-connection:software-release-url}
12 sla = computer_guid
13 sla-computer_guid = ${slap-connection:computer-id}
14 server-url = ${slap-connection:server-url}
15 key-file = ${slap-connection:key-file}
16 cert-file = ${slap-connection:cert-file}
17 computer-id = ${slap-connection:computer-id}
18 partition-id = ${slap-connection:partition-id}
19 config-cluster = {{ slapparameter_dict['cluster'] }}
20 config-partitions = {{ slapparameter_dict.get('partitions', 12) }}
21 config-replicas = {{ slapparameter_dict.get('replicas', 0) }}
22 config-verbose = {{ dumps(slapparameter_dict.get('verbose', 0)) }}
23
24 [request-config]
25 base = cluster verbose
26 master = partitions replicas
27 node = masters
28
29 [node-base]
30 < = request-common
31 config = ${request-config:base} ${request-config:node}
32 config-masters = ${all-masters:addresses}
33
34 [mysql-storage-base]
35 < = request-common
36 config = ${request-config:base} ${request-config:master}
37 software-type = {{ mysql_storage_software_type }}
38
39 [mysql-storage-request-base]
40 < = mysql-storage-base
41 return = master
42
43 [admin-base]
44 < = node-base
45 return = admin
46 software-type = {{ admin_software_type }}
47
48 [publish]
49 recipe = slapos.cookbook:publish
50 masters = ${all-masters:addresses}
51 admins = ${all-admins:addresses}
52
53 {% for node_number in range(slapparameter_dict.get('mysql-storage-count', 1)) -%}
54 {%   set section_id = 'storage-%i' % (node_number, ) -%}
55 {%   set final_section_id = 'final-' ~ section_id -%}
56 {%   do master_list.append(section_id) -%}
57 [{{ section_id }}]
58 < = mysql-storage-request-base
59 name = {{ section_id }}
60
61 [{{ section(final_section_id) }}]
62 < = mysql-storage-base
63         node-base
64 name = {{ section_id }}
65 config = ${request-config:base} ${request-config:master} ${request-config:node}
66
67 {% endfor -%}
68 {% for node_number in range(slapparameter_dict.get('admin-count', 1)) -%}
69 {%   set section_id = 'admin-%i' % (node_number, ) -%}
70 {%   do admin_list.append(section_id)%}
71 [{{ section(section_id) }}]
72 < = admin-base
73 name = {{ section_id }}
74
75 {% endfor -%}
76 [buildout]
77 parts = 
78         {{ part_list | join('\n\t') }}
79         publish
80 eggs-directory = {{ eggs_directory }}
81 develop-eggs-directory = {{ develop_eggs_directory }}
82 offline = true
83
84 [all-masters]
85 addresses = {% for master in master_list -%}
86 {{   '${' + master + ':connection-master}' -}}
87 {%   if not loop.last %} {% endif -%}
88 {% endfor %}
89
90 [all-admins]
91 addresses = {% for admin in admin_list -%}
92 {{  '${' + admin + ':connection-admin}' -}}
93 {%  if not loop.last %} {% endif -%}
94 {% endfor %}
95 {% endif -%}