From 72a2e27ac8c07c601a9d61c298fe22439b64adbb Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Mon, 19 Feb 2024 15:28:19 +0000 Subject: [PATCH 1/8] switch to using dotnet pub + image fix --- dotnet-compliance/docker-compose.yml | 13 +++--------- .../eShopLite/Products/Dockerfile | 20 ------------------- .../Store/Components/Pages/Products.razor | 4 +--- dotnet-compliance/eShopLite/Store/Dockerfile | 20 ------------------- .../eShopLite/Store/appsettings.json | 3 +-- dotnet-docker/Products/Dockerfile | 0 .../Store/Components/Pages/Products.razor | 5 ++--- dotnet-docker/Store/Dockerfile | 20 ------------------- dotnet-docker/Store/appsettings.json | 3 +-- .../finished-files/docker-compose.yml | 11 ++-------- dotnet-feature-flags/DockerfileProducts | 20 ------------------- dotnet-feature-flags/DockerfileStore | 20 ------------------- .../Store/Components/Pages/Products.razor | 4 +--- dotnet-feature-flags/Store/appsettings.json | 1 - dotnet-feature-flags/docker-compose.yml | 13 +++--------- dotnet-kubernetes/DockerfileProducts | 20 ------------------- dotnet-kubernetes/DockerfileStore | 20 ------------------- .../Store/Components/Pages/Products.razor | 4 +--- dotnet-kubernetes/Store/appsettings.json | 3 +-- dotnet-kubernetes/docker-compose.yml | 11 ++-------- dotnet-observability/docker-compose.yml | 11 ++-------- .../Store/Components/Pages/Products.razor | 4 +--- .../eShopLite/Store/appsettings.json | 3 +-- dotnet-resiliency/DockerfileProducts | 20 ------------------- dotnet-resiliency/DockerfileStore | 20 ------------------- dotnet-resiliency/docker-compose.yml | 11 ++-------- 26 files changed, 24 insertions(+), 260 deletions(-) delete mode 100644 dotnet-compliance/eShopLite/Products/Dockerfile delete mode 100644 dotnet-compliance/eShopLite/Store/Dockerfile delete mode 100644 dotnet-docker/Products/Dockerfile delete mode 100644 dotnet-docker/Store/Dockerfile delete mode 100644 dotnet-feature-flags/DockerfileProducts delete mode 100644 dotnet-feature-flags/DockerfileStore delete mode 100644 dotnet-kubernetes/DockerfileProducts delete mode 100644 dotnet-kubernetes/DockerfileStore delete mode 100644 dotnet-resiliency/DockerfileProducts delete mode 100644 dotnet-resiliency/DockerfileStore diff --git a/dotnet-compliance/docker-compose.yml b/dotnet-compliance/docker-compose.yml index 650997a..61862e0 100644 --- a/dotnet-compliance/docker-compose.yml +++ b/dotnet-compliance/docker-compose.yml @@ -3,21 +3,14 @@ version: '3.4' services: frontend: - image: storeimage - build: - context: . - dockerfile: ./eShopLite/Store/Dockerfile + image: store:latest environment: - ProductEndpoint=http://backend:8080 - - ImagePrefix=http://localhost:32001 ports: - "32000:8080" depends_on: - backend backend: - image: productservice - build: - context: . - dockerfile: ./eShopLite/Products/Dockerfile + image: products:latest ports: - - "32001:8080" + - "32001:8080" \ No newline at end of file diff --git a/dotnet-compliance/eShopLite/Products/Dockerfile b/dotnet-compliance/eShopLite/Products/Dockerfile deleted file mode 100644 index e13a40d..0000000 --- a/dotnet-compliance/eShopLite/Products/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "eShopLite/DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "eShopLite/DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY "eShopLite/Products/Products.csproj" . -RUN dotnet restore -COPY "eShopLite/Products" . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Products.dll"] \ No newline at end of file diff --git a/dotnet-compliance/eShopLite/Store/Components/Pages/Products.razor b/dotnet-compliance/eShopLite/Store/Components/Pages/Products.razor index 6e63813..d2088bc 100644 --- a/dotnet-compliance/eShopLite/Store/Components/Pages/Products.razor +++ b/dotnet-compliance/eShopLite/Store/Components/Pages/Products.razor @@ -41,7 +41,7 @@ else @foreach (var product in products) { - + @product.Name @product.Description @product.Price @@ -63,7 +63,6 @@ else private bool visible = false; private int selectedProductID; private List? products; - private string imagePrefix = string.Empty; private Order order = new Order { Products = new List() }; @@ -96,7 +95,6 @@ else protected override async Task OnInitializedAsync() { - imagePrefix = Configuration["ImagePrefix"]!; products = await ProductService.GetProducts(); } diff --git a/dotnet-compliance/eShopLite/Store/Dockerfile b/dotnet-compliance/eShopLite/Store/Dockerfile deleted file mode 100644 index 2c3ac30..0000000 --- a/dotnet-compliance/eShopLite/Store/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "eShopLite/DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "eShopLite/DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY "eShopLite/Store/Store.csproj" . -RUN dotnet restore -COPY "eShopLite/Store" . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Store.dll"] \ No newline at end of file diff --git a/dotnet-compliance/eShopLite/Store/appsettings.json b/dotnet-compliance/eShopLite/Store/appsettings.json index 5f7d685..fc774c4 100644 --- a/dotnet-compliance/eShopLite/Store/appsettings.json +++ b/dotnet-compliance/eShopLite/Store/appsettings.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "ProductEndpoint": "http://localhost:32001", - "ProductEndpointHttps": "https://localhost:32001", - "ImagePrefix": "http://localhost:32001/images" + "ProductEndpointHttps": "https://localhost:32001" } diff --git a/dotnet-docker/Products/Dockerfile b/dotnet-docker/Products/Dockerfile deleted file mode 100644 index e69de29..0000000 diff --git a/dotnet-docker/Store/Components/Pages/Products.razor b/dotnet-docker/Store/Components/Pages/Products.razor index 2cfff35..53019f9 100644 --- a/dotnet-docker/Store/Components/Pages/Products.razor +++ b/dotnet-docker/Store/Components/Pages/Products.razor @@ -30,7 +30,8 @@ else @foreach (var product in products) { - + + @product.Name @product.Description @product.Price @@ -42,13 +43,11 @@ else @code { private List? products; - private string imagePrefix = string.Empty; protected override async Task OnInitializedAsync() { // Simulate asynchronous loading to demonstrate streaming rendering await Task.Delay(500); - imagePrefix = Configuration["ImagePrefix"]!; products = await ProductService.GetProducts(); } diff --git a/dotnet-docker/Store/Dockerfile b/dotnet-docker/Store/Dockerfile deleted file mode 100644 index c9159ab..0000000 --- a/dotnet-docker/Store/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Store/Store.csproj . -RUN dotnet restore -COPY Store . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Store.dll"] \ No newline at end of file diff --git a/dotnet-docker/Store/appsettings.json b/dotnet-docker/Store/appsettings.json index a468ba0..dbdf8ae 100644 --- a/dotnet-docker/Store/appsettings.json +++ b/dotnet-docker/Store/appsettings.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "ProductEndpoint": "http://orange-fishstick-5444qv4jxq5h77qp-32001.app.github.dev", - "ProductEndpointHttps": "https://orange-fishstick-5444qv4jxq5h77qp-32001.app.github.dev/", - "ImagePrefix": "http://orange-fishstick-5444qv4jxq5h77qp-32001.app.github.dev/images" + "ProductEndpointHttps": "https://orange-fishstick-5444qv4jxq5h77qp-32001.app.github.dev/" } diff --git a/dotnet-docker/finished-files/docker-compose.yml b/dotnet-docker/finished-files/docker-compose.yml index 51c0d9c..61862e0 100644 --- a/dotnet-docker/finished-files/docker-compose.yml +++ b/dotnet-docker/finished-files/docker-compose.yml @@ -3,21 +3,14 @@ version: '3.4' services: frontend: - image: storeimage - build: - context: . - dockerfile: ./Store/Dockerfile + image: store:latest environment: - ProductEndpoint=http://backend:8080 - - ImagePrefix=http://localhost/images ports: - "32000:8080" depends_on: - backend backend: - image: productservice - build: - context: . - dockerfile: ./Products/Dockerfile + image: products:latest ports: - "32001:8080" \ No newline at end of file diff --git a/dotnet-feature-flags/DockerfileProducts b/dotnet-feature-flags/DockerfileProducts deleted file mode 100644 index c3f84c8..0000000 --- a/dotnet-feature-flags/DockerfileProducts +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Products/Products.csproj . -RUN dotnet restore -COPY Products . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Products.dll"] \ No newline at end of file diff --git a/dotnet-feature-flags/DockerfileStore b/dotnet-feature-flags/DockerfileStore deleted file mode 100644 index c9159ab..0000000 --- a/dotnet-feature-flags/DockerfileStore +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Store/Store.csproj . -RUN dotnet restore -COPY Store . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Store.dll"] \ No newline at end of file diff --git a/dotnet-feature-flags/Store/Components/Pages/Products.razor b/dotnet-feature-flags/Store/Components/Pages/Products.razor index 3d2f62f..3602260 100644 --- a/dotnet-feature-flags/Store/Components/Pages/Products.razor +++ b/dotnet-feature-flags/Store/Components/Pages/Products.razor @@ -37,7 +37,7 @@ else @foreach (var product in products) { - + @product.Name @product.Description @product.Price @@ -49,13 +49,11 @@ else @code { private List? products; - private string imagePrefix = string.Empty; protected override async Task OnInitializedAsync() { // Simulate asynchronous loading to demonstrate streaming rendering await Task.Delay(500); - imagePrefix = Configuration["ImagePrefix"]; products = await ProductService.GetProducts(); } diff --git a/dotnet-feature-flags/Store/appsettings.json b/dotnet-feature-flags/Store/appsettings.json index d3e66df..aeee6c0 100644 --- a/dotnet-feature-flags/Store/appsettings.json +++ b/dotnet-feature-flags/Store/appsettings.json @@ -9,6 +9,5 @@ "AllowedHosts": "*", "ProductEndpoint": "http://localhost:32001", "ProductEndpointHttps": "https://localhost:32001", - "ImagePrefix": "http://localhost:32001/images", "ConnectionStrings:AppConfig": "[PASTE IN YOUR CREDENTIALS HERE]" } diff --git a/dotnet-feature-flags/docker-compose.yml b/dotnet-feature-flags/docker-compose.yml index e9d1f31..2280a0e 100644 --- a/dotnet-feature-flags/docker-compose.yml +++ b/dotnet-feature-flags/docker-compose.yml @@ -3,22 +3,15 @@ version: '3.4' services: frontend: - image: storeimage - build: - context: . - dockerfile: DockerfileStore + image: store:latest environment: - ProductEndpoint=http://backend:8080 - - ImagePrefix=http://localhost:32001/images - ConnectionStrings:AppConfig=[PASTE CONNECTION STRING HERE] ports: - "32000:8080" depends_on: - backend backend: - image: productservice - build: - context: . - dockerfile: DockerfileProducts + image: products:latest ports: - - "32001:8080" + - "32001:8080" \ No newline at end of file diff --git a/dotnet-kubernetes/DockerfileProducts b/dotnet-kubernetes/DockerfileProducts deleted file mode 100644 index c3f84c8..0000000 --- a/dotnet-kubernetes/DockerfileProducts +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Products/Products.csproj . -RUN dotnet restore -COPY Products . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Products.dll"] \ No newline at end of file diff --git a/dotnet-kubernetes/DockerfileStore b/dotnet-kubernetes/DockerfileStore deleted file mode 100644 index c9159ab..0000000 --- a/dotnet-kubernetes/DockerfileStore +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Store/Store.csproj . -RUN dotnet restore -COPY Store . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Store.dll"] \ No newline at end of file diff --git a/dotnet-kubernetes/Store/Components/Pages/Products.razor b/dotnet-kubernetes/Store/Components/Pages/Products.razor index 98f5083..6b7fe6d 100644 --- a/dotnet-kubernetes/Store/Components/Pages/Products.razor +++ b/dotnet-kubernetes/Store/Components/Pages/Products.razor @@ -30,7 +30,7 @@ else @foreach (var product in products) { - + @product.Name @product.Description @product.Price @@ -42,13 +42,11 @@ else @code { private List? products; - private string imagePrefix = string.Empty; protected override async Task OnInitializedAsync() { // Simulate asynchronous loading to demonstrate streaming rendering await Task.Delay(500); - imagePrefix = Configuration["ImagePrefix"]; products = await ProductService.GetProducts(); } diff --git a/dotnet-kubernetes/Store/appsettings.json b/dotnet-kubernetes/Store/appsettings.json index 5f7d685..fc774c4 100644 --- a/dotnet-kubernetes/Store/appsettings.json +++ b/dotnet-kubernetes/Store/appsettings.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "ProductEndpoint": "http://localhost:32001", - "ProductEndpointHttps": "https://localhost:32001", - "ImagePrefix": "http://localhost:32001/images" + "ProductEndpointHttps": "https://localhost:32001" } diff --git a/dotnet-kubernetes/docker-compose.yml b/dotnet-kubernetes/docker-compose.yml index 0c5679a..61862e0 100644 --- a/dotnet-kubernetes/docker-compose.yml +++ b/dotnet-kubernetes/docker-compose.yml @@ -3,21 +3,14 @@ version: '3.4' services: frontend: - image: storeimage - build: - context: . - dockerfile: DockerfileStore + image: store:latest environment: - ProductEndpoint=http://backend:8080 - - ImagePrefix=http://localhost ports: - "32000:8080" depends_on: - backend backend: - image: productservice - build: - context: . - dockerfile: DockerfileProducts + image: products:latest ports: - "32001:8080" \ No newline at end of file diff --git a/dotnet-observability/docker-compose.yml b/dotnet-observability/docker-compose.yml index 44ae025..61862e0 100644 --- a/dotnet-observability/docker-compose.yml +++ b/dotnet-observability/docker-compose.yml @@ -3,21 +3,14 @@ version: '3.4' services: frontend: - image: storeimage - build: - context: . - dockerfile: ./eShopLite/Store/Dockerfile + image: store:latest environment: - ProductEndpoint=http://backend:8080 - - ImagePrefix=http://localhost:32001/images ports: - "32000:8080" depends_on: - backend backend: - image: productservice - build: - context: . - dockerfile: ./eShopLite/Products/Dockerfile + image: products:latest ports: - "32001:8080" \ No newline at end of file diff --git a/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor b/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor index 5d963e7..4d82889 100644 --- a/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor +++ b/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor @@ -32,7 +32,7 @@ else @foreach (var product in products) { - + @product.Name @product.Description @product.Price @@ -53,7 +53,6 @@ else @code { private bool visible = false; private int selectedProductID; - private List? products; private string imagePrefix = string.Empty; private async Task OpenDialog(Product selectedProduct) @@ -75,7 +74,6 @@ else protected override async Task OnInitializedAsync() { - imagePrefix = Configuration["ImagePrefix"]; products = await ProductService.GetProducts(); } diff --git a/dotnet-observability/eShopLite/Store/appsettings.json b/dotnet-observability/eShopLite/Store/appsettings.json index 5f7d685..fc774c4 100644 --- a/dotnet-observability/eShopLite/Store/appsettings.json +++ b/dotnet-observability/eShopLite/Store/appsettings.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "ProductEndpoint": "http://localhost:32001", - "ProductEndpointHttps": "https://localhost:32001", - "ImagePrefix": "http://localhost:32001/images" + "ProductEndpointHttps": "https://localhost:32001" } diff --git a/dotnet-resiliency/DockerfileProducts b/dotnet-resiliency/DockerfileProducts deleted file mode 100644 index c3f84c8..0000000 --- a/dotnet-resiliency/DockerfileProducts +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Products/Products.csproj . -RUN dotnet restore -COPY Products . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Products.dll"] \ No newline at end of file diff --git a/dotnet-resiliency/DockerfileStore b/dotnet-resiliency/DockerfileStore deleted file mode 100644 index c9159ab..0000000 --- a/dotnet-resiliency/DockerfileStore +++ /dev/null @@ -1,20 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build - -WORKDIR /DataEntities -COPY "DataEntities/DataEntities.csproj" . -RUN dotnet restore -COPY "DataEntities" . -RUN dotnet publish -c release -o /app - -WORKDIR /src -COPY Store/Store.csproj . -RUN dotnet restore -COPY Store . -RUN dotnet publish -c release -o /app - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -WORKDIR /app -EXPOSE 80 -EXPOSE 443 -COPY --from=build /app . -ENTRYPOINT ["dotnet", "Store.dll"] \ No newline at end of file diff --git a/dotnet-resiliency/docker-compose.yml b/dotnet-resiliency/docker-compose.yml index 0c5679a..61862e0 100644 --- a/dotnet-resiliency/docker-compose.yml +++ b/dotnet-resiliency/docker-compose.yml @@ -3,21 +3,14 @@ version: '3.4' services: frontend: - image: storeimage - build: - context: . - dockerfile: DockerfileStore + image: store:latest environment: - ProductEndpoint=http://backend:8080 - - ImagePrefix=http://localhost ports: - "32000:8080" depends_on: - backend backend: - image: productservice - build: - context: . - dockerfile: DockerfileProducts + image: products:latest ports: - "32001:8080" \ No newline at end of file From d91c8e4fd980d56c30bf7219e913c558156f4eae Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Tue, 20 Feb 2024 10:23:31 +0000 Subject: [PATCH 2/8] Fixing database settings --- dotnet-compliance/eShopLite/Products/appsettings.json | 2 +- dotnet-feature-flags/Products/appsettings.json | 2 +- dotnet-kubernetes/Products/appsettings.json | 2 +- dotnet-observability/eShopLite/Products/appsettings.json | 2 +- dotnet-resiliency/Products/appsettings.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dotnet-compliance/eShopLite/Products/appsettings.json b/dotnet-compliance/eShopLite/Products/appsettings.json index 13fe579..95643cc 100644 --- a/dotnet-compliance/eShopLite/Products/appsettings.json +++ b/dotnet-compliance/eShopLite/Products/appsettings.json @@ -7,6 +7,6 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "ProductsContext": "Data Source=Database.db" + "ProductsContext": "Data Source=/home/app/Database.db" } } \ No newline at end of file diff --git a/dotnet-feature-flags/Products/appsettings.json b/dotnet-feature-flags/Products/appsettings.json index 13fe579..95643cc 100644 --- a/dotnet-feature-flags/Products/appsettings.json +++ b/dotnet-feature-flags/Products/appsettings.json @@ -7,6 +7,6 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "ProductsContext": "Data Source=Database.db" + "ProductsContext": "Data Source=/home/app/Database.db" } } \ No newline at end of file diff --git a/dotnet-kubernetes/Products/appsettings.json b/dotnet-kubernetes/Products/appsettings.json index 13fe579..95643cc 100644 --- a/dotnet-kubernetes/Products/appsettings.json +++ b/dotnet-kubernetes/Products/appsettings.json @@ -7,6 +7,6 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "ProductsContext": "Data Source=Database.db" + "ProductsContext": "Data Source=/home/app/Database.db" } } \ No newline at end of file diff --git a/dotnet-observability/eShopLite/Products/appsettings.json b/dotnet-observability/eShopLite/Products/appsettings.json index 13fe579..95643cc 100644 --- a/dotnet-observability/eShopLite/Products/appsettings.json +++ b/dotnet-observability/eShopLite/Products/appsettings.json @@ -7,6 +7,6 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "ProductsContext": "Data Source=Database.db" + "ProductsContext": "Data Source=/home/app/Database.db" } } \ No newline at end of file diff --git a/dotnet-resiliency/Products/appsettings.json b/dotnet-resiliency/Products/appsettings.json index 13fe579..95643cc 100644 --- a/dotnet-resiliency/Products/appsettings.json +++ b/dotnet-resiliency/Products/appsettings.json @@ -7,6 +7,6 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "ProductsContext": "Data Source=Database.db" + "ProductsContext": "Data Source=/home/app/Database.db" } } \ No newline at end of file From 829adf5fb89dc53032f10acc30e54f533307a32b Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Thu, 22 Feb 2024 09:55:48 +0000 Subject: [PATCH 3/8] fixes for resiliency --- dotnet-kubernetes/finished-files/frontend-deploy.yml | 2 -- dotnet-resiliency/Store/Program.cs | 4 ++++ dotnet-resiliency/Store/Store.csproj | 4 ++++ dotnet-resiliency/frontend-deploy.yml | 2 -- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dotnet-kubernetes/finished-files/frontend-deploy.yml b/dotnet-kubernetes/finished-files/frontend-deploy.yml index f342eb6..c657174 100644 --- a/dotnet-kubernetes/finished-files/frontend-deploy.yml +++ b/dotnet-kubernetes/finished-files/frontend-deploy.yml @@ -20,8 +20,6 @@ spec: value: http://*:80 - name: ProductEndpoint value: http://productsbackend - - name: ImagePrefix - value: http://localhost/images selector: matchLabels: app: storefrontend diff --git a/dotnet-resiliency/Store/Program.cs b/dotnet-resiliency/Store/Program.cs index 720fb3c..f45b081 100644 --- a/dotnet-resiliency/Store/Program.cs +++ b/dotnet-resiliency/Store/Program.cs @@ -1,5 +1,6 @@ using Store.Components; using Store.Services; +using Microsoft.Extensions.Http.Resilience; var builder = WebApplication.CreateBuilder(args); @@ -9,6 +10,9 @@ var url = builder.Configuration["ProductEndpoint"] ?? throw new InvalidOperationException("ProductEndpoint is not set"); c.BaseAddress = new(url); +}).AddStandardResilienceHandler(options => +{ + options.Retry.MaxRetryAttempts = 7; }); // Add services to the container. diff --git a/dotnet-resiliency/Store/Store.csproj b/dotnet-resiliency/Store/Store.csproj index 3323685..8d1e926 100644 --- a/dotnet-resiliency/Store/Store.csproj +++ b/dotnet-resiliency/Store/Store.csproj @@ -11,4 +11,8 @@ + + + + diff --git a/dotnet-resiliency/frontend-deploy.yml b/dotnet-resiliency/frontend-deploy.yml index f342eb6..c657174 100644 --- a/dotnet-resiliency/frontend-deploy.yml +++ b/dotnet-resiliency/frontend-deploy.yml @@ -20,8 +20,6 @@ spec: value: http://*:80 - name: ProductEndpoint value: http://productsbackend - - name: ImagePrefix - value: http://localhost/images selector: matchLabels: app: storefrontend From a7581c1bcd5652780381b0ef640e4eb56febace8 Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Thu, 22 Feb 2024 10:10:58 +0000 Subject: [PATCH 4/8] fixing resiliency --- .../eShopLite/Store/Components/Pages/Products.razor | 5 ++--- dotnet-resiliency/Store/Components/Pages/Products.razor | 5 ++--- dotnet-resiliency/Store/appsettings.json | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dotnet-observability/finished-files/eShopLite/Store/Components/Pages/Products.razor b/dotnet-observability/finished-files/eShopLite/Store/Components/Pages/Products.razor index 71ff54e..6208d17 100644 --- a/dotnet-observability/finished-files/eShopLite/Store/Components/Pages/Products.razor +++ b/dotnet-observability/finished-files/eShopLite/Store/Components/Pages/Products.razor @@ -32,7 +32,8 @@ else @foreach (var product in products) { - + + @product.Name @product.Description @product.Price @@ -54,7 +55,6 @@ else private bool visible = false; private Product selectedProduct; private List? products; - private string imagePrefix = string.Empty; private async Task OpenDialog(Product product) { @@ -75,7 +75,6 @@ else protected override async Task OnInitializedAsync() { - imagePrefix = Configuration["ImagePrefix"]; products = await ProductService.GetProducts(); } diff --git a/dotnet-resiliency/Store/Components/Pages/Products.razor b/dotnet-resiliency/Store/Components/Pages/Products.razor index ce32727..0d9dedc 100644 --- a/dotnet-resiliency/Store/Components/Pages/Products.razor +++ b/dotnet-resiliency/Store/Components/Pages/Products.razor @@ -33,7 +33,8 @@ else @foreach (var product in products) { - + + @product.Name @product.Description @product.Price @@ -45,13 +46,11 @@ else @code { private List? products; - private string imagePrefix = string.Empty; protected override async Task OnInitializedAsync() { // Simulate asynchronous loading to demonstrate streaming rendering await Task.Delay(500); - imagePrefix = Configuration["ImagePrefix"]; products = await ProductService.GetProducts(); } diff --git a/dotnet-resiliency/Store/appsettings.json b/dotnet-resiliency/Store/appsettings.json index 5f7d685..fc774c4 100644 --- a/dotnet-resiliency/Store/appsettings.json +++ b/dotnet-resiliency/Store/appsettings.json @@ -8,6 +8,5 @@ }, "AllowedHosts": "*", "ProductEndpoint": "http://localhost:32001", - "ProductEndpointHttps": "https://localhost:32001", - "ImagePrefix": "http://localhost:32001/images" + "ProductEndpointHttps": "https://localhost:32001" } From 684b897f55a443b92dbed1788badc60d2dca3f84 Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Thu, 22 Feb 2024 10:28:43 +0000 Subject: [PATCH 5/8] resetting the lab --- dotnet-resiliency/Store/Program.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dotnet-resiliency/Store/Program.cs b/dotnet-resiliency/Store/Program.cs index f45b081..720fb3c 100644 --- a/dotnet-resiliency/Store/Program.cs +++ b/dotnet-resiliency/Store/Program.cs @@ -1,6 +1,5 @@ using Store.Components; using Store.Services; -using Microsoft.Extensions.Http.Resilience; var builder = WebApplication.CreateBuilder(args); @@ -10,9 +9,6 @@ var url = builder.Configuration["ProductEndpoint"] ?? throw new InvalidOperationException("ProductEndpoint is not set"); c.BaseAddress = new(url); -}).AddStandardResilienceHandler(options => -{ - options.Retry.MaxRetryAttempts = 7; }); // Add services to the container. From a89fd7d94f2defd706c19cdf0386cbd0e32d3e75 Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Thu, 22 Feb 2024 10:32:45 +0000 Subject: [PATCH 6/8] removing package --- dotnet-resiliency/Store/Store.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dotnet-resiliency/Store/Store.csproj b/dotnet-resiliency/Store/Store.csproj index 8d1e926..3323685 100644 --- a/dotnet-resiliency/Store/Store.csproj +++ b/dotnet-resiliency/Store/Store.csproj @@ -11,8 +11,4 @@ - - - - From 6df1c713dded42afc14b41e63ec13f4b5e7dca14 Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Thu, 22 Feb 2024 14:55:54 +0000 Subject: [PATCH 7/8] Fixing typo --- dotnet-observability/eShopLite/Products/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet-observability/eShopLite/Products/Program.cs b/dotnet-observability/eShopLite/Products/Program.cs index 8230ea8..883bf3e 100644 --- a/dotnet-observability/eShopLite/Products/Program.cs +++ b/dotnet-observability/eShopLite/Products/Program.cs @@ -1,4 +1,4 @@ -vusing Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Products.Data; using Products.Endpoints; From d8298e8c2fc29dbc390a92e85fabcfbd98b91c65 Mon Sep 17 00:00:00 2001 From: Phil Stollery Date: Thu, 22 Feb 2024 15:21:07 +0000 Subject: [PATCH 8/8] Bug fix --- .../eShopLite/Store/Components/Pages/Products.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor b/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor index 4d82889..d105997 100644 --- a/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor +++ b/dotnet-observability/eShopLite/Store/Components/Pages/Products.razor @@ -53,7 +53,7 @@ else @code { private bool visible = false; private int selectedProductID; - private string imagePrefix = string.Empty; + private List? products; private async Task OpenDialog(Product selectedProduct) {