From e1ec790ddf2a58829690a77e88b0d5039a0e13b9 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sat, 6 May 2023 10:29:37 -0700 Subject: [PATCH] Make more things work with docker compose --- .../Web.Shopping.HttpAggregator.csproj | 2 - .../Catalog/Catalog.API/Catalog.API.csproj | 13 ----- .../Catalog.API/Controllers/PicController.cs | 5 +- src/Services/Catalog/Catalog.API/Program.cs | 6 -- src/docker-compose.override.yml | 58 +++++++++---------- 5 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj b/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj index b6d698cdc..f5156ca94 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj @@ -11,8 +11,6 @@ - - diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 9c96ff461..8a4669c16 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -12,9 +12,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -50,14 +47,4 @@ - - - - PreserveNewest - - - PreserveNewest - - - diff --git a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs index dfb6f0d03..3db794f02 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs @@ -31,15 +31,14 @@ public class PicController : ControllerBase if (item != null) { - var webRoot = _env.WebRootPath; - var path = Path.Combine(webRoot, item.PictureFileName); + var path = Path.Combine(_env.ContentRootPath, "Pics", item.PictureFileName); string imageFileExtension = Path.GetExtension(item.PictureFileName); string mimetype = GetImageMimeTypeFromImageFileExtension(imageFileExtension); var buffer = await System.IO.File.ReadAllBytesAsync(path); - return File(buffer, mimetype); + return PhysicalFile(path, mimetype); } return NotFound(); diff --git a/src/Services/Catalog/Catalog.API/Program.cs b/src/Services/Catalog/Catalog.API/Program.cs index cac05401e..006a8b29b 100644 --- a/src/Services/Catalog/Catalog.API/Program.cs +++ b/src/Services/Catalog/Catalog.API/Program.cs @@ -23,12 +23,6 @@ if (!await app.CheckHealthAsync()) app.UseServiceDefaults(); -app.UseFileServer(new FileServerOptions -{ - FileProvider = new PhysicalFileProvider(Path.Combine(app.Environment.ContentRootPath, "Pics")), - RequestPath = "/pics" -}); - app.MapGet("/", () => Results.Redirect("/swagger")); app.MapControllers(); diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index ac2c1872c..428228c9c 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -44,7 +44,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104 - XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback - - ConnectionString=${ESHOP_AZURE_IDENTITY_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__IdentityDb=${ESHOP_AZURE_IDENTITY_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 @@ -62,13 +62,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basketdata} + - ConnectionStrings__Redis=${ESHOP_AZURE_REDIS_BASKET_DB:-basketdata} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - Identity__Url=http://identity-api - Identity__ExternalUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - - AzureServiceBusEnabled=False + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} - UseLoadTest=${USE_LOADTEST:-False} @@ -82,15 +81,14 @@ services: catalog-api: environment: - ASPNETCORE_ENVIRONMENT=Development - - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__CatalogDb=${ESHOP_AZURE_CATALOG_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - PicBaseUrl=${ESHOP_STORAGE_CATALOG_URL} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} - UseCustomizationData=True - - AzureServiceBusEnabled=False - AzureStorageEnabled=False - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} @@ -105,12 +103,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__OrderingDb=${ESHOP_AZURE_ORDERING_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - Identity__Url=http://identity-api - Identity__ExternalUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - UseCustomizationData=True - AzureServiceBusEnabled=False - CheckUpdateTime=30000 @@ -128,10 +126,10 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - ConnectionStrings__OrderingDb=${ESHOP_AZURE_ORDERING_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - UseCustomizationData=True - AzureServiceBusEnabled=False - CheckUpdateTime=30000 @@ -146,9 +144,9 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - AzureServiceBusEnabled=False - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} @@ -159,10 +157,10 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_WEBHOOKS_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.WebhooksDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - ConnectionStrings__WebhooksDb=${ESHOP_AZURE_WEBHOOKS_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.WebhooksDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - Identity__Url=http://identity-api - Identity__ExternalUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 ports: @@ -226,13 +224,13 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBus__UserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBus__Password=${ESHOP_SERVICE_BUS_PASSWORD} - AzureServiceBusEnabled=False - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} - - identityUrl=http://identity-api + - Identity__Url=http://identity-api ports: - "5112:80"