solar/examples/riak/riak_cluster.yaml
Łukasz Oleś 8e5912939e VR optimalization for riak cluster
Only one haproxy_riak_config_http and one  haproxy_riak_config_pb is required.
2015-09-26 17:59:52 +02:00

140 lines
3.6 KiB
YAML

id: riak_node
resources:
- id: riak_service0
from: resources/riak_node
location: {{nodes[0]}}
values:
riak_self_name: 'riak0'
riak_hostname: 'riak_server0.solar'
riak_name: 'riak0@riak_server0.solar'
ip: '{{nodes[0]}}::ip'
{% for i in range(1, idx|int) %}
- id: riak_service{{i}}
from: resources/riak_node
location: {{nodes[i]}}
values:
riak_self_name: 'riak{{i}}'
riak_hostname: 'riak_server{{i}}.solar'
riak_name: 'riak{{i}}@riak_server{{i}}.solar'
join_to: 'riak_service0::riak_name'
ip: '{{nodes[i]}}::ip'
{% endfor %}
{% for i in range(idx|int) %}
- id: hosts_file{{i}}
from: resources/hosts_file
location: {{nodes[i]}}
values:
hosts:name:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_hostname::NO_EVENTS
{% endfor %}
hosts:ip:
{% for j in range(idx|int) %}
- riak_service{{j}}::ip::NO_EVENTS
{% endfor %}
{% endfor %}
- id: haproxy_riak_config_http
from: resources/haproxy_service_config
values:
listen_port: 8098
protocol: 'http'
name: 'riak_haproxy_http'
backends:server:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_hostname
{% endfor %}
backends:port:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_port_http
{% endfor %}
- id: haproxy_riak_config_pb
from: resources/haproxy_service_config
values:
listen_port: 8087
protocol: 'tcp'
name: 'riak_haproxy_pb'
backends:server:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_hostname
{% endfor %}
backends:port:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_port_pb
{% endfor %}
{% for i in range(idx|int) %}
- id: haproxy_config{{i}}
from: resources/haproxy_config
location: {{nodes[i]}}
values:
config:protocol:
- haproxy_riak_config_http::protocol
- haproxy_riak_config_pb::protocol
config:listen_port:
- haproxy_riak_config_http::listen_port
- haproxy_riak_config_pb::listen_port
config:name:
- haproxy_riak_config_http::name
- haproxy_riak_config_pb::name
config:backends:
- haproxy_riak_config_http::backends
- haproxy_riak_config_pb::backends
ip: '{{nodes[i]}}::ip'
{% endfor %}
{% for i in range(idx|int) %}
- id: haproxy_service{{i}}
location: {{nodes[i]}}
from: resources/haproxy_service
values:
ip: '{{nodes[i]}}::ip'
{% endfor %}
events:
{% for i in range(idx|int) %}
- type: depends_on
parent_action: 'hosts_file{{i}}.run'
state: 'success'
depend_action: 'riak_service{{i}}.run'
{% endfor %}
{% for i in range(1, idx|int) %}
- type: react_on
parent_action: 'riak_service{{i}}.run'
state: 'success'
depend_action: 'riak_service{{i}}.join'
- type: react_on
parent_action: 'riak_service{{i}}.leave'
state: 'success'
depend_action: 'riak_service{{i}}.join'
- type: react_on
parent_action: 'riak_service{{i}}.join'
state: 'success'
depend_action: 'riak_service0.commit'
{% endfor %}
{% for i in range(1, idx|int) %}
- type: depends_on
parent_action: 'haproxy_service{{i}}.run'
state: 'success'
depend_action: 'haproxy_config{{i}}.run'
- type: react_on
parent_action: 'haproxy_config{{i}}.run'
state: 'success'
depend_action: 'haproxy_service{{i}}.apply_config'
- type: react_on
parent_action: 'haproxy_config{{i}}.update'
state: 'success'
depend_action: 'haproxy_service{{i}}.apply_config'
{% endfor %}