pbsready-export.cfg.in 2.72 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
[notifier-exporter-promise-bin]
50 51 52
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 60 61 62 63 64 65
rendered = ${rootdirectory:bin}/exporter-status

[notifier-exporter-promise]
<= monitor-promise-base
module = check_command_execute
name = exporter-status.py
config-command = ${notifier-exporter-promise-bin:rendered}
66

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

81
[gen-resiliency-backup-periodicity]
82
recipe = slapos.cookbook:random.time
83 84 85 86 87 88

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

89
[slap-parameter]
90
# In cron.d format (i.e things like */15 * * * * are accepted).
91
resiliency-backup-periodicity =
92
notify =