diff --git a/docs/installation.md b/docs/installation.md index 81ffe181..c46d46e5 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 diff --git a/docs/migrating_to_17.md b/docs/migrating_to_17.md index 77774981..e11e662f 100644 --- a/docs/migrating_to_17.md +++ b/docs/migrating_to_17.md @@ -84,7 +84,24 @@ bento_authz public-data-access counts ``` -## 5. Start Bento +## 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' +``` + +## 6. Start Bento ```bash ./bentoctl.bash start diff --git a/etc/bento_deploy.env b/etc/bento_deploy.env index b120f6ff..24f63cc1 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' BENTO_MONITORING_ENABLED='false' diff --git a/etc/bento_dev.env b/etc/bento_dev.env index 895618df..ee4dba0c 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' BENTO_MONITORING_ENABLED='false' diff --git a/etc/default_config.env b/etc/default_config.env index 21c9175c..d150afdc 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' BENTO_MONITORING_ENABLED='false' 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..4637be11 --- /dev/null +++ b/etc/templates/beacon/beacon_network_config.example.json @@ -0,0 +1,10 @@ +{ + "beacons": [ + "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, + "network_variants_query_timeout_seconds": 120 +} diff --git a/lib/public/docker-compose.public.yaml b/lib/public/docker-compose.public.yaml index 16a7f79f..f576ff74 100644 --- a/lib/public/docker-compose.public.yaml +++ b/lib/public/docker-compose.public.yaml @@ -16,6 +16,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} 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 225d43d3..0d4d87cf 100644 --- a/py_bentoctl/other_helpers.py +++ b/py_bentoctl/other_helpers.py @@ -631,12 +631,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") @@ -648,6 +650,17 @@ 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"]) + + 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")