-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
119 changed files
with
5,850 additions
and
1,434 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.