-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's way simpler to do the signaling using dbus instead of NATS. It's an open, local only solution with authorization built-in.
- Loading branch information
Showing
15 changed files
with
122 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
debian/usr/share/dbus-1/system.d/nginx-config-reloader-bus.conf /usr/share/dbus-1/system.d |
20 changes: 20 additions & 0 deletions
20
debian/usr/share/dbus-1/system.d/nginx-config-reloader-bus.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE busconfig PUBLIC | ||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
<policy user="root"> | ||
<allow own="com.hypernode.NginxConfigReloader"/> | ||
</policy> | ||
<policy user="root"> | ||
<allow send_destination="com.hypernode.NginxConfigReloader"/> | ||
<allow receive_sender="com.hypernode.NginxConfigReloader"/> | ||
</policy> | ||
<policy group="adm"> | ||
<allow send_destination="com.hypernode.NginxConfigReloader"/> | ||
<allow receive_sender="com.hypernode.NginxConfigReloader"/> | ||
</policy> | ||
<policy user="app"> | ||
<allow send_destination="com.hypernode.NginxConfigReloader"/> | ||
<allow receive_sender="com.hypernode.NginxConfigReloader"/> | ||
</policy> | ||
</busconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from dasbus.connection import SystemMessageBus | ||
from dasbus.identifier import DBusServiceIdentifier | ||
|
||
SYSTEM_BUS = SystemMessageBus() | ||
|
||
NGINX_CONFIG_RELOADER = DBusServiceIdentifier( | ||
namespace=("com", "hypernode", "NginxConfigReloader"), | ||
message_bus=SYSTEM_BUS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from dasbus.server.interface import dbus_interface, dbus_signal | ||
from dasbus.server.property import emits_properties_changed | ||
from dasbus.server.template import InterfaceTemplate | ||
|
||
from nginx_config_reloader.dbus.common import NGINX_CONFIG_RELOADER | ||
|
||
|
||
@dbus_interface(NGINX_CONFIG_RELOADER.interface_name) | ||
class NginxConfigReloaderInterface(InterfaceTemplate): | ||
def connect_signals(self): | ||
self.implementation.reloaded.connect(self.ConfigReloaded) | ||
|
||
@dbus_signal | ||
def ConfigReloaded(self): | ||
"""Signal that the config was reloaded""" | ||
|
||
@emits_properties_changed | ||
def Reload(self): | ||
"""Mark the last reload at current time.""" | ||
# send_signal=False because we don't want to emit the signal | ||
self.implementation.apply_new_config(send_signal=False) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from nginx_config_reloader import dbus_event_loop | ||
from tests.testcase import TestCase | ||
|
||
|
||
class TestDbusEventLoop(TestCase): | ||
def setUp(self): | ||
self.event_loop = self.set_up_patch("nginx_config_reloader.EventLoop") | ||
|
||
def test_it_runs_dbus_event_loop(self): | ||
dbus_event_loop() | ||
|
||
self.event_loop.assert_called_once_with() | ||
self.event_loop.return_value.run.assert_called_once_with() |
Oops, something went wrong.