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

cran support in nexus #2694

Merged
merged 28 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
63f9442
add cran support
Sep 29, 2022
d9a2cb2
linux vm config
Sep 29, 2022
b555354
linux vm config edit
Sep 29, 2022
91a397a
Base type r
JaimieWi Oct 3, 2022
c66b69b
fix vm scripts
JaimieWi Oct 3, 2022
e3170b2
windows powershell edit
JaimieWi Oct 3, 2022
9ac8d94
ps file content config
JaimieWi Oct 3, 2022
736c064
corrected naming for allowed workspace fqdns
JaimieWi Oct 3, 2022
e460043
Merge branch 'main' into JaimieWi/cran_support
JaimieWi Oct 3, 2022
7fc6511
edit to nexus firewall config
JaimieWi Oct 5, 2022
5e66243
nsg fix and firewall config
JaimieWi Oct 6, 2022
e11b42e
moving firewall addition to workspace so that the rule is added on cr…
JaimieWi Oct 6, 2022
40de44b
fix references
JaimieWi Oct 6, 2022
477d772
revert base and add to nexus
JaimieWi Oct 6, 2022
50cb958
alter output config
JaimieWi Oct 6, 2022
8b9fe78
add acr parameter
JaimieWi Oct 7, 2022
8867c1c
source address to array missing output
JaimieWi Oct 7, 2022
9750d8f
porter version
JaimieWi Oct 7, 2022
5920df8
fixing final issues
JaimieWi Oct 10, 2022
1afcf2a
Final windows config changes
JaimieWi Oct 11, 2022
a11e37f
versions
JaimieWi Oct 11, 2022
58ba38b
Merge branch 'main' into JaimieWi/cran_support
JaimieWi Oct 11, 2022
40dc3ba
remove mgmt_acr and certain CRLs
JaimieWi Oct 17, 2022
2479289
Merge branch 'main' into JaimieWi/cran_support
damoodamoo Oct 18, 2022
b84c966
terraform configuration
JaimieWi Oct 18, 2022
37a7c1b
TFlint fixes
JaimieWi Oct 18, 2022
517dca1
outputs.tf
JaimieWi Oct 18, 2022
f7336e4
Merge branch 'main' into JaimieWi/cran_support
JaimieWi Oct 18, 2022
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
6 changes: 6 additions & 0 deletions templates/shared_services/sonatype-nexus-vm/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
"env": "ID"
}
},
{
"name": "mgmt_acr_name",
"source": {
"env": "ACR_NAME"
}
},
{
"name": "tfstate_container_name",
"source": {
Expand Down
52 changes: 46 additions & 6 deletions templates/shared_services/sonatype-nexus-vm/porter.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: tre-shared-service-sonatype-nexus
version: 2.2.0
version: 2.2.1
description: "A Sonatype Nexus shared service"
registry: azuretre
dockerfile: Dockerfile.tmpl
registry: azuretre

credentials:
- name: azure_tenant_id
Expand All @@ -21,6 +21,9 @@ parameters:
- name: id
type: string
description: "Resource ID"
- name: mgmt_acr_name
type: string
description: "The name of the Azure Container Registry"
- name: tfstate_resource_group_name
type: string
description: "Resource group containing the Terraform state storage account"
Expand All @@ -39,6 +42,21 @@ parameters:
type: string
default: "nexus-ssl"
description: "Name of the certificate for configuring Nexus SSL with (stored in the core KeyVault)"
outputs:
- name: workspace_vm_allowed_fqdns_list
type: string
applyTo:
- install
- upgrade
- name: nexus_allowed_fqdns_list
type: string
applyTo:
- install
- upgrade
- name: shared_address_prefixes
applyTo:
- install
- upgrade

mixins:
- exec
Expand All @@ -54,17 +72,37 @@ install:
tre_id: "{{ bundle.parameters.tre_id }}"
tre_resource_id: "{{ bundle.parameters.id }}"
ssl_cert_name: "{{ bundle.parameters.ssl_cert_name }}"
mgmt_resource_group_name: "{{ bundle.parameters.tfstate_resource_group_name }}"
acr_name: "{{ bundle.parameters.mgmt_acr_name }}"

backendConfig:
resource_group_name: "{{ bundle.parameters.tfstate_resource_group_name }}"
storage_account_name: "{{ bundle.parameters.tfstate_storage_account_name }}"
container_name: "{{ bundle.parameters.tfstate_container_name }}"
key: "{{ bundle.parameters.tre_id }}-shared-service-sonatype-nexus-vm"
outputs:
- name: workspace_vm_allowed_fqdns_list
- name: nexus_allowed_fqdns_list
- name: shared_address_prefixes

upgrade:
- exec:
- terraform:
description: "Upgrade shared service"
command: echo
arguments:
- "This shared service does not implement upgrade action"
input: false
vars:
tre_id: "{{ bundle.parameters.tre_id }}"
tre_resource_id: "{{ bundle.parameters.id }}"
mgmt_resource_group_name: "{{ bundle.parameters.tfstate_resource_group_name }}"
acr_name: "{{ bundle.parameters.mgmt_acr_name }}"
backendConfig:
resource_group_name: "{{ bundle.parameters.tfstate_resource_group_name }}"
storage_account_name: "{{ bundle.parameters.tfstate_storage_account_name }}"
container_name: "{{ bundle.parameters.tfstate_container_name }}"
key: "{{ bundle.parameters.tre_id }}-shared-service-sonatype-nexus-vm"
outputs:
- name: workspace_vm_allowed_fqdns_list
- name: nexus_allowed_fqdns_list
- name: shared_address_prefixes
uninstall:
- terraform:
description: "Tear down shared service"
Expand All @@ -73,6 +111,8 @@ uninstall:
tre_id: "{{ bundle.parameters.tre_id }}"
tre_resource_id: "{{ bundle.parameters.id }}"
ssl_cert_name: "{{ bundle.parameters.ssl_cert_name }}"
mgmt_resource_group_name: "{{ bundle.parameters.tfstate_resource_group_name }}"
acr_name: "{{ bundle.parameters.mgmt_acr_name }}"
backendConfig:
resource_group_name: "{{ bundle.parameters.tfstate_resource_group_name }}"
storage_account_name: "{{ bundle.parameters.tfstate_storage_account_name }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "r-proxy",
"online": true,
"storage": {
"blobStoreName": "default",
"strictContentTypeValidation": true,
"write_policy": "ALLOW"
},
"proxy": {
"remoteUrl": "https://cran.r-project.org/",
"contentMaxAge": 1440,
"metadataMaxAge": 1440
},
"negativeCache": {
"enabled": true,
"timeToLive": 1440
},
"httpClient": {
"blocked": false,
"autoBlock": false,
"connection": {
"retries": 0,
"userAgentSuffix": "string",
"timeout": 60,
"enableCircularRedirects": false,
"enableCookies": false,
"useTrustStore": false
}
},
"baseType": "r",
"repoType": "proxy"
}
141 changes: 141 additions & 0 deletions templates/shared_services/sonatype-nexus-vm/template_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,146 @@
"title": "SSL certificate name",
"description": "The name of the certificate to use (located in the core KeyVault) for configuring Nexus SSL"
}
},
"pipeline": {
"install": [
{
"stepId": "main"
},
{
"stepId": "42024559-3a88-4518-b1ea-713aebc91cfd",
"stepTitle": "Add Nexus rule collection to firewall",
"resourceTemplateName": "tre-shared-service-firewall",
"resourceType": "shared-service",
"resourceAction": "upgrade",
"properties": [
{
"name": "rule_collections",
"type": "array",
"arraySubstitutionAction": "replace",
"arrayMatchField": "name",
"value": {
"name": "shared_subnet_sonatype_nexus",
"action": "Allow",
"rules": [
{
"name": "vm-crl",
"description": "CRLs for workspaces",
"protocols": [
{
"port": "443",
"type": "Https"
},
{
"port": "80",
"type": "Http"
}
],
"target_fqdns": "{{ resource.properties.workspace_vm_allowed_fqdns_list }}",
"source_addresses": ["*"]
},
{
"name": "nexus-package-sources",
"description": "Nexus Package Sources",
"protocols": [
{
"port": "443",
"type": "Https"
},
{
"port": "80",
"type": "Http"
}
],
"target_fqdns": "{{ resource.properties.nexus_allowed_fqdns_list }}",
"source_addresses": "{{ resource.properties.shared_address_prefixes }}"
}
]
}
}
]
}
],
"upgrade": [
{
"stepId": "main"
},
{
"stepId": "a794e818-0807-4012-90be-3e78f530383c",
"stepTitle": "Update Nexus rule collection in firewall",
"resourceTemplateName": "tre-shared-service-firewall",
"resourceType": "shared-service",
"resourceAction": "upgrade",
"properties": [
{
"name": "rule_collections",
"type": "array",
"arraySubstitutionAction": "replace",
"arrayMatchField": "name",
"value": {
"name": "shared_subnet_sonatype_nexus",
"action": "Allow",
"rules": [
{
"name": "vm-crl",
"description": "CRLs for workspaces",
"protocols": [
{
"port": "443",
"type": "Https"
},
{
"port": "80",
"type": "Http"
}
],
"target_fqdns": "{{ resource.properties.workspace_vm_allowed_fqdns_list }}",
"source_addresses": ["*"]
},
{
"name": "nexus-package-sources",
"description": "Nexus Package Sources",
"protocols": [
{
"port": "443",
"type": "Https"
},
{
"port": "80",
"type": "Http"
}
],
"target_fqdns": "{{ resource.properties.nexus_allowed_fqdns_list }}",
"source_addresses": "{{ resource.properties.shared_address_prefixes }}"
}
]
}
}
]
}
],
"uninstall": [
{
"stepId": "c3f95f9f-d125-4937-9403-84e4957a26b8",
"stepTitle": "Remove Nexus rule collection from firewall",
"resourceTemplateName": "tre-shared-service-firewall",
"resourceType": "shared-service",
"resourceAction": "upgrade",
"properties": [
{
"name": "rule_collections",
"type": "array",
"arraySubstitutionAction": "remove",
"arrayMatchField": "name",
"value": {
"name": "shared_subnet_sonatype_nexus"
}
}
]
},
{
"stepId": "main"
}
]
}
}
11 changes: 1 addition & 10 deletions templates/shared_services/sonatype-nexus-vm/terraform/data.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
data "azurerm_log_analytics_workspace" "tre" {
name = "log-${var.tre_id}"
resource_group_name = local.core_resource_group_name
}

