Commit dfb63db3 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Fix resilience in slaprunner

See merge request !739
parents ed0e6b41 ec1fa1db
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# not need these here). # not need these here).
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = ec70348dd71b319590a5c5837f3d2e45 md5sum = 8d6878ff1d2e75010c50a1a2b0c13b24
[template-runner] [template-runner]
filename = instance-runner.cfg filename = instance-runner.cfg
......
...@@ -74,6 +74,7 @@ template = ${instance-runner-import:target} ...@@ -74,6 +74,7 @@ template = ${instance-runner-import:target}
rendered = $${buildout:directory}/instance-runner-import.cfg rendered = $${buildout:directory}/instance-runner-import.cfg
mode = 640 mode = 640
context = context =
key pbsready_import_template_path template-pbsready-import:rendered
key template_runner_path instance-base-runner:rendered key template_runner_path instance-base-runner:rendered
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
raw software_release_bin ${buildout:bin-directory} raw software_release_bin ${buildout:bin-directory}
...@@ -82,7 +83,6 @@ context = ...@@ -82,7 +83,6 @@ context =
raw bash_executable_location ${bash:location}/bin/bash raw bash_executable_location ${bash:location}/bin/bash
raw sqlite3_executable_location ${sqlite3:location}/bin/sqlite3 raw sqlite3_executable_location ${sqlite3:location}/bin/sqlite3
raw rsync_executable_location ${rsync:location}/bin/rsync raw rsync_executable_location ${rsync:location}/bin/rsync
raw pbsready_import_template_path ${pbsready-import:output}
raw software_release_information_template ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename} raw software_release_information_template ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename}
[slap-configuration] [slap-configuration]
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
# not need these here). # not need these here).
[pbsready] [pbsready]
filename = pbsready.cfg.in filename = pbsready.cfg.in
md5sum = 66331047b7dbf2513c5726d5d1647320 md5sum = 2bd6f853ace04ea84dffe29acfce92df
[pbsready-import] [pbsready-import]
filename = pbsready-import.cfg.in filename = pbsready-import.cfg.in
md5sum = 6f32cede10cf0d6430c017f49fe5aa30 md5sum = dd8f0728e53b49822eed5d613839558f
[pbsready-export] [pbsready-export]
filename = pbsready-export.cfg.in filename = pbsready-export.cfg.in
...@@ -26,7 +26,7 @@ md5sum = 2b0c71b085cfe8017f28098c160b1f49 ...@@ -26,7 +26,7 @@ md5sum = 2b0c71b085cfe8017f28098c160b1f49
[template-pull-backup] [template-pull-backup]
filename = instance-pull-backup.cfg.in filename = instance-pull-backup.cfg.in
md5sum = 555d528b198564f0ce1e94db1160ebf3 md5sum = 382d9b57faac92da3c723760f2210c13
[template-replicated] [template-replicated]
filename = template-replicated.cfg.in filename = template-replicated.cfg.in
...@@ -38,7 +38,7 @@ md5sum = 071b1034ee8f5cc14f79b16fdeba2813 ...@@ -38,7 +38,7 @@ md5sum = 071b1034ee8f5cc14f79b16fdeba2813
[template-resilient-templates] [template-resilient-templates]
filename = template-resilient-templates.cfg.in filename = template-resilient-templates.cfg.in
md5sum = 097a14371efde11465ab4bd08ef3131b md5sum = 3b426db6fddce431b363d095a22dd698
[instance-frozen] [instance-frozen]
filename = instance-frozen.cfg.in filename = instance-frozen.cfg.in
...@@ -46,7 +46,7 @@ md5sum = d21472f0e58f928fb827f2cbf22c4d4a ...@@ -46,7 +46,7 @@ md5sum = d21472f0e58f928fb827f2cbf22c4d4a
[resilient-web-takeover-cgi-script-download] [resilient-web-takeover-cgi-script-download]
filename = resilient-web-takeover-cgi-script.py.in filename = resilient-web-takeover-cgi-script.py.in
md5sum = a7d6ca463e4b6438e1d826f531533a39 md5sum = 7a0f1be7e9d05d0c68748322abe1f511
[template-wrapper] [template-wrapper]
filename = templates/wrapper.in filename = templates/wrapper.in
......
...@@ -110,7 +110,7 @@ rotate-num = 30 ...@@ -110,7 +110,7 @@ rotate-num = 30
recipe = slapos.cookbook:pbs recipe = slapos.cookbook:pbs
client = true client = true
feeds = $${directory:notifier-feeds} feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks} callbacks-directory = $${directory:notifier-callbacks}
equeue-socket = $${equeue:socket} equeue-socket = $${equeue:socket}
notifier-binary = ${buildout:bin-directory}/pubsubnotifier notifier-binary = ${buildout:bin-directory}/pubsubnotifier
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
...@@ -124,7 +124,7 @@ run-directory = $${basedirectory:run} ...@@ -124,7 +124,7 @@ run-directory = $${basedirectory:run}
pull-push-maximum-run = 5 pull-push-maximum-run = 5
# XXX: this should be named "notifier-host" # XXX: this should be named "notifier-host"
notifier-url = http://[$${notifier:host}]:$${notifier:port} notifier-url = http://[$${notifier:host}]:$${notifier:port}
slave-instance-list = {{ slapparameter_dict.get('slave_instance_list', '[]') }} slave-instance-list = {{ dumps(slave_instance_list) }}
ignore-known-hosts-file = {{ slapparameter_dict.get('ignore-known-hosts-file', 'false') }} ignore-known-hosts-file = {{ slapparameter_dict.get('ignore-known-hosts-file', 'false') }}
# To get a verbose feed about PBS state # To get a verbose feed about PBS state
instance-root-name = $${monitor-instance-parameter:root-instance-title} instance-root-name = $${monitor-instance-parameter:root-instance-title}
......
[buildout] [buildout]
extends = ${pbsready:output} extends = {{ pbsready_template_path }}
parts += parts +=
resiliency-takeover-script resiliency-takeover-script
...@@ -14,9 +14,6 @@ parts += ...@@ -14,9 +14,6 @@ parts +=
backup-signature-link backup-signature-link
[slap-parameter]
on-notification =
[resilient-publish-connection-parameter] [resilient-publish-connection-parameter]
notification-url = http://[$${notifier:host}]:$${notifier:port}/notify notification-url = http://[$${notifier:host}]:$${notifier:port}/notify
takeover-url = http://[$${resilient-web-takeover-httpd-configuration-file:listening-ip}]:$${resilient-web-takeover-httpd-configuration-file:listening-port}/ takeover-url = http://[$${resilient-web-takeover-httpd-configuration-file:listening-ip}]:$${resilient-web-takeover-httpd-configuration-file:listening-port}/
...@@ -42,13 +39,15 @@ ip = $${notifier:host} ...@@ -42,13 +39,15 @@ ip = $${notifier:host}
# notifier.callback runs a script when a notification (sent by a parent PBS) # notifier.callback runs a script when a notification (sent by a parent PBS)
# is received # is received
recipe = slapos.cookbook:notifier.callback recipe = slapos.cookbook:notifier.callback
directory = $${notifier:callbacks} callbacks-directory = $${notifier:callbacks-directory}
on-notification-id = $${slap-parameter:on-notification} on-notification-id = {{ slapparameter_dict.get('on-notification', '') }}
callbacks = callback-list =
# import on notification # warning the order of the 2 callbacks is important for now
$${importer:wrapper} # it should be fixed later
# check backup integrity on notification # check backup integrity on notification
$${post-notification-run:output} $${post-notification-run:output}
# import on notification
$${importer:wrapper}
[post-notification-run] [post-notification-run]
recipe = collective.recipe.template recipe = collective.recipe.template
......
...@@ -63,9 +63,6 @@ cgi-bin = $${rootdirectory:srv}/cgi-bin ...@@ -63,9 +63,6 @@ cgi-bin = $${rootdirectory:srv}/cgi-bin
monitor-resilient = $${monitor-directory:private}/resilient monitor-resilient = $${monitor-directory:private}/resilient
[slap-parameter]
authorized-key =
#---------------- #----------------
#-- #--
#-- Deploy cron. #-- Deploy cron.
...@@ -131,8 +128,8 @@ rendered = $${:wrapper} ...@@ -131,8 +128,8 @@ rendered = $${:wrapper}
wrapper = $${basedirectory:services}/notifier wrapper = $${basedirectory:services}/notifier
mode = 0700 mode = 0700
feeds = $${directory:notifier-feeds} feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks} callbacks-directory = $${directory:notifier-callbacks}
command = ${buildout:bin-directory}/pubsubserver --callbacks $${directory:notifier-callbacks} --feeds $${directory:notifier-feeds} --equeue-socket $${equeue:socket} --logfile $${basedirectory:log}/notifier.log $${:host} $${:port} command = ${buildout:bin-directory}/pubsubserver --callbacks $${:callbacks-directory} --feeds $${:feeds} --equeue-socket $${equeue:socket} --logfile $${basedirectory:log}/notifier.log $${:host} $${:port}
notifier-binary = ${buildout:bin-directory}/pubsubnotifier notifier-binary = ${buildout:bin-directory}/pubsubnotifier
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
port = $${notifier-port:port} port = $${notifier-port:port}
...@@ -198,7 +195,7 @@ wrapper-path = $${rootdirectory:bin}/raw_sshd ...@@ -198,7 +195,7 @@ wrapper-path = $${rootdirectory:bin}/raw_sshd
[sshd-pbs-authorized-key] [sshd-pbs-authorized-key]
<= sshd-raw-server <= sshd-raw-server
recipe = slapos.cookbook:dropbear.add_authorized_key recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key} key = {{ slapparameter_dict.get('authorized-key', '') }}
[sshd-server] [sshd-server]
recipe = collective.recipe.template recipe = collective.recipe.template
......
...@@ -53,7 +53,7 @@ def getLatestBackupDate(): ...@@ -53,7 +53,7 @@ def getLatestBackupDate():
timestamp = float(db[callback]) timestamp = float(db[callback])
if timestamp > last_backup: if timestamp > last_backup:
last_backup = timestamp last_backup = timestamp
result = datetime.datetime.fromtimestamp(last_backup) result = datetime.datetime.fromtimestamp(float(last_backup))
db.close() db.close()
shutil.rmtree(temporary_directory) shutil.rmtree(temporary_directory)
return result return result
......
[template-pbsready]
recipe = slapos.recipe.template:jinja2
template = ${pbsready:output}
rendered = $${buildout:directory}/pbsready.cfg
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
[template-pbsready-export] [template-pbsready-export]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${pbsready-export:target} template = ${pbsready-export:target}
...@@ -5,10 +13,19 @@ rendered = $${buildout:directory}/pbsready-exporter.cfg ...@@ -5,10 +13,19 @@ rendered = $${buildout:directory}/pbsready-exporter.cfg
mode = 640 mode = 640
context = context =
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
raw pbsready_template_path ${pbsready:output} raw pbsready_template_path $${template-pbsready:rendered}
raw bash_executable_location ${bash:location}/bin/bash raw bash_executable_location ${bash:location}/bin/bash
raw logrotate_executable_location ${logrotate:location}/usr/sbin/logrotate raw logrotate_executable_location ${logrotate:location}/usr/sbin/logrotate
[template-pbsready-import]
recipe = slapos.recipe.template:jinja2
template = ${pbsready-import:output}
rendered = $${buildout:directory}/pbsready-importer.cfg
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
raw pbsready_template_path $${template-pbsready:rendered}
[instance-frozen] [instance-frozen]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${instance-frozen:output} template = ${instance-frozen:output}
...@@ -23,5 +40,7 @@ template = ${template-pull-backup:output} ...@@ -23,5 +40,7 @@ template = ${template-pull-backup:output}
rendered = $${buildout:directory}/template-pull-backup.cfg rendered = $${buildout:directory}/template-pull-backup.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
context = context =
key slave_instance_list slap-configuration:slave-instance-list
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key ipv6 slap-configuration:ipv6-random key ipv6 slap-configuration:ipv6-random
...@@ -155,7 +155,7 @@ pyparsing = 2.2.0 ...@@ -155,7 +155,7 @@ pyparsing = 2.2.0
pytz = 2016.10 pytz = 2016.10
requests = 2.13.0 requests = 2.13.0
six = 1.12.0 six = 1.12.0
slapos.cookbook = 1.0.143 slapos.cookbook = 1.0.145
slapos.core = 1.5.12 slapos.core = 1.5.12
slapos.extension.strip = 0.4 slapos.extension.strip = 0.4
slapos.extension.shared = 1.0 slapos.extension.shared = 1.0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment