template-replicated.cfg.in 4.98 KB
Newer Older
1 2 3 4
{% macro replicate(namebase, nbbackup, typeexport, typeimport, heriteLeader='', heriteBackup='') %}

## Tells the Backupable recipe that we want a backup
[resilient]
5
recipe = slapos.cookbook:request
6
config-namebase = {{namebase}}
7
software-url = ${slap-connection:software-release-url}
8 9

## Every request is double to provide the 3 IPs.
10 11 12
## First, we request with ip-list parameter hardcoded.
## Then, we request the same thing without this.
## XXX-Cedric: is it useful?
13 14 15 16 17 18
[request-{{namebase}}]
<= resilient
   slap-connection
   {{heriteLeader}}
software-type = {{typeexport}}
name = {{namebase}}0
19
return = ssh-public-key ssh-url notification-id ip
20

Marco Mariani's avatar
Marco Mariani committed
21
config = number authorized-key notify ip-list namebase
Marco Mariani's avatar
Marco Mariani committed
22
config-number = 0
23 24 25 26
config-authorized-key = {% for id in range(1,nbbackup|int) %} ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}{% endfor %}
config-notify = {% for id in range(1,nbbackup|int) %} ${request-pbs-{{namebase}}-{{id}}:connection-notification-url}{% endfor %}
config-ip-list =

27

28 29 30 31 32 33 34 35 36 37 38
{% for id in range(1,nbbackup|int) %}

[request-{{namebase}}-pseudo-replicating-{{id}}]
<= slap-connection
   resilient
   {{heriteBackup}}
recipe = slapos.cookbook:request
name = {{namebase}}{{id}}

software-url = ${slap-connection:software-release-url}
software-type = {{typeimport}}
39
return = ssh-public-key ssh-url notification-url ip
40

Marco Mariani's avatar
Marco Mariani committed
41
pbs-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-push
42

Marco Mariani's avatar
Marco Mariani committed
43
config = number authorized-key on-notification ip-list namebase
Marco Mariani's avatar
Marco Mariani committed
44
config-number = {{id}}
45 46 47 48
config-authorized-key = ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${:pbs-notification-id}
config-ip-list =

49 50 51 52
sla = computer_guid
sla-computer_guid = ${slap-parameter:{{namebase}}{{id}}-computer-guid}


53 54 55 56 57 58
{% endfor %}

[iplist]
config-ip-list = ${request-{{namebase}}:connection-ip}{% for j in range(1,nbbackup|int) %} ${request-{{namebase}}-pseudo-replicating-{{j}}:connection-ip}{% endfor %}

[request-{{namebase}}-2]
59
<= request-{{namebase}}
60
   iplist
61

62 63
{% for id in range(1,nbbackup|int) %}
[request-{{namebase}}-pseudo-replicating-{{id}}-2]
64
<= request-{{namebase}}-pseudo-replicating-{{id}}
65
   iplist
66

67 68 69 70 71 72 73 74
{% endfor %}



## The PBS and their push / pull slaves
## Adding a PBS provides resiliency
## Adding a backup server provides availability

Cédric de Saint Martin's avatar
Cédric de Saint Martin committed
75
## Having 3 backups pulling from the same PBS provides
76 77 78 79
##only availability, not resiliency

## WARNING : SLAVES ARE ALLOCATED AT RANDOM, THIS NEEDS TO BE FIXED.

80
[request-pbs-common]
81 82 83 84
<= slap-connection
recipe = slapos.cookbook:request
software-url = ${slap-connection:software-release-url}
software-type = pull-backup
85 86 87 88 89 90

{% for id in range(1,nbbackup|int) %}

[request-pbs-{{namebase}}-{{id}}]
<= request-pbs-common
name = PBS ({{namebase}} / {{id}})
91 92
return = ssh-key notification-url feeds-url
slave = false
93 94
sla = computer_guid
sla-computer_guid = ${slap-parameter:pbs-{{namebase}}{{id}}-computer-guid}
95 96

[request-pull-backup-server-{{namebase}}-{{id}}]
97
<= request-pbs-common
98 99 100 101 102 103 104 105 106 107 108
name = PBS {{id}} pulling from ${request-{{namebase}}:name}
config = url name type server-key on-notification notify notification-id title
config-url = ${request-{{namebase}}:connection-ssh-url}
config-name = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-{{id}}
config-type = pull
config-server-key = ${request-{{namebase}}:connection-ssh-public-key}
config-on-notification = ${request-{{namebase}}:connection-notification-id}
config-notify = ${request-pbs-{{namebase}}-{{id}}:connection-notification-url}
config-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-{{id}}-pull
config-title = Pulling from {{namebase}}
slave = true
109 110
sla = instance_guid
sla-instance_guid = ${request-pbs-{{namebase}}-{{id}}:instance_guid}
111 112

[request-pull-backup-server-{{namebase}}-backup-{{id}}]
113
<= request-pbs-common
114 115 116 117 118 119 120 121 122 123 124
name = PBS pushing on ${request-{{namebase}}-pseudo-replicating-{{id}}:name}
config = url name type server-key on-notification notify notification-id title
config-url = ${request-{{namebase}}-pseudo-replicating-{{id}}:connection-ssh-url}
config-name = ${request-pull-backup-server-{{namebase}}-{{id}}:config-name}
config-type = push
config-server-key = ${request-{{namebase}}-pseudo-replicating-{{id}}:connection-ssh-public-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${request-pull-backup-server-{{namebase}}-{{id}}:config-notification-id}
config-notify = ${request-{{namebase}}-pseudo-replicating-{{id}}:connection-notification-url}
config-notification-id = ${request-{{namebase}}-pseudo-replicating-{{id}}:pbs-notification-id}
config-title = Pushing to {{namebase}} backup {{id}}
slave = true
125 126
sla = instance_guid
sla-instance_guid = ${request-pbs-{{namebase}}-{{id}}:instance_guid}
127 128
{% endfor %}

129 130 131 132 133 134 135 136
[slap-parameter]
# Default parameters for distributed deployment
# I.e state "backup1 of maria should go there, ..."
{% for id in range(1,nbbackup|int) %}
{{namebase}}{{id}}-computer-guid =
pbs-{{namebase}}{{id}}-computer-guid =
{% endfor %}

137
{% endmacro %}