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

Re-host Nexus on vm #1584

Merged
merged 184 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
dc036ef
Initial commit
oliver7598 Mar 11, 2022
a65b51a
Replaced webapp with vm
jjgriff93 Mar 11, 2022
4723572
Amended docker start commands
jjgriff93 Mar 11, 2022
cdc66a2
Amended firewall
jjgriff93 Mar 11, 2022
87761b7
Add nexus config to persistent volume
jjgriff93 Mar 11, 2022
d14ec95
Add private dns zone
jjgriff93 Mar 11, 2022
a049069
Corrected rg var
jjgriff93 Mar 14, 2022
2c029c6
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 14, 2022
2907550
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 14, 2022
cb5b228
Added Nexus letsencrypt cert gen
oliver7598 Mar 15, 2022
a1ff256
Merge branch 'main' into nexus-cert
oliver7598 Mar 15, 2022
2f91623
Fixed linting
oliver7598 Mar 15, 2022
073d780
Changed terraform.lock.hcl to previous version
oliver7598 Mar 15, 2022
f067941
Removed leftover debug
oliver7598 Mar 15, 2022
2341314
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 15, 2022
605b82d
Merge branch 'main' into nexus-cert
oliver7598 Mar 16, 2022
f728fcd
Typo fix
oliver7598 Mar 16, 2022
c76d76b
File path amend
oliver7598 Mar 16, 2022
f53ce91
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 16, 2022
904f790
Merge branch 'main' into nexus-cert
ross-p-smith Mar 16, 2022
b4ea8dc
Fix for cloudapp DNS resolution errors
jjgriff93 Mar 16, 2022
151ef87
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 16, 2022
72f468e
Docker running on Nexus VM
ross-p-smith Mar 17, 2022
b51c5f8
Documented Letsencrypt process
oliver7598 Mar 17, 2022
ffa1d3b
Merge branch 'nexus-cert' of https://github.com/oliver7598/AzureTRE i…
oliver7598 Mar 17, 2022
a1ab6de
Permissions fix
jjgriff93 Mar 17, 2022
e8e2209
Typo fix
oliver7598 Mar 17, 2022
55cdf19
Typo fix
oliver7598 Mar 17, 2022
a1748d6
Typo fix
oliver7598 Mar 17, 2022
5616e03
Formatting changes
oliver7598 Mar 17, 2022
f42e96b
Added reference to letsencrypt doc
oliver7598 Mar 17, 2022
5f30077
Added new page reference
oliver7598 Mar 17, 2022
126cacd
Moved password generation for nexus to tf
jjgriff93 Mar 17, 2022
313bf16
Merge branch 'main' into nexus-cert
daltskin Mar 18, 2022
cc540ee
Write script to fs first before execution
jjgriff93 Mar 21, 2022
c26aa9f
Password reset finally working
jjgriff93 Mar 21, 2022
3c45b93
Make config nexus script runnable from any dir
jjgriff93 Mar 21, 2022
7fee96b
Added basic status info
jjgriff93 Mar 21, 2022
73ff598
Fix recursive file loop
jjgriff93 Mar 21, 2022
e38e69e
Typo fix
jjgriff93 Mar 21, 2022
fbf01c2
Updated docs
jjgriff93 Mar 22, 2022
1599146
renamed env file
oliver7598 Mar 22, 2022
220954b
Fix typo
jjgriff93 Mar 22, 2022
ba320c8
Added new nexus fqdn to user resources
jjgriff93 Mar 23, 2022
fc09ab9
Add vnet link to workspaces
jjgriff93 Mar 23, 2022
517cdb1
Bump versions
jjgriff93 Mar 23, 2022
67465d3
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 24, 2022
156768a
Removed nexus properties file
jjgriff93 Mar 24, 2022
a973b9e
Merge branch 'main' into nexus-cert
jjgriff93 Mar 24, 2022
fede7f6
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 24, 2022
7819d23
Merge branch 'nexus-cert' of https://github.com/oliver7598/AzureTRE i…
jjgriff93 Mar 24, 2022
e051623
Updated execution permissions
jjgriff93 Mar 24, 2022
4635bb7
Get cert in tf
jjgriff93 Mar 25, 2022
6613e21
Added az cli get cert
jjgriff93 Mar 28, 2022
28f0de9
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Mar 28, 2022
d1d885f
Amended prune job
jjgriff93 Mar 28, 2022
6c63826
Added msi id to login
jjgriff93 Mar 28, 2022
d9410b6
Amended msi and exported cert pwd
jjgriff93 Mar 29, 2022
bed4a6e
Jetty configuration
jjgriff93 Mar 29, 2022
b4de6ab
Escape jetty vars
jjgriff93 Mar 29, 2022
4f33436
Password script fixes
jjgriff93 Apr 4, 2022
e3e9a11
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 4, 2022
f7ac643
Amended networking to use module
jjgriff93 Apr 4, 2022
d5612c2
Use https in config script
jjgriff93 Apr 5, 2022
300527e
Removed res proc location variable
jjgriff93 Apr 5, 2022
232ff2a
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 5, 2022
50bd946
Potential linting fix
jjgriff93 Apr 5, 2022
bef085a
Linting fixes
jjgriff93 Apr 6, 2022
78e6f91
Linting directive positioning
jjgriff93 Apr 6, 2022
20c2ab3
Gitea version bump
jjgriff93 Apr 6, 2022
4b147a2
Terraform format
jjgriff93 Apr 6, 2022
d132fee
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 6, 2022
7867b45
Reorder linting to workaround superlinter bug with Terraform
stuartleeks Apr 6, 2022
a060322
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 6, 2022
a61c9cd
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 6, 2022
a68eefe
Added nexus-cert to build and caching of letsencrypt
jjgriff93 Apr 7, 2022
c45ba3b
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 7, 2022
dc1dc72
Adopted new shared service deploy method
jjgriff93 Apr 7, 2022
96deffb
Added cron job to renew nexus cert
jjgriff93 Apr 7, 2022
8c05abb
Removed location references
jjgriff93 Apr 7, 2022
d953492
And another
jjgriff93 Apr 7, 2022
247baf0
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 11, 2022
e8210fb
Removed location refs and added az cli
jjgriff93 Apr 11, 2022
833fc68
Fixed nexus-cert kv permissions
jjgriff93 Apr 12, 2022
c285008
Corrected outputs directory
jjgriff93 Apr 12, 2022
fbd1508
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 12, 2022
329482a
Fixed shared service deployment steps
jjgriff93 Apr 13, 2022
69f3acf
Updated docs and removed renew prompt
jjgriff93 Apr 13, 2022
2e494c6
version bump
jjgriff93 Apr 13, 2022
407916c
Increase bundle versions
marrobi Apr 14, 2022
baceac4
remote location from variables files
marrobi Apr 14, 2022
3696da8
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
marrobi Apr 14, 2022
87564cc
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 21, 2022
ae40f2a
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 25, 2022
7a27161
Removed shared service make
jjgriff93 Apr 25, 2022
e07205c
Removed docker prune
jjgriff93 Apr 25, 2022
ee40232
Bash headers
jjgriff93 Apr 25, 2022
561379c
Layer clean
jjgriff93 Apr 25, 2022
84c9349
Reduce layer
jjgriff93 Apr 25, 2022
7213972
Testing without kv role assignment
jjgriff93 Apr 26, 2022
130eb71
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 26, 2022
55b4864
Removed kv role assignment
jjgriff93 Apr 27, 2022
a9609d1
Adding firewall rule to allow letsencrypt from RP
jjgriff93 Apr 27, 2022
8863ddf
Genericised cert service and added letsencrypt action
jjgriff93 Apr 27, 2022
74405ea
Fixed auth hook
jjgriff93 Apr 27, 2022
b14bd19
Removed make commands
jjgriff93 Apr 27, 2022
b452f28
Certbot in bundle container
jjgriff93 Apr 27, 2022
b61ee25
Tidied naming
jjgriff93 Apr 27, 2022
c9d5568
Python base image
jjgriff93 Apr 27, 2022
06b6c40
Generate action successful
jjgriff93 Apr 28, 2022
146ef52
Inject cert name to nexus bundle
jjgriff93 Apr 28, 2022
0af829e
Implemented app gateway start/stop
jjgriff93 Apr 28, 2022
c607f88
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 28, 2022
5b61fc3
Separated cloudinit yaml into scripts
jjgriff93 Apr 28, 2022
5dbbb15
Fixed new line issue
jjgriff93 Apr 28, 2022
6d837b7
Fixed bash casing
jjgriff93 Apr 28, 2022
587c1cd
Added local nexus repo config
jjgriff93 Apr 28, 2022
c7763e5
Added retry logic to config repos
jjgriff93 Apr 29, 2022
7a35dd8
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 Apr 29, 2022
76f4d87
gitea bump
jjgriff93 Apr 29, 2022
41d6ac0
Fixed status code
jjgriff93 Apr 29, 2022
3574043
terraform linting
jjgriff93 Apr 29, 2022
f31f5fb
Added docs
jjgriff93 Apr 29, 2022
52d0df7
Lint fix
jjgriff93 Apr 29, 2022
5d81882
Update docs/tre-developers/letsencrypt.md
ross-p-smith May 3, 2022
7f97c08
Update docs/tre-admins/setup-instructions/configuring-shared-services.md
ross-p-smith May 3, 2022
c51cec4
Update docs/tre-developers/letsencrypt.md
ross-p-smith May 3, 2022
a367bb5
Update docs/tre-developers/letsencrypt.md
ross-p-smith May 3, 2022
1444a21
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
ross-p-smith May 5, 2022
ba8ad03
Update docs/tre-admins/setup-instructions/configuring-shared-services.md
ross-p-smith May 5, 2022
8b678fb
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
ross-p-smith May 5, 2022
0f311f9
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 12, 2022
37032bc
Fix firewall conflict
jjgriff93 May 12, 2022
923af13
Added note to docs for cert kv conflicts
jjgriff93 May 12, 2022
a03f62d
Renamed sonatype-nexus to nexus for new version
jjgriff93 May 12, 2022
9e9e392
Added old nexus service code
jjgriff93 May 12, 2022
8c177e9
Lint fix
jjgriff93 May 12, 2022
e18cd25
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 12, 2022
9def053
Renamed folder to be obvious as the nexus-vm
jjgriff93 May 12, 2022
0542f87
Merge branch 'jjgriff93/1479-rehost_nexus_on_vm' of https://github.co…
jjgriff93 May 12, 2022
57cab77
Added docs for upgrade path
jjgriff93 May 12, 2022
a1c598c
Added data.azurerm rg core
jjgriff93 May 12, 2022
bf5a0bd
linting
jjgriff93 May 12, 2022
e541770
bash linting
jjgriff93 May 12, 2022
010134d
Require workspace of 0.2.14 or above
jjgriff93 May 13, 2022
a042b0b
Moved new version notes to section below config steps
jjgriff93 May 13, 2022
9bd1abf
Removed give new cert name
jjgriff93 May 13, 2022
6a2f4b0
RP cert permissions
jjgriff93 May 13, 2022
524dd42
tf format
jjgriff93 May 13, 2022
bb18c52
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 23, 2022
81eba21
Added required params for certs and nexus tempalte schema
jjgriff93 May 23, 2022
3089255
Added cert import permissions
jjgriff93 May 23, 2022
8e31036
Added certs delete permission
jjgriff93 May 23, 2022
b5650f5
App gateway az login
jjgriff93 May 23, 2022
c86a38a
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 23, 2022
15d3fd3
Version bumps
jjgriff93 May 23, 2022
53d25a6
Merge branch 'jjgriff93/1479-rehost_nexus_on_vm' of https://github.co…
jjgriff93 May 23, 2022
65f4138
tf fmt
jjgriff93 May 23, 2022
60a4976
Added missing az cred params to certs
jjgriff93 May 23, 2022
d48c4cf
Add purge permission
marrobi May 24, 2022
e1b6afd
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 24, 2022
433bd94
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 24, 2022
68e5c09
Bump tf versions to 3.4.0 & set purge to false
jjgriff93 May 24, 2022
3b34755
Removed unsupported property from new provider
jjgriff93 May 24, 2022
f5fc412
Moved nexus private zone to core
jjgriff93 May 24, 2022
d951785
Amended location var
jjgriff93 May 24, 2022
9c3df19
Amended zone location
jjgriff93 May 24, 2022
621d471
Added upgrade flag for tf
jjgriff93 May 24, 2022
13bc8a1
Remove tf lock
jjgriff93 May 25, 2022
f6705b2
Added new tf key
jjgriff93 May 25, 2022
d933c91
Added key into uninstall
jjgriff93 May 25, 2022
57427e1
Resolve firewall rule conflicts
jjgriff93 May 25, 2022
f87d039
Var reference fix
jjgriff93 May 25, 2022
a8a7aec
Fix for potential @ symbol in nexus admin password causing curl bug
jjgriff93 May 25, 2022
b8fa4c2
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 25, 2022
9ffb315
Added nexus_version variable to user resources for back compat
jjgriff93 May 26, 2022
7693910
Added docs for nexus_version
jjgriff93 May 26, 2022
dbf5735
downgrade superlinter
jjgriff93 May 26, 2022
e13ceab
Merge branch 'main' into jjgriff93/1479-rehost_nexus_on_vm
jjgriff93 May 26, 2022
dd0ffd1
revert superlinter to v4
jjgriff93 May 26, 2022
ffdb7e9
Merge branch 'jjgriff93/1479-rehost_nexus_on_vm' of https://github.co…
jjgriff93 May 26, 2022
25c08b6
Remove lint aws plugin block
jjgriff93 May 26, 2022
51bdbde
Use superlinter latest
jjgriff93 May 26, 2022
76d509d
Manually set tflint path
jjgriff93 May 26, 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
5 changes: 0 additions & 5 deletions .github/linters/.tflint.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ config {
force = false
}

