template-replicated.cfg.in 5.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{% macro replicate(namebase, nbbackup, typeexport, typeimport, heriteLeader='', heriteBackup='') %}

## Tells the Backupable recipe that we want a backup
[resilient]
config-script = bully.py
config-wrapper = bully
config-namebase = {{namebase}}

## Every request is double to provide the 3 IPs.
[request-{{namebase}}]
<= resilient
   slap-connection
   {{heriteLeader}}
software-type = {{typeexport}}
name = {{namebase}}0
return = url ssh-public-key ssh-url notification-id ip

config = number script wrapper authorized-key notify ip-list namebase
Marco Mariani's avatar
Marco Mariani committed
19
config-number = 0
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
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 =

{% 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}}
return = url ssh-public-key ssh-url notification-url ip

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

Marco Mariani's avatar
Marco Mariani committed
39 40
config = number script wrapper authorized-key on-notification ip-list namebase
config-number = {{id}}
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
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 =

{% 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]
<= resilient
   slap-connection
   iplist
   {{heriteLeader}}

recipe = slapos.cookbook:request
name = {{namebase}}0

software-url = ${slap-connection:software-release-url}
software-type = {{typeexport}}
return = url ssh-public-key ssh-url notification-id ip

Marco Mariani's avatar
Marco Mariani committed
63 64
config = number script wrapper authorized-key notify ip-list namebase
config-number = 0
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
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 %}

{% for id in range(1,nbbackup|int) %}
[request-{{namebase}}-pseudo-replicating-{{id}}-2]
<= slap-connection
   resilient
   iplist
   {{heriteBackup}}

recipe = slapos.cookbook:request
name = {{namebase}}{{id}}

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

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

Marco Mariani's avatar
Marco Mariani committed
84 85
config = number script wrapper authorized-key on-notification ip-list namebase
config-number = {{id}}
86 87 88 89 90 91 92 93 94 95 96
config-authorized-key = ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${:pbs-notification-id}

{% 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
97
## Having 3 backups pulling from the same PBS provides
98 99 100 101
##only availability, not resiliency

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

102
[request-pbs-common]
103 104 105 106
<= slap-connection
recipe = slapos.cookbook:request
software-url = ${slap-connection:software-release-url}
software-type = pull-backup
107 108 109 110 111 112

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

[request-pbs-{{namebase}}-{{id}}]
<= request-pbs-common
name = PBS ({{namebase}} / {{id}})
113 114 115 116
return = ssh-key notification-url feeds-url
slave = false

[request-pull-backup-server-{{namebase}}-{{id}}]
117
<= request-pbs-common
118 119 120 121 122 123 124 125 126 127 128
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
129 130
sla = instance_guid
sla-instance_guid = ${request-pbs-{{namebase}}-{{id}}:instance_guid}
131 132

[request-pull-backup-server-{{namebase}}-backup-{{id}}]
133
<= request-pbs-common
134 135 136 137 138 139 140 141 142 143 144
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
145 146
sla = instance_guid
sla-instance_guid = ${request-pbs-{{namebase}}-{{id}}:instance_guid}
147 148
{% endfor %}

149
{% endmacro %}