Skip to content
Snippets Groups Projects
Commit d266ee7a authored by Marius Kriegerowski's avatar Marius Kriegerowski Committed by Marius Kriegerowski
Browse files

configure instances through yaml files

parent 9c6e14e5
No related branches found
No related tags found
No related merge requests found
Pipeline #21859 passed
......@@ -41,6 +41,9 @@ async def main():
# Initiate the message bus
message_bus = MessageBus()
# pylint: disable=no-value-for-parameter
await message_bus.connect(config_file="rabotnik-message-bus.yml")
logger.info("running: instance a")
# Trigger a very simple 'building' task
......
---
username: test
password: test
host: rabotnik-message-bus
......@@ -34,7 +34,6 @@ logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
rabotnik = Rabotnik("instance-b")
message_bus = MessageBus()
logger.info("running: instance b")
......@@ -53,6 +52,10 @@ def building(building_id):
async def main():
message_bus = MessageBus()
# pylint: disable=no-value-for-parameter
await message_bus.connect(config_file="rabotnik-message-bus.yml")
await message_bus.subscribe("building", building)
......
---
username: test
password: test
host: rabotnik-message-bus
......@@ -34,7 +34,6 @@ logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
rabotnik = Rabotnik("instance-c")
message_bus = MessageBus()
logger.info("running: instance c")
......@@ -50,6 +49,10 @@ def building(building_id):
async def main():
message_bus = MessageBus()
# pylint: disable=no-value-for-parameter
await message_bus.connect(config_file="rabotnik-message-bus.yml")
await message_bus.subscribe("building", building)
......
---
username: test
password: test
host: rabotnik-message-bus
......@@ -40,15 +40,18 @@ async def main():
# Initiate the message bus
message_bus = MessageBus()
# pylint: disable=no-value-for-parameter
await message_bus.connect(config_file="rabotnik-message-bus.yml")
logger.info("running: receiver")
# Get a storage connection to `database_1` (source)
storage_a = rabotnik.get_storage("postgresql")
await storage_a.connect(user="postgres", host="database-1", port="5432")
await storage_a.connect(config_file="storage-a.yml")
# Get a storage connection to `database_2` (receiver)
storage_b = rabotnik.get_storage("postgresql")
await storage_b.connect(user="postgres", host="database-1", port="5432")
await storage_b.connect(config_file="storage-b.yml")
# await message_bus.subscribe('building', print_payload)
rule = MigrateBuilding(storage_a, storage_b)
......
---
username: test
password: test
host: rabotnik-message-bus
---
user: test
password: test
dbname: buildings
host: database-1
port: 5432
---
user: test
password: test
dbname: buildings
host: database-2
port: 5432
......@@ -46,3 +46,9 @@ services:
build: ../docker-rabotnik-instance
volumes:
- ../rabotnik:/srv/rabotnik
# rabotnik instance migration
rabotnik-instance-migration:
build: ../docker-rabotnik-instance
volumes:
- ../rabotnik:/srv/rabotnik
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment