diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 093612225..f7b86dce7 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -88,6 +88,25 @@ services: - "5102:80" # Important: In a production environment your should remove the external port (5102) kept here for microservice debugging purposes. # The API Gateway redirects and access through the internal port (80). + + ordering.backgroundtasks: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - UseCustomizationData=True + - AzureServiceBusEnabled=False + - CheckUpdateTime=30000 + - GracePeriodTime=1 + - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} + - OrchestratorType=${ORCHESTRATOR_TYPE} + - UseLoadTest=${USE_LOADTEST:-False} + ports: + - "5111:80" + marketing.api: environment: - ASPNETCORE_ENVIRONMENT=Development @@ -158,6 +177,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - CatalogUrl=http://catalog.api/hc - OrderingUrl=http://ordering.api/hc + - OrderingBackgroundTasksUrl=http://ordering.backgroundtasks/hc - BasketUrl=http://basket.api/hc - IdentityUrl=http://identity.api/hc - LocationsUrl=http://locations.api/hc diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 2b6893ba0..06dcbde6f 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -92,6 +92,25 @@ services: ports: - "80" # The API Gateway redirects and access through the internal port (80). + + ordering.backgroundtasks: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - UseCustomizationData=True + - AzureServiceBusEnabled=False + - CheckUpdateTime=30000 + - GracePeriodTime=1 + - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} + - OrchestratorType=${ORCHESTRATOR_TYPE} + - UseLoadTest=${USE_LOADTEST:-False} + ports: + - "5111:80" + marketing.api: environment: - ASPNETCORE_ENVIRONMENT=Development @@ -161,6 +180,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - CatalogUrl=http://catalog.api/hc - OrderingUrl=http://ordering.api/hc + - OrderingBackgroundTasksUrl=http://ordering.backgroundtasks/hc - BasketUrl=http://basket.api/hc - IdentityUrl=http://identity.api/hc - LocationsUrl=http://locations.api/hc diff --git a/docker-compose.yml b/docker-compose.yml index 122123644..b290f377a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,15 @@ services: - sql.data - rabbitmq + ordering.backgroundtasks: + image: eshop/ordering.backgroundtasks:${TAG:-latest} + build: + context: . + dockerfile: src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile + depends_on: + - sql.data + - rabbitmq + marketing.api: image: eshop/marketing.api:${TAG:-latest} build: diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index d75a644ff..07764b653 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -128,6 +128,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mobile.Shopping.HttpAggrega EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web.Shopping.HttpAggregator", "src\ApiGateways\Web.Bff.Shopping\aggregator\Web.Shopping.HttpAggregator.csproj", "{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.BackgroundTasks", "src\Services\Ordering\Ordering.BackgroundTasks\Ordering.BackgroundTasks.csproj", "{2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -1486,6 +1488,54 @@ Global {AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x64.Build.0 = Release|Any CPU {AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x86.ActiveCfg = Release|Any CPU {AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x86.Build.0 = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|ARM.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|iPhone.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|x64.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|x64.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|x86.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.AppStore|x86.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|ARM.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|ARM.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|iPhone.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|x64.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|x64.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|x86.ActiveCfg = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Debug|x86.Build.0 = Debug|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|Any CPU.Build.0 = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|ARM.ActiveCfg = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|ARM.Build.0 = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|iPhone.ActiveCfg = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|iPhone.Build.0 = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|x64.ActiveCfg = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|x64.Build.0 = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|x86.ActiveCfg = Release|Any CPU + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1541,6 +1591,7 @@ Global {3F79558C-485D-49E1-BD3E-E12538D3D308} = {EC91ADE9-3D66-4AB2-9FB4-2B585E1F3531} {BEA37D6D-4CF2-4AE8-9575-72388E54FBD0} = {0189E4FB-6E2B-4F2E-9B1D-5473D23FC6DB} {AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1} = {28C0F5C8-4849-4035-80AB-45639424E73F} + {2F2796B3-6386-4BD6-9A0D-BB3F2FB52404} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} diff --git a/src/Web/WebStatus/Startup.cs b/src/Web/WebStatus/Startup.cs index 6f32ce5a8..a4900db30 100644 --- a/src/Web/WebStatus/Startup.cs +++ b/src/Web/WebStatus/Startup.cs @@ -39,6 +39,7 @@ namespace WebStatus } checks.AddUrlCheckIfNotNull(Configuration["OrderingUrl"], TimeSpan.FromMinutes(minutes)); + checks.AddUrlCheckIfNotNull(Configuration["OrderingBackgroundTasksUrl"], TimeSpan.FromMinutes(minutes)); checks.AddUrlCheckIfNotNull(Configuration["BasketUrl"], TimeSpan.Zero); //No cache for this HealthCheck, better just for demos checks.AddUrlCheckIfNotNull(Configuration["CatalogUrl"], TimeSpan.FromMinutes(minutes)); checks.AddUrlCheckIfNotNull(Configuration["IdentityUrl"], TimeSpan.FromMinutes(minutes)); diff --git a/src/Web/WebStatus/Views/Home/Index.cshtml b/src/Web/WebStatus/Views/Home/Index.cshtml index 43fe92891..a3befe611 100644 --- a/src/Web/WebStatus/Views/Home/Index.cshtml +++ b/src/Web/WebStatus/Views/Home/Index.cshtml @@ -1,13 +1,29 @@ -@model WebStatus.Viewmodels.HealthStatusViewModel +@using Microsoft.AspNetCore.Html +@using Microsoft.Extensions.HealthChecks +@model WebStatus.Viewmodels.HealthStatusViewModel @{ ViewData["Title"] = "System Status"; + +} + +@functions +{ + static readonly string[] LabelClass = new[] { "default", "danger", "success", "warning" }; + + public HtmlString StatusLabel(CheckStatus status) + { + return new HtmlString($@"{status}"); + } + } + +
-

Overall Status: @Model.OverallStatus

+

Overall Status: @StatusLabel(Model.OverallStatus)

@@ -15,33 +31,21 @@ @foreach (var result in Model.Results) {
-
+

@result.Name

- @if (result.Result.Data.ContainsKey("url")) { -

@result.Result.Data["url"]

+ @if (result.Result.Data.ContainsKey("url")) + { +

@result.Result.Data["url"]

} - @result.Result.Description +

+ @result.Result.Description +

-
- @if (@result.Result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Healthy) - { - @result.Result.CheckStatus - } - else if (@result.Result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Unhealthy) - { - @result.Result.CheckStatus - } - else if (@result.Result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Warning) - { - @result.Result.CheckStatus - } - else - { - @result.Result.CheckStatus - } +
+

@StatusLabel(result.Result.CheckStatus)

-
+
}
\ No newline at end of file diff --git a/src/Web/WebStatus/appsettings.json b/src/Web/WebStatus/appsettings.json index bf413fcbf..2ab5ad818 100644 --- a/src/Web/WebStatus/appsettings.json +++ b/src/Web/WebStatus/appsettings.json @@ -8,6 +8,7 @@ } }, "OrderingUrl": "http://localhost:5102/hc", + "OrderingBackgroundTasksUrl": "http://localhost:5111/hc", "BasketUrl": "http://localhost:5103/hc", "CatalogUrl": "http://localhost:5101/hc", "IdentityUrl": "http://localhost:5105/hc",