From d3b6d63499f9314ea68866f99460248e8acd1ec0 Mon Sep 17 00:00:00 2001 From: Rockford Lhotka Date: Mon, 14 Nov 2022 16:45:43 -0500 Subject: [PATCH 1/2] Update docker_compose and env variables to include = sign --- src/Lab03/End/Gateway/Dockerfile | 3 ++- src/Lab03/End/ServicesDemo.sln | 12 ++++++------ src/Lab03/End/docker-compose.dcproj | 2 +- src/Lab03/End/docker-compose.yml | 24 ++++++++++++------------ src/Lab03/readme.md | 8 ++++---- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/Lab03/End/Gateway/Dockerfile b/src/Lab03/End/Gateway/Dockerfile index 54507cf..698992b 100644 --- a/src/Lab03/End/Gateway/Dockerfile +++ b/src/Lab03/End/Gateway/Dockerfile @@ -3,6 +3,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 +EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src @@ -19,4 +20,4 @@ RUN dotnet publish "Gateway.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Gateway.dll"] \ No newline at end of file +ENTRYPOINT ["dotnet", "Gateway.dll"] diff --git a/src/Lab03/End/ServicesDemo.sln b/src/Lab03/End/ServicesDemo.sln index 3ca5640..4ab298b 100644 --- a/src/Lab03/End/ServicesDemo.sln +++ b/src/Lab03/End/ServicesDemo.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.3.32728.150 +VisualStudioVersion = 17.5.33103.201 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gateway", "Gateway\Gateway.csproj", "{C84069C4-CBF5-4386-8DB1-50F148221282}" EndProject @@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitQueue", "RabbitQueue\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SandwichMaker", "SandwichMaker\SandwichMaker.csproj", "{AB364D4F-E098-4416-BFD2-7823D8577302}" EndProject -Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{4B0B0105-BCAA-4BB3-92E7-85A953B94EAF}" +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{CCD35124-646B-4CF8-88E0-BEFCE12B516D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -53,10 +53,10 @@ Global {AB364D4F-E098-4416-BFD2-7823D8577302}.Debug|Any CPU.Build.0 = Debug|Any CPU {AB364D4F-E098-4416-BFD2-7823D8577302}.Release|Any CPU.ActiveCfg = Release|Any CPU {AB364D4F-E098-4416-BFD2-7823D8577302}.Release|Any CPU.Build.0 = Release|Any CPU - {4B0B0105-BCAA-4BB3-92E7-85A953B94EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B0B0105-BCAA-4BB3-92E7-85A953B94EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B0B0105-BCAA-4BB3-92E7-85A953B94EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B0B0105-BCAA-4BB3-92E7-85A953B94EAF}.Release|Any CPU.Build.0 = Release|Any CPU + {CCD35124-646B-4CF8-88E0-BEFCE12B516D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCD35124-646B-4CF8-88E0-BEFCE12B516D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCD35124-646B-4CF8-88E0-BEFCE12B516D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCD35124-646B-4CF8-88E0-BEFCE12B516D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Lab03/End/docker-compose.dcproj b/src/Lab03/End/docker-compose.dcproj index c69eabe..32e6ce7 100644 --- a/src/Lab03/End/docker-compose.dcproj +++ b/src/Lab03/End/docker-compose.dcproj @@ -3,7 +3,7 @@ 2.1 Linux - 4b0b0105-bcaa-4bb3-92e7-85a953b94eaf + ccd35124-646b-4cf8-88e0-befce12b516d LaunchBrowser {Scheme}://localhost:{ServicePort} gateway diff --git a/src/Lab03/End/docker-compose.yml b/src/Lab03/End/docker-compose.yml index 4e8d4cd..8d59b7e 100644 --- a/src/Lab03/End/docker-compose.yml +++ b/src/Lab03/End/docker-compose.yml @@ -13,8 +13,8 @@ services: dockerfile: SandwichMaker/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= gateway: image: ${DOCKER_REGISTRY-}gateway @@ -23,8 +23,8 @@ services: dockerfile: Gateway/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= meatservice: image: ${DOCKER_REGISTRY}meatservice @@ -33,8 +33,8 @@ services: dockerfile: MeatService/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= breadservice: image: ${DOCKER_REGISTRY}breadservice @@ -43,8 +43,8 @@ services: dockerfile: BreadService/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= cheeseservice: image: ${DOCKER_REGISTRY}cheeseservice @@ -53,8 +53,8 @@ services: dockerfile: CheeseService/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= lettuceservice: image: ${DOCKER_REGISTRY}lettuceservice @@ -63,6 +63,6 @@ services: dockerfile: LettuceService/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= diff --git a/src/Lab03/readme.md b/src/Lab03/readme.md index 7f6c411..96e910d 100644 --- a/src/Lab03/readme.md +++ b/src/Lab03/readme.md @@ -195,8 +195,8 @@ One of the more important of the [12 Factors](https://12factor.net) is that conf dockerfile: Gateway/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= ``` > ℹ the gateway container will connect to the rabbitmq container using its DNS name `sandwichqueue`. @@ -945,8 +945,8 @@ Make sure this file contains an entry for the new `breadservice`: dockerfile: BreadService/Dockerfile environment: - RABBITMQ__URL=sandwichqueue - - RABBITMQ__USER - - RABBITMQ__PASSWORD + - RABBITMQ__USER= + - RABBITMQ__PASSWORD= ``` At this point your `docker-compose.yml` file contains entries only for the `gateway` and `breadservice` services. In reality it needs entries for all the services necessary to run the system in your local environment. From 6afeacd26352d04f980b72e2a9c2dc5cf4bd9506 Mon Sep 17 00:00:00 2001 From: Rockford Lhotka Date: Mon, 14 Nov 2022 16:56:10 -0500 Subject: [PATCH 2/2] Modernize code --- src/Lab03/End/Gateway/Services/SandwichRequestor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Lab03/End/Gateway/Services/SandwichRequestor.cs b/src/Lab03/End/Gateway/Services/SandwichRequestor.cs index 90541e1..91e8d1d 100644 --- a/src/Lab03/End/Gateway/Services/SandwichRequestor.cs +++ b/src/Lab03/End/Gateway/Services/SandwichRequestor.cs @@ -10,9 +10,9 @@ public class SandwichRequestor : ISandwichRequestor { readonly IConfiguration _config; readonly IWorkInProgress _wip; - readonly Policy _retryPolicy = Policy. - Handle(). - WaitAndRetry(3, r => TimeSpan.FromSeconds(Math.Pow(2, r))); + readonly Policy _retryPolicy = Policy + .Handle() + .WaitAndRetry(3, r => TimeSpan.FromSeconds(Math.Pow(2, r))); public SandwichRequestor(IConfiguration config, IWorkInProgress wip) {