# https://github.com/github/super-linter/issues/2954
plugin "aws" {
enabled = false # Override: disable AWS
}

plugin "azurerm" {
enabled = true
}
7 changes: 5 additions & 2 deletions .github/workflows/build_validation_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ jobs:
if: ${{ steps.filter.outputs.terraform == 'true' }}
run: |
find . -type d -name 'terraform' -not -path '*cnab*' -print0 \
| xargs -0 -I{} sh -c 'echo "***** Validating: {} *****"; \
| xargs -0 -I{} sh -c 'echo "***** Validating: {} *****"; \https://github.com/github/super-linter/issues/2433
terraform -chdir={} init -backend=false; terraform -chdir={} validate'

- name: Lint code base
# the slim image is 2GB smaller and we don't use the extra stuff
# Moved this after the Terraform checks above due something similar to this issue: https://github.com/github/super-linter/issues/2433
uses: github/super-linter/[email protected].2
uses: github/super-linter/[email protected].3
env:
# Until https://github.com/github/super-linter/commit/ec0662756da93f1e3aad4df049712df7d764d143 is released
# we need to set the correct plugin directory (which is incorrectly set to github/home/.tflint.d/plugins by default)
TFLINT_PLUGIN_DIR: "/root/.tflint.d/plugins"
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
107 changes: 101 additions & 6 deletions docs/tre-admins/setup-instructions/configuring-shared-services.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,117 @@
# Configuring Shared Services

