resiliency stack: allow web takeover to work inside of webrunner/erp5testnode.

Also deploy takeover script only in import instances. This is non-sense to deploy it on export/pbs instances.
parent 2aa29499
...@@ -43,7 +43,7 @@ class Recipe(GenericSlapRecipe): ...@@ -43,7 +43,7 @@ class Recipe(GenericSlapRecipe):
slap_connection = self.buildout['slap-connection'] slap_connection = self.buildout['slap-connection']
takeover_wrapper = self.createPythonScript( takeover_wrapper = self.createPythonScript(
name=os.path.join(self.options['bin'], self.options['wrapper-takeover']), name=self.options['wrapper-takeover'],
absolute_function='slapos.recipe.addresiliency.takeover.run', absolute_function='slapos.recipe.addresiliency.takeover.run',
arguments={ arguments={
'server_url': slap_connection['server-url'], 'server_url': slap_connection['server-url'],
......
...@@ -38,7 +38,7 @@ eggs = collective.recipe.template ...@@ -38,7 +38,7 @@ eggs = collective.recipe.template
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready.cfg.in url = ${:_profile_base_location_}/pbsready.cfg.in
output = ${buildout:directory}/pbsready.cfg output = ${buildout:directory}/pbsready.cfg
md5sum = ec4f71330cccfa17ddb8fee51d2e6441 md5sum = 7d7cb70cb76a41f853e74cc34a9ef428
mode = 0644 mode = 0644
[pbsready-import] [pbsready-import]
...@@ -47,7 +47,7 @@ mode = 0644 ...@@ -47,7 +47,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-import.cfg.in url = ${:_profile_base_location_}/pbsready-import.cfg.in
output = ${buildout:directory}/pbsready-import.cfg output = ${buildout:directory}/pbsready-import.cfg
md5sum = 26c75eac66ce97abbb891ab6e806730c md5sum = dd13497575d13b92c3abb0a633777e2c
mode = 0644 mode = 0644
[pbsready-export] [pbsready-export]
...@@ -56,7 +56,7 @@ mode = 0644 ...@@ -56,7 +56,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-export.cfg.in url = ${:_profile_base_location_}/pbsready-export.cfg.in
output = ${buildout:directory}/pbsready-export.cfg output = ${buildout:directory}/pbsready-export.cfg
md5sum = 879fff114d1dbf1f58774ccbce9bdd22 md5sum = bfd71e454140cf13179d408e10f95bf8
mode = 0644 mode = 0644
[template-pull-backup] [template-pull-backup]
...@@ -92,7 +92,7 @@ output = ${buildout:directory}/instance-frozen.cfg ...@@ -92,7 +92,7 @@ output = ${buildout:directory}/instance-frozen.cfg
[resilient-web-takeover-cgi-script-download] [resilient-web-takeover-cgi-script-download]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/resilient-web-takeover-cgi-script.py.in url = ${:_profile_base_location_}/resilient-web-takeover-cgi-script.py.in
md5sum = 5c90dae56885eeb490cc5d7f82d2dc5b md5sum = 3aa7624af1196062d7d01946d4de9f0e
mode = 0644 mode = 0644
destination = ${buildout:directory}/resilient-web-takeover-cgi-script.py.in destination = ${buildout:directory}/resilient-web-takeover-cgi-script.py.in
......
...@@ -5,7 +5,6 @@ extends = ${pbsready:output} ...@@ -5,7 +5,6 @@ extends = ${pbsready:output}
# Explicitely define extended parts from pbsready # Explicitely define extended parts from pbsready
# then add local parts # then add local parts
parts = parts =
resiliency
logrotate logrotate
logrotate-entry-cron logrotate-entry-cron
logrotate-entry-equeue logrotate-entry-equeue
......
...@@ -5,7 +5,6 @@ extends = ${pbsready:output} ...@@ -5,7 +5,6 @@ extends = ${pbsready:output}
# Explicitely define extended parts from pbsready # Explicitely define extended parts from pbsready
# then add local parts # then add local parts
parts = parts =
resiliency
logrotate logrotate
logrotate-entry-cron logrotate-entry-cron
logrotate-entry-equeue logrotate-entry-equeue
...@@ -18,6 +17,7 @@ parts = ...@@ -18,6 +17,7 @@ parts =
dropbear-server-pbs-authorized-key dropbear-server-pbs-authorized-key
notifier notifier
resiliency-takeover-script
resilient-web-takeover-cgi-script resilient-web-takeover-cgi-script
resilient-web-takeover-httpd-wrapper resilient-web-takeover-httpd-wrapper
resilient-web-takeover-httpd-promise resilient-web-takeover-httpd-promise
...@@ -40,12 +40,6 @@ port = 22220 ...@@ -40,12 +40,6 @@ port = 22220
[notifier] [notifier]
port = 65533 port = 65533
# Add path of file created by takeover script when takeover is triggered
# Takeover script will create this file
# equeue process will watch for file existence.
[equeue]
takeover-triggered-file-path = $${resiliency:takeover-triggered-file-path}
[import-on-notification] [import-on-notification]
# 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
...@@ -54,6 +48,20 @@ recipe = slapos.cookbook:notifier.callback ...@@ -54,6 +48,20 @@ recipe = slapos.cookbook:notifier.callback
on-notification-id = $${slap-parameter:on-notification} on-notification-id = $${slap-parameter:on-notification}
callback = $${importer:wrapper} callback = $${importer:wrapper}
###########
# Generate the takeover script
###########
[resiliency-takeover-script]
recipe = slapos.cookbook:addresiliency
wrapper-takeover = $${rootdirectory:bin}/takeover
takeover-triggered-file-path = $${rootdirectory:srv}/takeover_triggered
# Add path of file created by takeover script when takeover is triggered
# Takeover script will create this file
# equeue process will watch for file existence.
[equeue]
takeover-triggered-file-path = $${resiliency-takeover-script:takeover-triggered-file-path}
########### ###########
# Deploy a webserver allowing to do takeover from a web browser. # Deploy a webserver allowing to do takeover from a web browser.
########### ###########
......
[buildout] [buildout]
parts = parts =
resiliency
logrotate logrotate
logrotate-entry-cron logrotate-entry-cron
logrotate-entry-equeue logrotate-entry-equeue
...@@ -126,17 +125,6 @@ frequency = daily ...@@ -126,17 +125,6 @@ frequency = daily
rotate-num = 30 rotate-num = 30
#----------------
#--
#-- Resiliency script for the node takeover
[resiliency]
recipe = slapos.cookbook:addresiliency
wrapper-takeover = takeover
takeover-triggered-file-path = $${rootdirectory:srv}/takeover_triggered
bin = $${rootdirectory:bin}
#---------------- #----------------
#-- #--
#-- Sets up an rdiff-backup server (with a dropbear server for ssh) #-- Sets up an rdiff-backup server (with a dropbear server for ssh)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
equeue_database = '${equeue:database}' equeue_database = '${equeue:database}'
equeue_lockfile = '${equeue:lockfile}' equeue_lockfile = '${equeue:lockfile}'
takeover_script = '${resiliency-takeover-script:wrapper-takeover}'
import cgi import cgi
import cgitb import cgitb
...@@ -68,6 +69,6 @@ if form['password'].value != '${:password}': ...@@ -68,6 +69,6 @@ if form['password'].value != '${:password}':
sys.exit(1) sys.exit(1)
# XXX hardcoded location # XXX hardcoded location
result = subprocess.check_output([os.path.expanduser("~/bin/takeover")], stderr=subprocess.STDOUT) result = subprocess.check_output([takeover_script], stderr=subprocess.STDOUT)
print 'Success.' print 'Success.'
print '<pre>%s</pre>' % result print '<pre>%s</pre>' % result
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