Merge remote-tracking branch 'origin/gitweb'
[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
23 [request-config]
24 base = cluster
25 master = partitions replicas
26 node = masters
27
28 [node-base]
29 < = request-common
30 config = ${request-config:base} ${request-config:node}
31 config-masters = ${all-masters:addresses}
32
33 [mysql-storage-base]
34 < = request-common
35 config = ${request-config:base} ${request-config:master}
36 software-type = {{ mysql_storage_software_type }}
37
38 [mysql-storage-request-base]
39 < = mysql-storage-base
40 return = master
41
42 [admin-base]
43 < = node-base
44 return = admin
45 software-type = {{ admin_software_type }}
46
47 [publish]
48 recipe = slapos.cookbook:publish
49 masters = ${all-masters:addresses}
50 admins = ${all-admins:addresses}
51
52 {% for node_number in range(slapparameter_dict.get('mysql-storage-count', 1)) -%}
53 {%   set section_id = 'storage-%i' % (node_number, ) -%}
54 {%   set final_section_id = 'final-' ~ section_id -%}
55 {%   do master_list.append(section_id) -%}
56 [{{ section_id }}]
57 < = mysql-storage-request-base
58 name = {{ section_id }}
59
60 [{{ section(final_section_id) }}]
61 < = mysql-storage-base
62         node-base
63 name = {{ section_id }}
64 config = ${request-config:base} ${request-config:master} ${request-config:node}
65
66 {% endfor -%}
67 {% for node_number in range(slapparameter_dict.get('admin-count', 1)) -%}
68 {%   set section_id = 'admin-%i' % (node_number, ) -%}
69 {%   do admin_list.append(section_id)%}
70 [{{ section(section_id) }}]
71 < = admin-base
72 name = {{ section_id }}
73
74 {% endfor -%}
75 [buildout]
76 parts = 
77         {{ part_list | join('\n\t') }}
78         publish
79 eggs-directory = {{ eggs_directory }}
80 develop-eggs-directory = {{ develop_eggs_directory }}
81 offline = true
82
83 [all-masters]
84 addresses = {% for master in master_list -%}
85 {{   '${' + master + ':connection-master}' -}}
86 {%   if not loop.last %} {% endif -%}
87 {% endfor %}
88
89 [all-admins]
90 addresses = {% for admin in admin_list -%}
91 {{  '${' + admin + ':connection-admin}' -}}
92 {%  if not loop.last %} {% endif -%}
93 {% endfor %}
94 {% endif -%}