Complete the configuration of the shared services (Nexus and Gitea) from inside of the TRE environment.
## Deploy/configure Nexus

Make sure you run the following command using git bash and set your current directory as C:/AzureTRE
If you're deploying a brand new environment you should deploy the VM-based (V2) service (read section `A`). If you wish to migrate from an existing App Service Nexus service (V1) to the VM-based service, first deploy the new service (section `A`) then proceed to section `B`.

## Configure Nexus repository
!!! info
The Makefile commands for deploying shared services temporarily target the V1 service so that existing environments won't have a new V2 Nexus service deployed automatically by CICD and introduce breaking changes. The V2 Nexus service will need to be deployed manually using the steps below.

1. Run the Nexus configuration script to reset the password and setup a PyPI proxy on Nexus:
```./templates/shared_services/sonatype-nexus/scripts/configure_nexus.sh -t <tre_id>```
### A. Deploy & configure V2 Nexus service (hosted on VM)

## Configure Gitea repository
!!! caution
Before deploying the V2 Nexus service, you will need workspaces of version `0.3.2` or above due to a dependency on a DNS zone link for the workspace(s) to connect to the Nexus VM.

Before deploying the Nexus shared service, you need to make sure that it will have access to a certificate to configure serving secure proxies. By default, the Nexus service will serve proxies from `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/`, and thus it requires a certificate that validates ownership of this domain to use for SSL.

