Skip to content

Commit

Permalink
v1.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
CDR-AndrewG authored Mar 22, 2023
2 parents b91897b + bb9f526 commit a1da9c6
Show file tree
Hide file tree
Showing 119 changed files with 5,850 additions and 1,434 deletions.
651 changes: 346 additions & 305 deletions .azuredevops/pipelines/build-v2.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: ./Source
file: ./Source/Dockerfile.for-testing
file: ./Source/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.repository_owner == 'ConsumerDataRight' && github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
# Build mock-data-recipient image
- name: Build the mock-data-recipient image
run: |
docker build ./mock-data-recipient/Source --file ./mock-data-recipient/Source/Dockerfile.for-testing --tag mock-data-recipient:latest
docker build ./mock-data-recipient/Source --file ./mock-data-recipient/Source/Dockerfile --tag mock-data-recipient:latest
# Build mock-data-recipient-integration-tests image
- name: Build the mock-data-recipient-integration-tests image
Expand Down
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.0] - 2023-03-21
### Changed
- Updated to be compliant with FAPI 1.0 phase 3.
- Dynamic Client Registration Azure Function updated to be compliant with FAPI 1.0 phase 3.
- Home page html content to reflect latest version

## [1.1.3] - 2022-11-24
### Fixed
- Add body to post requests. [Sandbox Issue 15](https://github.com/ConsumerDataRight/sandbox/issues/15)

## [1.1.2] - 2022-10-27
### Fixed
- Fixed data conversion error when saving Cdr Arrangement. [Sandbox Issue 14](https://github.com/ConsumerDataRight/sandbox/issues/14)

## [1.1.1] - 2022-10-19
### Fixed
- Send redirect_uris as an array instead of string when performing background Dynamic Client Registration requests. [Issue 50](https://github.com/ConsumerDataRight/mock-data-recipient/issues/50)
- Changed CdrArrangement.ClientId database column data type from UniqueIdentifier to nvarchar(100).
- Intermittent issue where redirect_uri in consent and PAR JWT is null. [Sandbox Issue 11](https://github.com/ConsumerDataRight/sandbox/issues/11)
- mtls_endpoint_aliases not used as per RFC 8705 in PAR and token exchange. [Sandbox Issue 12](https://github.com/ConsumerDataRight/sandbox/issues/12)

## [1.1.0] - 2022-10-05
### Added
- Logging middleware to create a centralised list of all API requests and responses
Expand Down Expand Up @@ -67,4 +88,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.1.0] - 2021-10-01

### Added
- First release of the Mock Data Recipient.
- First release of the Mock Data Recipient.
237 changes: 130 additions & 107 deletions Help/container/HELP.md
Original file line number Diff line number Diff line change
@@ -1,107 +1,130 @@
<h2>Use the pre-built image for this solution</h2>

<br />
<p>1. Pull the latest image from <a href="https://hub.docker.com/r/consumerdataright/mock-data-recipient" title="Download the from docker hub here" alt="Download the from docker hub here">Docker Hub</a></p>

<span style="display:inline-block;margin-left:1em;">
docker pull consumerdataright/mock-data-recipient
</span>

<br />
<p>2. Run the Mock Data Recipient container</p>

<span style="display:inline-block;margin-left:1em;">
docker run -d -h mock-data-recipient -p 9001:9001 --add-host=host.docker.internal:host-gateway --name mock-data-recipient consumerdataright/mock-data-recipient
<br \><br \>
docker run -d -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
<br \><br \>
Please note - This docker compose file utilises the Microsoft SQL Server Image from Docker Hub.<br \>
The Microsoft EULA for the Microsoft SQL Server Image must be accepted to continue.<br \>
See the Microsoft SQL Server Image on Docker Hub for more information.<br \>
Using the above command from a MS Windows command prompt will run the database.<br \>
</span>

<br />
<p>3. Use the docker compose file to run a multi-container mock CDR Ecosystem.</p>

<span style="display:inline-block;margin-left:1em;">
The <a href="../../Source/DockerCompose/docker-compose.yml" title="/DockerCompose/docker-compose.yml" alt="Use the docker compose file located here - /DockerCompose/docker-compose.yml">docker compose file</a> can be used to run multiple containers from the Mock CDR Ecosystem, by starting the <a href="https://hub.docker.com/editions/community/docker-ce-desktop-windows" title="Docker Desktop for Windows" alt="Docker Desktop for Windows">docker desktop</a>
(if using a non MS Windows environment, you will need to add this route to the network), this will be added to your hosts file and is used for inter container connectivity via your host IP Address, eg C:\Windows\System32\drivers\etc\hosts
</span>

<br />

<span style="display:inline-block;margin-left:1em;">
###.###.###.### host.docker.internal
</span>

<br />

[<img src="./images/docker-desktop.png" height='300' width='625' alt="MS Docker Desktop"/>](./images/docker-desktop.png)

<p>4. Execute the <a href="../../Source/DockerCompose/docker-compose.yml" title="/DockerCompose/docker-compose.yml" alt="Use the docker compose file located here - /DockerCompose/docker-compose.yml">docker compose file</a>, the default configuration is to run all mock solutions and executing the comand below will run all the solutions.
</p>

<span style="display:inline-block;margin-left:1em;margin-bottom:10px;">
docker-compose up
</span>
<br />
<br />

<span style="display:inline-block;margin-left:1em;margin-bottom:16px;">
Please note - This docker compose file utilises the Microsoft SQL Server Image from Docker Hub.<br \>
The Microsoft EULA for the Microsoft SQL Server Image must be accepted to continue.<br \>
Replace this unset ACCEPT_MSSQL_EULA variable with a Y if you accept the EULA. eg ACCEPT_EULA=Y<br \>
See the Microsoft SQL Server Image on Docker Hub for more information.<br \>
</span>

[<img src="./images/containers-running.png" height='300' width='625' alt="Containers Running"/>](./images/containers-running.png)

<span style="display:inline-block;margin-left:1em;margin-top:10px">
Should you wish to switch out your own solution, remark the relevant code out of this file.<br \>
In this example we will be simulating the switching out of our Mock Data Recipient, we are using the<br \>
database connection string Server=host.docker.internal and the endpoints shown below to<br \>
connect to the running containers, this will result in the Mock Data Recipient running in MS Visual Studio,<br \>
connected to the Mock Register and the Mock Data Holder running in docker.<br \>
For details on how to run a Mock solution in MS Visual Studio
see <a href="../debugging/HELP.md" title="Debug Help Guide" alt="View the Debug Help Guide.">help guide</a>
</span>
<br />
<br />

[<img src="./images/mdr-switch-out-settings.png" height='300' width='625' alt="Mock Data Recipient switched out settings"/>](./images/mdr-switch-out-settings.png)

<span style="display:inline-block;margin-left:1em;margin-top:10px;margin-bottom:10px;">
How to build your own image instead of downloading it from docker hub.<br \>
navigate to .\mock-data-recipient\Source<br \>
open a command prompt and execute the following;<br \>
docker build -f Dockerfile.container -t mock-data-recipient .<br \>
docker run -d -h mdr-host -p 9001:9001 --add-host=host.docker.internal:host-gateway --name mock-data-recipient mock-data-recipient<br \><br \>
Please note - By default, the container above will be using a MS SQL database container, using this command from a MS Windows command prompt will run the database,<br \>
docker run -d -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
</span>

<span style="display:inline-block;margin-left:1em;margin-top:10px;margin-bottom:10px;">
You can connect to the MS SQL database container from MS Sql Server Management Studio (SSMS) using
the following settings; <br />
Server type: Database Engine <br />
Server name: localhost <br />
Authentication: SQL Server Authentication <br />
Login: sa <br />
Password: Pa{}w0rd2019 <br />
</span>
<br />

[<img src="./images/ssms-login-error.png" height='300' width='400' alt="SSMS Login Error"/>](./images/ssms-login-error.png)

<p>
(Please note - if the above error occurs whilst trying to connect to the MS SQL container, the SQL Server Service MUST BE STOPPED, you can do this from SQL Server Manager)
</p>

<p>5. The running solution</p>

<span style="display:inline-block;margin-left:1em;margin-bottom:1em;">
Our switched out Mock Data Recipient solution will now be running.
</span>

[<img src="./images/mdr-switch-out-running.png" height='300' width='625' alt="The Mock Data Recipient solution"/>](./images/mdr-switch-out-running.png)
# Use the pre-built image

The Mock Data Recipient image is available on [Docker Hub](https://hub.docker.com/r/consumerdataright/mock-data-recipient).

There are a number of ways that this image can be used.

## Pull the Mock Data Recipient image from Docker Hub

Run the following command to pull the latest image from Docker Hub:

```
docker pull consumerdataright/mock-data-recipient
```

You can also pull a specific image by supplying a tag, such as the name of the branch ("main" or "develop") or a release number:

```
# Pull the image from the main branch
docker pull consumerdataright/mock-data-recipient:main
# Pull the 0.5.0 version of the image
docker pull consumerdataright/mock-data-recipient:0.5.0
```

## Run a multi-container Mock CDR Ecosystem

Multiple containers can be run concurrently to simulate a CDR ecosystem. The [Mock Register](https://github.com/ConsumerDataRight/mock-register), [Mock Data Holder](https://github.com/ConsumerDataRight/mock-data-holder), [Mock Data Holder Energy](https://github.com/ConsumerDataRight/mock-data-holder-energy) and [Mock Data Recipient](https://github.com/ConsumerDataRight/mock-data-recipient) containers can be run by using the `docker-compose.yml` file.

The Mock CDR Ecosystem relies on SQL Server for data persistence so the container has a dependency on the SQL Server container image provided by Microsoft.

In order to run the Mock CDR Ecosystem and related SQL Server instance, use the provided `docker-compose.yml` file.

```
# Navigate to the Source directory where the docker-compose.yml file is located.
cd .\Source\DockerCompose
# Run the Mock CDR Ecosystem and SQL Server containers.
docker-compose up -d
# When finished, stop the containers.
docker-compose down
```
### Note: EULA for SQL Server
The `docker-compose.yml` file utilises the Microsoft SQL Server Image from Docker Hub. The Microsoft EULA for the Microsoft SQL Server Image must be accepted to continue.
Set the `ACCEPT_EULA` environment variable to `Y` within the `docker-compose.yml` if you accept the EULA.
See the [Microsoft SQL Server Image](https://hub.docker.com/_/microsoft-mssql-server) on Docker Hub for more information.

Example of accepting the `ACCEPT_EULA` environment variable of the SQL Server container.
```
mssql:
container_name: sql1
image: 'mcr.microsoft.com/mssql/server:2019-latest'
ports:
- '1433:1433'
environment:
- ACCEPT_EULA=Y
```

### Note: Mock host names

Each Mock solution has a default host name, as per below:

| Mock solution | Default host name |
|-------------------------|-------------------------|
| Mock Register | mock-register |
| Mock Data Holder | mock-data-holder |
| Mock Data Holder Energy | mock-data-holder-energy |
| Mock Data Recipient | mock-data-recipient |

To resolve these host names, each of these host names can be registered in the local machine's `hosts` file (located in C:\Windows\System32\drivers\etc\).

```
127.0.0.1 mock-register
127.0.0.1 mock-data-holder
127.0.0.1 mock-data-holder-energy
127.0.0.1 mock-data-recipient
127.0.0.1 mssql
```

### Switching out a container in the multi-container Mock CDR Ecosystem with your own solution

You can switch out one of the mock solutions running in the multi-container Mock CDR Ecosystem with a mock solution running in MS Visual Studio or with your own solution.

Within the `docker-compose.yml` file, comment out the solution that you do not want to be started. E.g. The Mock Data Recipient:

[<img src="./images/mdr-switch-out-compose-comment.png" width='625' alt="Compose file with MDR commented out."/>](./images/mdr-switch-out-compose-comment.png)

Start the Mock CDR Ecosystem using the docker compose file.
```
# Run the Mock CDR Ecosystem containers.
docker-compose -f docker-compose.yml up -d
```

In this example we will be switching out our Mock Data Recipient.
Clone the [Mock Data Recipient](https://github.com/ConsumerDataRight/mock-data-recipient) repository from GitHub and open the solution in MS Visual Studio.

Build and run the Mock Data Recipient in MS Visual Studio. Our switched out Mock Data Recipient solution will now be running. This will result in the Mock Data Recipient running in MS Visual Studio, connected to the Mock Register and the Mock Data Holders running in docker.

[<img src="./images/mdr-switch-out-running.png" width='625' alt="The Mock Data Recipient solution"/>](./images/mdr-switch-out-running.png)

For more details on how to run a mock solution in MS Visual Studio see [help guide](../debugging/HELP.md).

## Build your own Mock Data Recipient docker image
A Mock Data Recipient Docker image can also be built and run as a Docker container using your local source code.

Build the new docker image.
```
docker build -f Dockerfile -t mock-data-recipient .
```
Run the SQL Server image.
```
docker run -d -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
```
Run the new docker image.
```
docker run -d -h mock-data-recipient -p 9001:9001 --add-host=mssql:host-gateway --name mock-data-recipient mock-data-recipient
```

### Connecting to the MS SQL database container
You can connect to the MS SQL database container from MS SQL Server Management Studio (SSMS) using the following settings:
```
Server type: Database Engine
Server name: mssql
Authentication: SQL Server Authentication
Login: sa
Password: Pa{}w0rd2019
```

## Host on your own infrastructure
The mock solutions can also be hosted on your own infrastructure, such as virtual machines or kubernetes clusters, in your private data centre or in the public cloud.
Binary file removed Help/container/images/containers-running.png
Binary file not shown.
Binary file removed Help/container/images/docker-desktop.png
Binary file not shown.
Binary file removed Help/container/images/docker-stats.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Help/container/images/mdr-switch-out-running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Help/container/images/mdr-switch-out-settings.png
Binary file not shown.
Binary file removed Help/container/images/ssms-login-error.png
Binary file not shown.
Loading

0 comments on commit a1da9c6

Please sign in to comment.