Skip to content

Commit

Permalink
Merge pull request #259 from bento-platform/add-beacon-network-config
Browse files Browse the repository at this point in the history
Add beacon network
  • Loading branch information
gsfk committed Sep 17, 2024
2 parents 14028d0 + 7128246 commit 7336b00
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 18 additions & 1 deletion docs/migrating_to_17.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions etc/bento_deploy.env
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions etc/bento_dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions etc/default_config.env
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 10 additions & 0 deletions etc/templates/beacon/beacon_network_config.example.json
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions lib/public/docker-compose.public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 5 additions & 1 deletion py_bentoctl/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
15 changes: 14 additions & 1 deletion py_bentoctl/other_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 7336b00

Please sign in to comment.