You can use the Certs Shared Service to set one up by following these steps:

1. Run the below commands in your terminal to build, publish and register the certs bundle:

```cmd
make bundle-build DIR=./templates/shared_services/certs
make bundle-publish DIR=./templates/shared_services/certs
make bundle-register DIR=./templates/shared_services/certs BUNDLE_TYPE=shared_service
```

2. Navigate to the Swagger UI for your TRE API at `https://<azure_tre_fqdn>/api/docs`, and authenticate if you haven't already by clicking `Authorize`.

3. Click `Try it out` on the `POST` `/api/shared-services` operation, and paste the following to deploy the certs service:

```json
{
"templateName": "tre-shared-service-certs",
"properties": {
"display_name": "Nexus cert",
"description": "Generate/renew ssl cert for Nexus shared service",
"domain_prefix": "nexus",
"cert_name": "nexus-ssl"
}
}
```

!!! caution
If you have KeyVault Purge Protection enabled and are re-deploying your environment using the same `cert_name`, you may encounter this: `Status=409 Code=\"Conflict\" Message=\"Certificate nexus-ssl is currently in a deleted but recoverable state`. You need to either manually recover the certificate or purge it before redeploying.

1. Once the shared service has been deployed (which you can check by querying the `/api/shared-services/operations` method), copy its `resource_id`, then find the `POST` operation for `/api/shared-services/{shared_service_id}/invoke_action`, click `Try it out` and paste in the resource id into the `shared_service_id` field, and enter `generate` into the `action` field, then click `Execute`.

