Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Matevz Golob
slapos
Commits
c7f71ecf
Commit
c7f71ecf
authored
Aug 29, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resilient: notifier port is now dynamic, and gets a promise
parent
93ccdbc7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
8 deletions
+37
-8
slapos/recipe/notifier.py
slapos/recipe/notifier.py
+7
-3
stack/resilient/instance-pull-backup.cfg.in
stack/resilient/instance-pull-backup.cfg.in
+7
-2
stack/resilient/pbsready-export.cfg.in
stack/resilient/pbsready-export.cfg.in
+17
-0
stack/resilient/pbsready-import.cfg.in
stack/resilient/pbsready-import.cfg.in
+5
-2
stack/resilient/pbsready.cfg.in
stack/resilient/pbsready.cfg.in
+1
-1
No files found.
slapos/recipe/notifier.py
View file @
c7f71ecf
...
@@ -66,6 +66,12 @@ class Callback(GenericBaseRecipe):
...
@@ -66,6 +66,12 @@ class Callback(GenericBaseRecipe):
class
Notify
(
GenericBaseRecipe
):
class
Notify
(
GenericBaseRecipe
):
def
__init__
(
self
,
buildout
,
name
,
options
):
super
(
Notify
,
self
).
__init__
(
buildout
,
name
,
options
)
log
=
os
.
path
.
join
(
options
[
'feeds'
],
options
[
'name'
])
options
[
'log-file'
]
=
log
self
.
options
=
options
def
createNotifier
(
self
,
notifier_binary
,
wrapper
,
executable
,
def
createNotifier
(
self
,
notifier_binary
,
wrapper
,
executable
,
log
,
title
,
notification_url
,
feed_url
,
pidfile
=
None
):
log
,
title
,
notification_url
,
feed_url
,
pidfile
=
None
):
...
@@ -98,13 +104,11 @@ class Notify(GenericBaseRecipe):
...
@@ -98,13 +104,11 @@ class Notify(GenericBaseRecipe):
port
=
self
.
options
[
'port'
],
port
=
self
.
options
[
'port'
],
path
=
'/get/%s'
%
self
.
options
[
'name'
])
path
=
'/get/%s'
%
self
.
options
[
'name'
])
log
=
os
.
path
.
join
(
self
.
options
[
'feeds'
],
self
.
options
[
'name'
])
options
=
self
.
options
options
=
self
.
options
script
=
self
.
createNotifier
(
notifier_binary
=
options
[
'notifier-binary'
],
script
=
self
.
createNotifier
(
notifier_binary
=
options
[
'notifier-binary'
],
wrapper
=
options
[
'wrapper'
],
wrapper
=
options
[
'wrapper'
],
executable
=
options
[
'executable'
],
executable
=
options
[
'executable'
],
log
=
log
,
log
=
options
[
'log-file'
]
,
title
=
options
[
'title'
],
title
=
options
[
'title'
],
pidfile
=
options
[
'pidfile'
],
pidfile
=
options
[
'pidfile'
],
notification_url
=
options
[
'notify'
],
notification_url
=
options
[
'notify'
],
...
...
stack/resilient/instance-pull-backup.cfg.in
View file @
c7f71ecf
...
@@ -71,6 +71,12 @@ database = $${rootdirectory:srv}/equeue.db
...
@@ -71,6 +71,12 @@ database = $${rootdirectory:srv}/equeue.db
wrapper = $${basedirectory:services}/equeue
wrapper = $${basedirectory:services}/equeue
equeue-binary = ${buildout:bin-directory}/equeue
equeue-binary = ${buildout:bin-directory}/equeue
[notifier-port]
recipe = slapos.cookbook:free_port
minimum = 8088
maximum = 8097
ip = $${notifier:host}
# notifier.notify adds the [exporter, notifier] to the execution queue
# notifier.notify adds the [exporter, notifier] to the execution queue
# notifier.notify.callback sets up a callback
# notifier.notify.callback sets up a callback
[notifier]
[notifier]
...
@@ -81,11 +87,10 @@ wrapper = $${basedirectory:services}/notifier
...
@@ -81,11 +87,10 @@ wrapper = $${basedirectory:services}/notifier
mode = 0700
mode = 0700
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 $${directory:notifier-callbacks} --feeds $${directory:notifier-feeds} --equeue-socket $${equeue:socket} --logfile $${basedirectory:log}/notifier.log $${:host} $${:port}
host = $${slap-network-information:global-ipv6}
host = $${slap-network-information:global-ipv6}
port =
8088
port =
$${notifier-port:port}
context =
context =
key content notifier:command
key content notifier:command
[logrotate-entry-equeue]
[logrotate-entry-equeue]
<= logrotate
<= logrotate
recipe = slapos.cookbook:logrotate.d
recipe = slapos.cookbook:logrotate.d
...
...
stack/resilient/pbsready-export.cfg.in
View file @
c7f71ecf
...
@@ -18,6 +18,7 @@ parts =
...
@@ -18,6 +18,7 @@ parts =
resilient-sshkeys-sshd-promise
resilient-sshkeys-sshd-promise
sshd-pbs-authorized-key
sshd-pbs-authorized-key
notifier
notifier
notifier-exporter-promise
cron-entry-backup
cron-entry-backup
...
@@ -36,6 +37,12 @@ minimum = 22200
...
@@ -36,6 +37,12 @@ minimum = 22200
maximum = 22209
maximum = 22209
ip = $${slap-network-information:global-ipv6}
ip = $${slap-network-information:global-ipv6}
[notifier-port]
recipe = slapos.cookbook:free_port
minimum = 65526
maximum = 65535
ip = $${notifier:host}
[resilient-publish-connection-parameter]
[resilient-publish-connection-parameter]
notification-id = http://[$${notifier:host}]:$${notifier:port}/get/$${notifier-exporter:name}
notification-id = http://[$${notifier:host}]:$${notifier:port}/get/$${notifier-exporter:name}
...
@@ -51,6 +58,16 @@ wrapper = $${rootdirectory:bin}/exporter
...
@@ -51,6 +58,16 @@ wrapper = $${rootdirectory:bin}/exporter
notify = $${slap-parameter:notify}
notify = $${slap-parameter:notify}
pidfile = $${resilient-directory:pid}/$${:name}.pid
pidfile = $${resilient-directory:pid}/$${:name}.pid
[notifier-exporter-promise]
recipe = slapos.recipe.template:jinja2
mode = 700
template = inline:
#!${bash:location}/bin/bash
EXPORTER_FEED="$${notifier-exporter:log-file}"
FAILURE_PATTERN="FAILURE"
tail -n 1 $EXPORTER_FEED | grep -vq FAILURE_PATTERN
rendered = $${basedirectory:promises}/exporter-status
[cron-entry-backup]
[cron-entry-backup]
# Schedule the periodic database dump.
# Schedule the periodic database dump.
# Through notifications, this triggers (one or more) incremental backups on PBS instances.
# Through notifications, this triggers (one or more) incremental backups on PBS instances.
...
...
stack/resilient/pbsready-import.cfg.in
View file @
c7f71ecf
...
@@ -42,8 +42,11 @@ maximum = 22219
...
@@ -42,8 +42,11 @@ maximum = 22219
ip = $${slap-network-information:global-ipv6}
ip = $${slap-network-information:global-ipv6}
# Define port of notifier (same reason)
# Define port of notifier (same reason)
[notifier]
[notifier-port]
port = 65533
recipe = slapos.cookbook:free_port
minimum = 65516
maximum = 65525
ip = $${notifier:host}
[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)
...
...
stack/resilient/pbsready.cfg.in
View file @
c7f71ecf
...
@@ -165,7 +165,7 @@ callbacks = $${directory:notifier-callbacks}
...
@@ -165,7 +165,7 @@ callbacks = $${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 $${directory:notifier-callbacks} --feeds $${directory:notifier-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 =
65534
port =
$${notifier-port:port}
context =
context =
key content notifier:command
key content notifier:command
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment