Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OHDSI workspace service #3552

Merged
merged 16 commits into from
Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/workspace_services/ohdsi/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apt-get update && apt-get install -y curl gnupg && \
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get install -y git --no-install-recommends

# PosgreSql is required by Atlas
# PostgreSql is required by Atlas
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get install -y postgresql-client gettext apache2-utils curl jq --no-install-recommends

Expand Down
17 changes: 17 additions & 0 deletions templates/workspace_services/ohdsi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# OHDSI Workspace Service

### IMPORTANT
- This workspace service does not work "out of the box". It requires additional networking configuration to work properly. See the [Networking configuration](#networking-configuration) section for more details.
- Currently the only data source supported by the workspace service is Azure Synapse.

# Networking configuration
Deploying the OHDSI workspace is not enough for it to function properly, in order for it to work properly, the following networking configuration should be in place:

### 1. The resource processor should be able to access the data source
Multiple OHDSI workspace services cannot share the same schemas because each OHDSI instance is changing the schemas, which could potentially cause conflicts. To avoid this, every workspace service must work on its own schemas. To do this, we use golden copying. This means that the "main" schemas remain untouched, and every workspace service has its own copy of it, which it can modify.

Since the resource processor is in charge of duplicating the schemas, the data source has to be accessible from the resource processor's VNet in order to be able to create them.


### 2. The workspace should be able to access the data source
In order to access the CDM from ATLAS, the data source should be accessible from the workspace's VNet.
8 changes: 2 additions & 6 deletions templates/workspace_services/ohdsi/porter.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
schemaVersion: 1.0.0
name: tre-workspace-service-ohdsi
version: 0.1.71
description: "A OHDSI workspace service"
version: 0.1.94
description: "An OHDSI workspace service"
registry: azuretre
dockerfile: Dockerfile.tmpl

Expand Down Expand Up @@ -50,12 +50,8 @@ parameters:
default: false
- name: arm_environment
type: string
# TODO: remove the default value for arm_environment when the TRE version is 0.10.0 or higher
default: "public"
- name: azure_environment
type: string
# TODO: remove the default value for arm_environment when the TRE version is 0.10.0 or higher
default: "AzureCloud"
description: "Used by Azure CLI to set the Azure environment"

# parameters for configuring the data source
Expand Down
153 changes: 151 additions & 2 deletions templates/workspace_services/ohdsi/template_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"data_source_daimons": {
"type": "object",
"title": "Source Daimons",
"description": "Optionally configure source daimons",
"description": "Configure source daimons",
"default": null,
"properties": {
"daimon_cdm": {
Expand All @@ -109,7 +109,12 @@
"type": "string",
"title": "Temp Schema to copy"
}
}
},
"required": [
"daimon_cdm",
"daimon_vocabulary",
"daimon_results"
]
}
}
}
Expand Down Expand Up @@ -149,6 +154,78 @@
}
}
]
},
{
"stepId": "37d7fbde-fd61-4096-ac4d-741960474995",
"stepTitle": "Add firewall rules for AAD",
"resourceTemplateName": "tre-shared-service-firewall",
"resourceType": "shared-service",
"resourceAction": "upgrade",
"properties": [
{
"name": "network_rule_collections",
"type": "array",
"arraySubstitutionAction": "replace",
"arrayMatchField": "name",
"value": {
"name": "nrc_svc_{{ resource.id }}",
"action": "Allow",
"rules": [
{
"name": "AzureAD",
"description": "Allow access to AAD",
"source_addresses": "{{ resource.parent.properties.address_spaces }}",
"destination_addresses": [
"AzureActiveDirectory"
],
"destination_ports": [
"*"
],
"protocols": [
"TCP"
]
}
]
}
},
{
"name": "rule_collections",
"type": "array",
"arraySubstitutionAction": "replace",
"arrayMatchField": "name",
"value": {
"name": "arc_svc_{{ resource.id }}",
"action": "Allow",
"rules": [
{
"name": "microsoft-aad",
"description": "Allow AAD FQDNs",
"source_addresses": "{{ resource.parent.properties.address_spaces }}",
"target_fqdns": [
"*.msftauth.net",
"*.msauth.net",
"login.microsoftonline.com",
"aadcdn.msftauthimages.net",
"aadcdn.msauthimages.net",
"*.login.live.com",
"*.microsoftonline-p.com",
"msft.sts.microsoft.com"
],
"protocols": [
{
"port": "80",
"type": "Http"
},
{
"port": "443",
"type": "Https"
}
]
}
]
}
}
]
}
],
"upgrade": [
Expand Down Expand Up @@ -179,6 +256,78 @@
}
}
]
},
{
"stepId": "3329d760-3e09-4721-8722-f369b123ca77",
"stepTitle": "Add firewall rules for AAD",
"resourceTemplateName": "tre-shared-service-firewall",
"resourceType": "shared-service",
"resourceAction": "upgrade",
"properties": [
{
"name": "network_rule_collections",
"type": "array",
"arraySubstitutionAction": "replace",
"arrayMatchField": "name",
"value": {
"name": "nrc_svc_{{ resource.id }}",
"action": "Allow",
"rules": [
{
"name": "AzureAD",
"description": "Allow access to AAD",
"source_addresses": "{{ resource.parent.properties.address_spaces }}",
"destination_addresses": [
"AzureActiveDirectory"
],
"destination_ports": [
"*"
],
"protocols": [
"TCP"
]
}
]
}
},
{
"name": "rule_collections",
"type": "array",
"arraySubstitutionAction": "replace",
"arrayMatchField": "name",
"value": {
"name": "arc_svc_{{ resource.id }}",
"action": "Allow",
"rules": [
{
"name": "microsoft-aad",
"description": "Allow AAD FQDNs",
"source_addresses": "{{ resource.parent.properties.address_spaces }}",
"target_fqdns": [
"*.msftauth.net",
"*.msauth.net",
"login.microsoftonline.com",
"aadcdn.msftauthimages.net",
"aadcdn.msauthimages.net",
"*.login.live.com",
"*.microsoftonline-p.com",
"msft.sts.microsoft.com"
],
"protocols": [
{
"port": "80",
"type": "Http"
},
{
"port": "443",
"type": "Https"
}
]
}
]
}
}
]
}
],
"uninstall": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ resource "azurerm_postgresql_flexible_server" "postgres" {
administrator_login = local.postgres_admin_username
administrator_password = azurerm_key_vault_secret.postgres_admin_password.value
storage_mb = var.postgres_storage_size_in_mb
zone = "1"
tags = local.tre_workspace_service_tags

timeouts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resource "terraform_data" "add_data_source" {
depends_on = [terraform_data.deployment_atlas_security]
}

resource "terraform_data" "init_schemas" {
resource "terraform_data" "init_synapse_schemas" {
count = local.is_synapse_data_source && local.daimon_results != null && local.daimon_temp != null ? 1 : 0

provisioner "local-exec" {
Expand Down