This will invoke the certs service to use Letsencrypt to generate a certificate for the specified domain prefix followed by `-{TRE_ID}.{LOCATION}.cloudapp.azure.com`, so in our case, having entered `nexus`, this will be `nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com`, which will be the public domain for our Nexus service.

Once this has completed, you can verify its success either from the operation output, or by navigating to your core keyvault (`kv-{TRE_ID}`) and looking for a certificate called `nexus-ssl` (or whatever you called it).

After verifying the certificate has been generated, you can deploy Nexus:

1. Run the below commands in your terminal to build, publish and register the Nexus shared service bundle:

```cmd
make bundle-build DIR=./templates/shared_services/sonatype-nexus-vm
make bundle-publish DIR=./templates/shared_services/sonatype-nexus-vm
make bundle-register DIR=./templates/shared_services/sonatype-nexus-vm BUNDLE_TYPE=shared_service
```

1. Navigate to the Swagger UI for your TRE API at `https://<azure_tre_fqdn>/api/docs`, and authenticate if you haven't already by clicking `Authorize`.

1. Click `Try it out` on the `POST` `/api/shared-services` operation, and paste the following to deploy the Nexus shared service:

```json
{
"templateName": "tre-shared-service-sonatype-nexus",
"properties": {
"display_name": "Nexus",
"description": "Proxy public repositories with Nexus",
"ssl_cert_name": "nexus-ssl"
}
}
```

!!! tip
If you called your cert something different in the certs shared service step, make sure that is reflected above.

This will deploy the infrastructure required for Nexus, then start the service and configure it with the repository configurations located in the `./templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config` folder. It will also set up HTTPS using the certificate you generated in the previous section, so proxies can be served at `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com`.

You can optionally go to the Nexus web interface by visiting `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/` in the jumpbox and signing in with the username `admin` and the password secret located in your core keyvault, with the key `nexus-admin-password`. Here you should be able to see all of the configured repositories and you can use the UI to manage settings etc.

Just bear in mind that if this service is redeployed any changes in the UI won't be persisted. If you wish to add new repositories or alter existing ones, use the JSON files within the `./nexus_repos_config` directory.

### B. Migrate from an existing V1 Nexus service (hosted on App Service)

Once you've created the new V2 (VM-based) Nexus service by following section `A`, you can migrate from the V1 Nexus service by following these steps:

1. Identify any existing Guacamole user resources that are using the old proxy URL (`https://nexus-{TRE_ID}.azurewebsites.net/`). These will be any VMs with bundle versions < `0.3.2`.

1. These will need to be either **re-deployed** with the new template versions `0.3.2` or later and specifying an additional template parameter `"nexus_version"` with the value of `"V2"`, or manually have their proxy URLs updated by remoting into the VMs and updating the various configuration files of required package managers with the new URL (`https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/`).

1. For example, pip will need the `index`, `index-url` and `trusted-host` values in the global `pip.conf` file to be modified to use the new URL.

