From 5ef4839c9f1bdeec3ece0520acabdaf9b491a9bb Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Thu, 15 Aug 2024 14:36:25 -0400 Subject: [PATCH 01/13] add draft becon network config file --- .../beacon/beacon_network_config.example.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 etc/templates/beacon/beacon_network_config.example.json diff --git a/etc/templates/beacon/beacon_network_config.example.json b/etc/templates/beacon/beacon_network_config.example.json new file mode 100644 index 00000000..dbda2c4f --- /dev/null +++ b/etc/templates/beacon/beacon_network_config.example.json @@ -0,0 +1,10 @@ +{ + "beacons": [ + "https://rsrq.bento.sd4h.ca/api/beacon", + "https://bqc19.bento.sd4h.ca/api/beacon", + "https://staging.bento.sd4h.ca/api/beacon", + "https://bentov2.local/api/beacon" + ], + "network_default_timeout_seconds": 30, + "network_variants_query_timeout_seconds": 120 +} From 69769b388b914274bf886b0d008f593ad64c0a2a Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Mon, 26 Aug 2024 09:21:03 -0400 Subject: [PATCH 02/13] add feature switch for beacon network --- etc/bento_deploy.env | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/bento_deploy.env b/etc/bento_deploy.env index 86a5c98a..6d550cb2 100644 --- a/etc/bento_deploy.env +++ b/etc/bento_deploy.env @@ -10,6 +10,7 @@ BENTO_GATEWAY_USE_TLS='true' BENTO_BEACON_ENABLED='false' # Set to true if using Beacon! BENTO_BEACON_UI_ENABLED='false' +BENTO_BEACON_NETWORK_ENABLED='false' BENTO_CBIOPORTAL_ENABLED='false' BENTO_GOHAN_ENABLED='true' From 572abc630113de0dbedb6f9315cf8e8b410fb4b2 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Mon, 26 Aug 2024 10:44:09 -0400 Subject: [PATCH 03/13] propagate env values to beacon and public --- lib/beacon/docker-compose.beacon.yaml | 1 + lib/public/docker-compose.public.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/beacon/docker-compose.beacon.yaml b/lib/beacon/docker-compose.beacon.yaml index 3a512284..ee6a8b31 100644 --- a/lib/beacon/docker-compose.beacon.yaml +++ b/lib/beacon/docker-compose.beacon.yaml @@ -23,6 +23,7 @@ services: - BENTOV2_DOMAIN - BENTOV2_PUBLIC_URL - BENTO_BEACON_UI_ENABLED + - BENTO_BEACON_NETWORK_ENABLED - BENTO_AUTHZ_SERVICE_URL - DRS_URL=${BENTOV2_PUBLIC_URL}/api/drs volumes: diff --git a/lib/public/docker-compose.public.yaml b/lib/public/docker-compose.public.yaml index 25ec8f7a..0dc4abbf 100644 --- a/lib/public/docker-compose.public.yaml +++ b/lib/public/docker-compose.public.yaml @@ -17,6 +17,7 @@ services: - BENTO_PUBLIC_PORTAL_URL - BENTO_PUBLIC_TRANSLATED - BENTO_BEACON_UI_ENABLED + - BENTO_BEACON_NETWORK_ENABLED - BEACON_URL=${BENTOV2_PUBLIC_URL}/api/beacon - INTERNAL_PORT=${BENTO_PUBLIC_INTERNAL_PORT} - BENTO_PUBLIC_URL=${BENTOV2_PUBLIC_URL} From 9d636ca2dab72312b2ee095148d3fd96b2830e5c Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 09:03:12 -0400 Subject: [PATCH 04/13] beacon network switches --- etc/bento_dev.env | 1 + etc/default_config.env | 1 + 2 files changed, 2 insertions(+) diff --git a/etc/bento_dev.env b/etc/bento_dev.env index 884d1d65..7837c540 100644 --- a/etc/bento_dev.env +++ b/etc/bento_dev.env @@ -10,6 +10,7 @@ BENTO_GATEWAY_USE_TLS='true' BENTO_BEACON_ENABLED='true' BENTO_BEACON_UI_ENABLED='true' +BENTO_BEACON_NETWORK_ENABLED='false' BENTO_CBIOPORTAL_ENABLED='false' BENTO_GOHAN_ENABLED='true' diff --git a/etc/default_config.env b/etc/default_config.env index 949f7309..9831f3de 100644 --- a/etc/default_config.env +++ b/etc/default_config.env @@ -15,6 +15,7 @@ BENTO_GATEWAY_USE_TLS='true' BENTO_BEACON_ENABLED='true' BENTO_BEACON_UI_ENABLED='true' +BENTO_BEACON_NETWORK_ENABLED='false' BENTO_CBIOPORTAL_ENABLED='false' BENTO_GOHAN_ENABLED='true' From 3dc7eb419c61fda12c8ccb4b98716ca5ac70a90b Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 09:59:13 -0400 Subject: [PATCH 05/13] add bentoctl helper for copying beacon network config file --- py_bentoctl/entry.py | 6 +++++- py_bentoctl/other_helpers.py | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/py_bentoctl/entry.py b/py_bentoctl/entry.py index 14c297f9..53d0cd3a 100644 --- a/py_bentoctl/entry.py +++ b/py_bentoctl/entry.py @@ -282,7 +282,11 @@ class InitConfig(SubCommand): @staticmethod def add_args(sp): sp.add_argument( - "service", type=str, choices=["katsu", "beacon"], help="Prepares services for deployment.") + "service", + type=str, + choices=["katsu", "beacon", "beacon-network"], + help="Prepares services for deployment." + ) sp.add_argument( "--force", "-f", action="store_true", help="Overwrites any existing config.") diff --git a/py_bentoctl/other_helpers.py b/py_bentoctl/other_helpers.py index 40dbf6ac..a7216d75 100644 --- a/py_bentoctl/other_helpers.py +++ b/py_bentoctl/other_helpers.py @@ -627,12 +627,14 @@ def init_config(service: str, force: bool = False): _init_katsu_config(force) elif service == "beacon": _init_beacon_config(force) + elif service == "beacon-network": + _init_beacon_network_config(force) def _init_beacon_config(force: bool): root_path = pathlib.Path.cwd() template_dir = (root_path / "etc" / "templates" / "beacon") - dest_dir = (root_path / "lib" / "beacon" / "config") + dest_dir = pathlib.Path(os.environ["BENTO_BEACON_CONFIG_DIR"]) config_template_path = (template_dir / "beacon_config.example.json") config_dest_path = (dest_dir / "beacon_config.json") @@ -644,6 +646,18 @@ def _init_beacon_config(force: bool): _file_copy(cohort_template_path, cohort_dest_path, force) +def _init_beacon_network_config(force: bool): + root_path = pathlib.Path.cwd() + template_dir = (root_path / "etc" / "templates" / "beacon") + dest_dir = pathlib.Path(os.environ["BENTO_BEACON_CONFIG_DIR"]) + print(f"network config dir: {dest_dir}") + + network_config_template_path = (template_dir / "beacon_network_config.example.json") + network_config_dest_path = (dest_dir / "beacon_network_config.json") + + _file_copy(network_config_template_path, network_config_dest_path, force) + + def _init_katsu_config(force: bool): root_path = pathlib.Path.cwd() katsu_config_template_path = (root_path / "etc" / "katsu.config.example.json") From 83923f2bb3458964d8c6df73f335722b3d4a7543 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 10:22:41 -0400 Subject: [PATCH 06/13] add beacon network config to docs --- docs/installation.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/installation.md b/docs/installation.md index d70f84ce..2394c379 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -158,6 +158,14 @@ If using Beacon, first copy the configuration file: Then update any config values as needed at `lib/beacon/config/beacon_config.json` and `lib/beacon/config/beacon_cohort.json`. +If using the beacon network, copy the configuration file: + +```bash +./bentoctl.bash init-config beacon-network +``` + +and update values at `lib/beacon/config/beacon_network_config.json`. + ### Gohan configuration From bf383ce9baa373265f9773ae781c8dbd6dc80062 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 10:28:46 -0400 Subject: [PATCH 07/13] more generic beacon network config file --- etc/templates/beacon/beacon_network_config.example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/templates/beacon/beacon_network_config.example.json b/etc/templates/beacon/beacon_network_config.example.json index dbda2c4f..4637be11 100644 --- a/etc/templates/beacon/beacon_network_config.example.json +++ b/etc/templates/beacon/beacon_network_config.example.json @@ -1,8 +1,8 @@ { "beacons": [ - "https://rsrq.bento.sd4h.ca/api/beacon", "https://bqc19.bento.sd4h.ca/api/beacon", "https://staging.bento.sd4h.ca/api/beacon", + "https://qa.bento.sd4h.ca/api/beacon", "https://bentov2.local/api/beacon" ], "network_default_timeout_seconds": 30, From 8f9f48a143d118ef0f4bd0e1cb327c516f07e8f4 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 10:30:49 -0400 Subject: [PATCH 08/13] rm test print --- py_bentoctl/other_helpers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/py_bentoctl/other_helpers.py b/py_bentoctl/other_helpers.py index f711a8fb..0d4d87cf 100644 --- a/py_bentoctl/other_helpers.py +++ b/py_bentoctl/other_helpers.py @@ -654,7 +654,6 @@ def _init_beacon_network_config(force: bool): root_path = pathlib.Path.cwd() template_dir = (root_path / "etc" / "templates" / "beacon") dest_dir = pathlib.Path(os.environ["BENTO_BEACON_CONFIG_DIR"]) - print(f"network config dir: {dest_dir}") network_config_template_path = (template_dir / "beacon_network_config.example.json") network_config_dest_path = (dest_dir / "beacon_network_config.json") From 4cecba1aea1bf6d30c2d920b975c977b968a6a0c Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 13:29:04 -0400 Subject: [PATCH 09/13] docs: caps --- docs/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.md b/docs/installation.md index 82752c5a..c46d46e5 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -158,7 +158,7 @@ If using Beacon, first copy the configuration file: Then update any config values as needed at `lib/beacon/config/beacon_config.json` and `lib/beacon/config/beacon_cohort.json`. -If using the beacon network, copy the configuration file: +If using the Beacon network, copy the configuration file: ```bash ./bentoctl.bash init-config beacon-network From 380b084cbb92fe1a7301beb9381bc7dc29698201 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 13:52:41 -0400 Subject: [PATCH 10/13] docs: beacon network migration --- docs/migrating_to_17.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/migrating_to_17.md b/docs/migrating_to_17.md index 77774981..1d5f45b8 100644 --- a/docs/migrating_to_17.md +++ b/docs/migrating_to_17.md @@ -84,6 +84,21 @@ bento_authz public-data-access counts ``` +## 5. Optionally, add Beacon network + +To host a network of beacons, with a corresponding UI in bento_public, first copy the config file: + +```bash +./bentoctl.bash init-config beacon-network +``` + +then update values at `lib/beacon/config/beacon_network_config.json`. Activate the network by adding (or modifying) this value in local.env: + + +```bash +BENTO_BEACON_NETWORK_ENABLED='true' +``` + ## 5. Start Bento ```bash From 97a69a63486ec29c212671db7790aa06d66c8322 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 14:01:26 -0400 Subject: [PATCH 11/13] docs: caps --- docs/migrating_to_17.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migrating_to_17.md b/docs/migrating_to_17.md index 1d5f45b8..0d8d5134 100644 --- a/docs/migrating_to_17.md +++ b/docs/migrating_to_17.md @@ -86,7 +86,7 @@ bento_authz public-data-access counts ## 5. Optionally, add Beacon network -To host a network of beacons, with a corresponding UI in bento_public, first copy the config file: +To host a network of beacons, with a corresponding UI in Bento Public, first copy the config file: ```bash ./bentoctl.bash init-config beacon-network From f1b084cb20e033f7cbc54940bde509ca30ef238b Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 14:18:20 -0400 Subject: [PATCH 12/13] docs: more beacon network migration --- docs/migrating_to_17.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/migrating_to_17.md b/docs/migrating_to_17.md index 0d8d5134..0e3b6eb0 100644 --- a/docs/migrating_to_17.md +++ b/docs/migrating_to_17.md @@ -95,10 +95,14 @@ To host a network of beacons, with a corresponding UI in Bento Public, first cop then update values at `lib/beacon/config/beacon_network_config.json`. Activate the network by adding (or modifying) this value in local.env: +## 6. Add env variable for Beacon network + +Add this value to local.env (with the value `true` if you want to activate the network) ```bash -BENTO_BEACON_NETWORK_ENABLED='true' +BENTO_BEACON_NETWORK_ENABLED='false' ``` + ## 5. Start Bento ```bash From 712824681e5b70488ad10d32aeb6bee539b78b61 Mon Sep 17 00:00:00 2001 From: Gordon Krieger Date: Tue, 17 Sep 2024 14:27:42 -0400 Subject: [PATCH 13/13] docs: 6 is the number after 5 --- docs/migrating_to_17.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/migrating_to_17.md b/docs/migrating_to_17.md index 0e3b6eb0..e11e662f 100644 --- a/docs/migrating_to_17.md +++ b/docs/migrating_to_17.md @@ -92,18 +92,16 @@ To host a network of beacons, with a corresponding UI in Bento Public, first cop ./bentoctl.bash init-config beacon-network ``` -then update values at `lib/beacon/config/beacon_network_config.json`. Activate the network by adding (or modifying) this value in local.env: -## 6. Add env variable for Beacon network +then update values at `lib/beacon/config/beacon_network_config.json`. Activate the network by adding (or modifying) this value in local.env: + -Add this value to local.env (with the value `true` if you want to activate the network) ```bash -BENTO_BEACON_NETWORK_ENABLED='false' +BENTO_BEACON_NETWORK_ENABLED='true' ``` - -## 5. Start Bento +## 6. Start Bento ```bash ./bentoctl.bash start