|
1 | | -<h2>Use the pre-built image for this solution</h2> |
2 | | - |
3 | | -<br /> |
4 | | -<p>1. Pull the latest image from <a href="https://hub.docker.com/r/consumerdataright/authorisation-server" title="Download the container from docker hub here" alt="Download the container from docker hub here">Docker Hub</a></p> |
5 | | - |
6 | | -<span style="display:inline-block;margin-left:1em;"> |
7 | | - docker pull consumerdataright/authorisation-server |
8 | | -</span> |
9 | | - |
10 | | -<br /> |
11 | | -<p>2. Run the Authorisation Server container</p> |
12 | | - |
13 | | -<span style="display:inline-block;margin-left:1em;"> |
14 | | - docker run -d -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name mssql -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest |
15 | | - docker run -d -h authorisation-server -p 8001:8001 -p 3000:3000 --add-host=mssql:host-gateway --name authorisation-server consumerdataright/authorisation-server<br \> |
16 | | - <br \><br \> |
17 | | - Please note - This docker compose file utilises the Microsoft SQL Server Image from Docker Hub.<br \> |
18 | | - The Microsoft EULA for the Microsoft SQL Server Image must be accepted to continue.<br \> |
19 | | - See the Microsoft SQL Server Image on Docker Hub for more information.<br \> |
20 | | - Using the above command from a MS Windows command prompt will run the database.<br \> |
21 | | -</span> |
22 | | - |
23 | | -<br /> |
24 | | - |
25 | | -<span style="display:inline-block;margin-left:1em;margin-top:10px;margin-bottom:10px;"> |
26 | | - How to build your own image instead of downloading it from docker hub.<br \> |
27 | | - navigate to .\authorisation-server\Source<br \> |
28 | | - open a command prompt and execute the following;<br \> |
29 | | - docker build -f Dockerfile.standalone -t authorisation-server .<br \> |
30 | | - 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 \> |
31 | | - docker run -d -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name mssql -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest |
32 | | - docker run -d -h authorisation-server -p 8001:8001 -p 3000:3000 --add-host=mssql:host-gateway --name authorisation-server authorisation-server<br \><br \> |
33 | | -</span> |
34 | | - |
35 | | -<span style="display:inline-block;margin-left:1em;margin-top:10px;margin-bottom:10px;"> |
36 | | - You can connect to the MS SQL database container from MS Sql Server Management Studio (SSMS) using |
37 | | - the following settings; <br /> |
38 | | - Server type: Database Engine <br /> |
39 | | - Server name: localhost <br /> |
40 | | - Authentication: SQL Server Authentication <br /> |
41 | | - Login: sa <br /> |
42 | | - Password: Pa{}w0rd2019 <br /> |
43 | | -</span> |
44 | | -<br /> |
| 1 | +## Use the pre-built image for this solution |
| 2 | + |
| 3 | +1. Pull the latest [consumerdataright/authorisation-server](https://hub.docker.com/r/consumerdataright/authorisation-server) image from Docker Hub. |
| 4 | + ```shell |
| 5 | + docker pull consumerdataright/authorisation-server |
| 6 | + ``` |
| 7 | + |
| 8 | +2. Start the MSSQL server by executing the following command |
| 9 | + > *The instructions below include starting an instance of the Microsoft SQL Server. This includes an EULA which the following command accepts. Please refer to the documentation for the [mssql/server](https://hub.docker.com/r/microsoft/mssql-server/#environment-variables) image for more details.* |
| 10 | + ```shell |
| 11 | + docker run -d -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name mssql -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest |
| 12 | + ``` |
| 13 | + |
| 14 | +3. Run the Authorisation Server (from image) |
| 15 | + ```shell |
| 16 | + # run the authorisation server |
| 17 | + docker run -d -h authorisation-server -p 8001:8001 -p 3000:3000 --add-host=mssql:host-gateway --name authorisation-server consumerdataright/authorisation-server |
| 18 | + ``` |
| 19 | + |
| 20 | +## Build your own image for this solution |
| 21 | +To build your own image instead of using a pre-built one from Docker Hub |
| 22 | +1. Open a command prompt with the working directory set to the [Source](../../Source/) folder under this repository on your local file system |
| 23 | +2. Build the image by executing the following command |
| 24 | + ```shell |
| 25 | + docker build -f Dockerfile.standalone -t authorisation-server . |
| 26 | + ``` |
| 27 | +3. Start the MSSQL server by executing the following command |
| 28 | + > *The instructions below include starting an instance of the Microsoft SQL Server. This includes an EULA which the following command accepts. Please refer to the documentation for the [mssql/server](https://hub.docker.com/r/microsoft/mssql-server/#environment-variables) image for more details.* |
| 29 | + ```shell |
| 30 | + docker run -d -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name mssql -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest |
| 31 | + ``` |
| 32 | +4. Start the Authorisation Server by executing the following command |
| 33 | + ```shell |
| 34 | + docker run -d -h authorisation-server -p 8001:8001 -p 3000:3000 --add-host=mssql:host-gateway --name authorisation-server authorisation-server |
| 35 | + ``` |
| 36 | + |
| 37 | +## Connecting to the database |
| 38 | +> Both approaches leverage a MS SQL database for storage. In the examples below we use [MS SQL Server Management Studio (SMSS)](https://learn.microsoft.com/en-us/ssms/), but the approach should be similar for other tooling. |
| 39 | +
|
| 40 | +You will need the following authentication details: |
| 41 | +| | | |
| 42 | +| -- | -- | |
| 43 | +| Server type | Database Engine | |
| 44 | +| Server name | localhost | |
| 45 | +| Authentication | SQL Server Authentication | |
| 46 | +| Login | `sa` | |
| 47 | +| Password | `Pa{}w0rd2019` | |
| 48 | + |
| 49 | +Should you opt to use another tool, then the following would be useful |
| 50 | + |
| 51 | +| | | |
| 52 | +| -- | -- | |
| 53 | +| Connection String | `Server=localhost;Database=cdr-auth-server;User Id='SA';Password='Pa{}w0rd2019';MultipleActiveResultSets=True;TrustServerCertificate=True;Encrypt=False` | |
| 54 | + |
| 55 | + |
| 56 | +> If the below 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 |
45 | 57 |
|
46 | 58 | [<img src="./images/ssms-login-error.png" height='300' width='400' alt="SSMS Login Error"/>](./images/ssms-login-error.png) |
47 | 59 |
|
48 | | -<p> |
49 | | - (NB: 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) |
50 | | -</p> |
| 60 | +## Logging |
| 61 | +Once you have connected to the `cdr-auth-server` database above you can view the various database tables that contain logs or view the console output using the following command. |
| 62 | + |
| 63 | + ```shell |
| 64 | + docker logs authorisation-server |
| 65 | + ``` |
| 66 | + |
| 67 | +Optionally, logging to OpenTelemetry compatible destinations is also supported by modifying the `docker run` commands to supply additional environment variables. Additional guidance can be found in the [readme](../../README.md#logging) file. |
0 commit comments