2. Once you've confirmed there are no dependencies on the old Nexus shared service, you can delete it using the API.

### Upgrade notes

The new V2 Nexus shared service can be located in the `./templates/shared_services/sonatype-nexus-vm` directory, with the bundle name `tre-shared-service-sonatype-nexus`, which is now hosted using a VM to enable additional configuration required for proxying certain repositories.

This has been created as a separate service as the domain name exposed for proxies will be different to the one used by the original Nexus service and thus will break any user resources configured with the old proxy URL.

The original Nexus service that runs on App Service (located in `./templates/shared_services/sonatype-nexus`) has the bundle name `tre-shared-service-nexus` so can co-exist with the new VM-based shared service to enable smoother upgrading of existing resources.

## Configure Gitea repositories

Note : This is a Gitea *shared service* which will be accessible from all workspaces intended for mirroring external Git repositories. A Gitea *workspace service* can also be deployed per workspace to enable Gitea to be used within a specific workspace.

By default, this Gitea instance does not have any repositories configured. You can add repositories to Gitea either by using the command line or by using the Gitea web interface.


### Command Line
Make sure you run the following commands using git bash and set your current directory as C:/AzureTRE.

1. On the jumbox, run:
```./scripts/gitea_migrate_repo.sh -t <tre_id> -g <URL_of_github_repo_to_migrate>```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ Workspace level operations can now be carried out using the workspace API, at `/

## Next steps

* [Installing a workspace service](./installing-workspace-service-and-user-resource.md)
* [Configuring shared services](./configuring-shared-services.md)
* [Installing a workspace service & user resources](./installing-workspace-service-and-user-resource.md)
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ You can also follow the progress in Azure portal as various resources come up.

Once the workspace service has been created, we can use the workspace API to create a user resource in our workspace.

!!! caution
Before deploying Guacamole user resources, you will want to make sure you have a Nexus shared service deployed in the workspace so that your VMs can access package repositories through a proxy (as they can't access public repositories directly). See [Configuring shared services](./configuring-shared-services.md).

1. Navigate to the Swagger UI at `https://<azure_tre_fqdn>/api/workspaces/<workspace_id>/docs` . Where `<workspace_id>` is the workspace ID of your workspace.

1. Click `Try it out` on the `POST` `/api/workspaces/<workspace_id>/workspace-services/<service_id>/user_resources` operation. Where `<workspace_id>` and `<service_id>` are the workspace ID of your workspace and workspace service ID of your workspace service.
Expand All @@ -110,12 +113,13 @@ Once the workspace service has been created, we can use the workspace API to cre
"properties": {
"display_name": "My VM",
"description": "Will be using this VM for my research",
"os_image": "Server 2019 Data Science VM"
"os_image": "Server 2019 Data Science VM",
"nexus_version": "V2"
}
}
```

> Note: You can also specify "Windows 10" for a standard Windows 10 image
> Note: You can also specify "Windows 10" in "os_image" for a standard Windows 10 image. The "nexus_version" property also accepts "V1" if you have a V1 Nexus shared service deployed instead of the V2 service described in [Configuring shared services](./configuring-shared-services.md).

The API will return an `operation` object with a `Location` header to query the operation status, as well as the `resourceId` and `resourcePath` properties to query the resource under creation.

Expand Down
52 changes: 52 additions & 0 deletions docs/tre-developers/letsencrypt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Letsencrypt

Certain components of the TRE require the aquisition of a certificate via Letsencrypt to ensure secure HTTPS connections.

In order to aquire these certificates, there must be a public facing endpoint which can be reached by Letsencrypt.

As TREs are secured environments with very few publicly facing points, additional resources are required to ensure the certificate can be provisioned for the correct domain.

The additional resources are as followed:

1. Public IP provisioned in the same location as the web app that the certificate is intended for; this will also have a domain label which matches the web app name.
1. Storage Account with a static web app.
1. Application gateway to route traffic from the Public IP to the static web app

The following diagram illustrated the flow of data between the resources:

```mermaid
flowchart RL
subgraph .dev Container
direction TB
A(letsencrypt process runs)
end
subgraph External
direction TB
B[letsencrypt authority]
end
subgraph TRE
subgraph Core VNet
C[Public IP <br/> Domain Label: < web-app-name > <br/> Endpoint: < web-app-name >.< location >.cloudapp.net]
subgraph Storage Account
D[SA Static Site]
end
end
subgraph VNet
E[Key Vault <br/> kv-< tre_id >]
subgraph VM
F[Web App]
end
G[Private DNS Zone < web-app-name >.< location >.cloudapp.net]
end
end