data "azurerm_virtual_network" "core" {
name = local.core_vnet
resource_group_name = local.core_resource_group_name
Expand All @@ -14,11 +9,6 @@ data "azurerm_subnet" "shared" {
name = "SharedSubnet"
}

data "azurerm_firewall" "fw" {
name = "fw-${var.tre_id}"
resource_group_name = local.core_resource_group_name
}

data "azurerm_key_vault" "kv" {
name = "kv-${var.tre_id}"
resource_group_name = local.core_resource_group_name
Expand Down Expand Up @@ -47,3 +37,4 @@ data "azurerm_private_dns_zone" "nexus" {
name = "nexus-${var.tre_id}.${data.azurerm_resource_group.rg.location}.cloudapp.azure.com"
resource_group_name = local.core_resource_group_name
}

22 changes: 0 additions & 22 deletions templates/shared_services/sonatype-nexus-vm/terraform/firewall.tf

This file was deleted.

12 changes: 7 additions & 5 deletions templates/shared_services/sonatype-nexus-vm/terraform/locals.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
locals {
core_vnet = "vnet-${var.tre_id}"
core_resource_group_name = "rg-${var.tre_id}"
nexus_allowed_fqdns = "*pypi.org,files.pythonhosted.org,security.ubuntu.com,archive.ubuntu.com,keyserver.ubuntu.com,repo.anaconda.com,*.docker.com,*.docker.io,conda.anaconda.org,azure.archive.ubuntu.com,packages.microsoft.com,repo.almalinux.org,download-ib01.fedoraproject.org"
nexus_allowed_fqdns_list = distinct(compact(split(",", replace(local.nexus_allowed_fqdns, " ", ""))))
storage_account_name = lower(replace("stg-${var.tre_id}", "-", ""))
core_vnet = "vnet-${var.tre_id}"
core_resource_group_name = "rg-${var.tre_id}"
nexus_allowed_fqdns = "*pypi.org,files.pythonhosted.org,security.ubuntu.com,archive.ubuntu.com,keyserver.ubuntu.com,repo.anaconda.com,*.docker.com,*.docker.io,conda.anaconda.org,azure.archive.ubuntu.com,packages.microsoft.com,repo.almalinux.org,download-ib01.fedoraproject.org,cran.r-project.org,cloud.r-project.org"
nexus_allowed_fqdns_list = distinct(compact(split(",", replace(local.nexus_allowed_fqdns, " ", ""))))
workspace_vm_allowed_fqdns = "r3.o.lencr.org,x1.c.lencr.org"
workspace_vm_allowed_fqdns_list = distinct(compact(split(",", replace(local.workspace_vm_allowed_fqdns, " ", ""))))
storage_account_name = lower(replace("stg-${var.tre_id}", "-", ""))
tre_shared_service_tags = {
tre_id = var.tre_id
tre_shared_service_id = var.tre_resource_id
Expand Down

This file was deleted.

16 changes: 16 additions & 0 deletions templates/shared_services/sonatype-nexus-vm/terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
output "nexus_fqdn" {
value = azurerm_private_dns_a_record.nexus_vm.fqdn
}

output "nexus_allowed_fqdns_list" {
value = jsonencode(local.nexus_allowed_fqdns_list)
}

output "shared_address_prefixes" {
value = jsonencode(data.azurerm_subnet.shared.address_prefixes)
}

output "workspace_vm_allowed_fqdns_list" {
value = jsonencode(local.workspace_vm_allowed_fqdns_list)
}

3 changes: 1 addition & 2 deletions templates/shared_services/sonatype-nexus-vm/terraform/vm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ resource "azurerm_linux_virtual_machine" "nexus" {
}

depends_on = [
azurerm_key_vault_access_policy.nexus_msi,
azurerm_firewall_application_rule_collection.shared_subnet_sonatype_nexus
azurerm_key_vault_access_policy.nexus_msi
]

connection {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: tre-service-guacamole-linuxvm
version: 0.5.1
version: 0.5.2
description: "An Azure TRE User Resource Template for Guacamole (Linux)"
dockerfile: Dockerfile.tmpl
registry: azuretre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plu
jq -n --arg proxy "${NEXUS_PROXY_URL}:8083" '{"registry-mirrors": [$proxy]}' > /etc/docker/daemon.json
sudo systemctl daemon-reload
sudo systemctl restart docker

# R config
sudo echo -e "local({\n r <- getOption(\"repos\")\n r[\"Nexus\"] <- \"""${NEXUS_PROXY_URL}\"/repository/r-proxy/\"\n options(repos = r)\n})" | sudo tee /etc/R/Rprofile.site
Loading