From f6b85c29ee6aac6eb3033250cda2ae71f9f1c0ef Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Mon, 25 Sep 2023 09:58:20 -0300 Subject: [PATCH 1/3] Set discoveryserver public ip address The discoveryserver will reply to requests including the host's ip address when passed via the command line argument, this configures the snap with the unit's public-address Depends-On: https://github.com/openstack-charmers/snap-discoveryserver/pull/2 --- src/charm.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/charm.py b/src/charm.py index bbd0255..d2a698c 100755 --- a/src/charm.py +++ b/src/charm.py @@ -13,6 +13,7 @@ """ import logging +import subprocess from ops.charm import CharmBase from ops.framework import StoredState @@ -45,10 +46,16 @@ def _on_install(self, event): snap_names='discoveryserver', channel='latest/edge', ) - logger.debug('Successfully install discoveryserver') + logger.info('Successfully install discoveryserver') + ingress_address = subprocess.check_output(['unit-get', + 'public-address']) + ingress_address = ingress_address.decode('utf-8').strip() + logger.info('Setting discovery.host=%s', ingress_address) + discovery_server.set({'discovery.host': ingress_address}) except snap.SnapError as e: logger.exception('Error occurred installing discoveryserver snap.') - raise + raise e + # Learn more about statuses in the SDK docs: # https://juju.is/docs/sdk/constructs#heading--statuses self.unit.status = ActiveStatus() From 37a7a41cfabfaf975e8449cfd59837d5c7e9ea7b Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Mon, 25 Sep 2023 10:00:27 -0300 Subject: [PATCH 2/3] Register open port --- src/charm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/charm.py b/src/charm.py index d2a698c..aaa991e 100755 --- a/src/charm.py +++ b/src/charm.py @@ -58,6 +58,7 @@ def _on_install(self, event): # Learn more about statuses in the SDK docs: # https://juju.is/docs/sdk/constructs#heading--statuses + self.unit.open_port('tcp', 8087) self.unit.status = ActiveStatus() From b81f235e1bfd09c717052dbc7d71075b295016f5 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Mon, 25 Sep 2023 10:52:43 -0300 Subject: [PATCH 3/3] Declare explicit set of architectures supported. --- charmcraft.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/charmcraft.yaml b/charmcraft.yaml index 048d454..2b26609 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -3,8 +3,11 @@ type: "charm" bases: - build-on: - - name: "ubuntu" - channel: "20.04" + - name: ubuntu + channel: "20.04" + architectures: + - amd64 run-on: - - name: "ubuntu" - channel: "20.04" + - name: ubuntu + channel: "20.04" + architectures: [amd64, s390x, ppc64el, arm64]