A --> |1. Request to | B
B --> |2. Attempts to hit | C
C --> |3. App Gateway routes | D
D --> |4. Responds | C
C --> |5. Responds | B
B --> |6. Acquires certificate | A
A --> |7. Stores Certificate | E
F --> |8. Pulls Certificate | E

```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ nav:
- API: 'tre-developers/api.md'
- Resource Processor: 'tre-developers/resource-processor.md'
- End to End Tests: 'tre-developers/end-to-end-tests.md'
- Letsencrypt: 'tre-developers/letsencrypt.md'
- TRE Workspace Authors:
- Authoring Workspace Templates: 'tre-workspace-authors/authoring-workspace-templates.md'
- Firewall Rules: 'tre-workspace-authors/firewall-rules.md'
Expand Down
1 change: 1 addition & 0 deletions templates/core/terraform/appgateway/staticweb.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
data "azurerm_client_config" "deployer" {}

# See https://microsoft.github.io/AzureTRE/tre-developers/letsencrypt/
resource "azurerm_storage_account" "staticweb" {
name = local.staticweb_storage_name
resource_group_name = var.resource_group_name
Expand Down
7 changes: 7 additions & 0 deletions templates/core/terraform/network/dns_zones.tf
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,10 @@ resource "azurerm_private_dns_zone" "postgres" {

lifecycle { ignore_changes = [tags] }
}

resource "azurerm_private_dns_zone" "nexus" {
name = "nexus-${var.tre_id}.${var.location}.cloudapp.azure.com"
resource_group_name = var.resource_group_name

lifecycle { ignore_changes = [tags] }
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,6 @@ resource "azurerm_key_vault_access_policy" "resource_processor" {
tenant_id = azurerm_user_assigned_identity.vmss_msi.tenant_id
object_id = azurerm_user_assigned_identity.vmss_msi.principal_id

secret_permissions = ["Get", "List", "Set", "Delete", "Purge", "Recover"]
secret_permissions = ["Get", "List", "Set", "Delete", "Purge", "Recover"]
certificate_permissions = ["Get", "Recover", "Import", "Delete", "Purge"]
}
7 changes: 7 additions & 0 deletions templates/shared_services/certs/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Put files here that you don't want copied into your bundle's invocation image
.gitignore
**/.terraform/*
**/.terraform.lock.hcl
**/*_backend.tf
Dockerfile.tmpl
2 changes: 2 additions & 0 deletions templates/shared_services/certs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cnab/
.terraform*
26 changes: 26 additions & 0 deletions templates/shared_services/certs/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.8

ARG BUNDLE_DIR

RUN apt-get update \
&& apt-get install -y ca-certificates \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Install Azure CLI
RUN apt-get update \
&& apt-get install -y ca-certificates jq curl apt-transport-https lsb-release gnupg \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null \
&& AZ_REPO=$(lsb_release -cs) \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | tee /etc/apt/sources.list.d/azure-cli.list \
&& apt-get update && apt-get -y install azure-cli \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Install Certbot
RUN apt-get update && apt-get install -y python3 python3-venv libaugeas0 \
&& python3 -m venv /opt/certbot/ \
&& /opt/certbot/bin/pip install --no-cache-dir --upgrade pip \
&& /opt/certbot/bin/pip install --no-cache-dir certbot \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Use the BUNDLE_DIR build argument to copy files into the bundle
COPY . $BUNDLE_DIR
38 changes: 38 additions & 0 deletions templates/shared_services/certs/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"schemaVersion": "1.0.0-DRAFT",
"name": "base",
"created": "2021-06-04T13:37:29.5071039+03:00",
"modified": "2021-06-04T13:37:29.5071039+03:00",
"parameters": [
{
"name": "tre_id",
"source": {
"env": "TRE_ID"
}
},
{
"name": "azure_location",
"source": {
"env": "LOCATION"
}
},
{
"name": "tfstate_container_name",
"source": {
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]
}
Loading