pbsready-export.cfg.in 2.56 KB
Newer Older
1
[buildout]
2
extends = {{ pbsready_template_path }}
3

4
parts +=
5
  notifier-exporter-promise
6
  cron-entry-backup
7

8 9
[resilient-directory]
recipe = slapos.cookbook:mkdirectory
10 11 12
home = ${buildout:directory}
var = ${:home}/var
pid = ${:var}/pid
13

14 15 16
# Define port of ssh server. It has to be different from import so that it
# supports export/import using same IP (slaprunner, slapos-in-partition,
# ipv4...)
17 18 19 20
[sshd-port]
recipe = slapos.cookbook:free_port
minimum = 22200
maximum = 22209
21
ip = ${slap-network-information:global-ipv6}
22

23 24 25 26
[notifier-port]
recipe = slapos.cookbook:free_port
minimum = 65526
maximum = 65535
27
ip = ${notifier:host}
28

29
[resilient-publish-connection-parameter]
30
notification-id = http://[${notifier:host}]:${notifier:port}/get/${notifier-exporter:name}
31
-extends = publish-early
32 33

[notifier-exporter]
Marco Mariani's avatar
Marco Mariani committed
34 35
# notifier.notify launches an (exporter) executable, and when finished,
# notifies the the pull-backup-servers.
36 37 38
<= notifier
recipe = slapos.cookbook:notifier.notify
name = exporter
39 40 41 42 43
title = Dumping ${slap-parameter:namebase}
executable = ${exporter:wrapper}
wrapper = ${rootdirectory:bin}/exporter
notify = ${slap-parameter:notify}
pidfile = ${resilient-directory:pid}/${:name}.pid
44
max-run = 3
45

46
[logrotate-entry-notifier]
47
rendered = ${rootdirectory:etc}/logrotate_notifier.conf
48

49 50 51 52
[notifier-exporter-promise]
recipe = slapos.recipe.template:jinja2
mode = 700
template = inline:
53 54
  #!{{ bash_executable_location }}
  EXPORTER_FEED="${notifier-exporter:log-file}"
55
  FAILURE_PATTERN="FAILURE"
56 57 58
  if [ -s "$EXPORTER_FEED" ]; then
    tail -n 1 $EXPORTER_FEED | grep -vq FAILURE_PATTERN
  fi
59
rendered = ${basedirectory:promises}/exporter-status
60

61
[cron-entry-backup]
Marco Mariani's avatar
Marco Mariani committed
62 63
# Schedule the periodic database dump.
# Through notifications, this triggers (one or more) incremental backups on PBS instances.
64 65 66
<= cron
recipe = slapos.cookbook:cron.d
name = backup
67 68 69 70
{% set resiliency_backup_periodicity = slapparameter_dict.get('resiliency-backup-periodicity') %}
{% if  resiliency_backup_periodicity %}
frequency = {{ resiliency_backup_periodicity }}
{% else %}
71
time = ${publish-early:resiliency-backup-periodicity}
72
{% endif %}
73
command = {{ logrotate_executable_location }} -s ${basedirectory:run}/logrotate.status ${logrotate-entry-notifier:rendered}; ${notifier-exporter:wrapper} --transaction-id `date +%s`
74

75
[gen-resiliency-backup-periodicity]
76
recipe = slapos.cookbook:random.time
77 78 79 80 81 82

[publish-early]
recipe = slapos.cookbook:publish-early
-init =
  resiliency-backup-periodicity gen-resiliency-backup-periodicity:time

83
[slap-parameter]
84
# In cron.d format (i.e things like */15 * * * * are accepted).
85
resiliency-backup-periodicity =
86
notify =