diff --git a/k8s/helm/apigwmm/templates/deployment.yaml b/k8s/helm/apigwmm/templates/deployment.yaml index c22c03705..384667243 100644 --- a/k8s/helm/apigwmm/templates/deployment.yaml +++ b/k8s/helm/apigwmm/templates/deployment.yaml @@ -86,6 +86,9 @@ spec: - name: http containerPort: 80 protocol: TCP + - name: admin + containerPort: 8001 + protocol: TCP resources: {{ toYaml .Values.resources | indent 12 }} {{- with .Values.nodeSelector }} diff --git a/k8s/helm/apigwmm/templates/service.yaml b/k8s/helm/apigwmm/templates/service.yaml index dac59b23a..286277c7d 100644 --- a/k8s/helm/apigwmm/templates/service.yaml +++ b/k8s/helm/apigwmm/templates/service.yaml @@ -14,6 +14,10 @@ spec: targetPort: http protocol: TCP name: http + - port: {{ .Values.service.adminPort }} + targetPort: admin + protocol: TCP + name: admin selector: app: {{ template "apigwmm.name" . }} release: {{ .Release.Name }} diff --git a/k8s/helm/apigwmm/values.yaml b/k8s/helm/apigwmm/values.yaml index a3e7d8586..21f12f27a 100644 --- a/k8s/helm/apigwmm/values.yaml +++ b/k8s/helm/apigwmm/values.yaml @@ -9,6 +9,7 @@ image: service: type: ClusterIP port: 80 + adminPort: 8001 ingress: enabled: true @@ -30,3 +31,15 @@ env: {} envoy: configPath: /etc/envoy + +probes: + liveness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 15 + port: 8001 + readiness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 60 + port: 8001 \ No newline at end of file diff --git a/k8s/helm/apigwms/envoy.yaml b/k8s/helm/apigwms/envoy.yaml index 483e97cb6..4d9f449cb 100644 --- a/k8s/helm/apigwms/envoy.yaml +++ b/k8s/helm/apigwms/envoy.yaml @@ -35,12 +35,12 @@ static_resources: - match: prefix: "/o/" route: - prefix_rewrite: "/order-api/" + prefix_rewrite: "/ordering-api/" cluster: ordering - match: - prefix: "/order-api/" + prefix: "/ordering-api/" route: - cluster: catalog + cluster: ordering - match: prefix: "/b/" route: diff --git a/k8s/helm/apigwms/templates/deployment.yaml b/k8s/helm/apigwms/templates/deployment.yaml index 253116be7..5fa27a6ea 100644 --- a/k8s/helm/apigwms/templates/deployment.yaml +++ b/k8s/helm/apigwms/templates/deployment.yaml @@ -86,6 +86,9 @@ spec: - name: http containerPort: 80 protocol: TCP + - name: admin + containerPort: 8001 + protocol: TCP resources: {{ toYaml .Values.resources | indent 12 }} {{- with .Values.nodeSelector }} diff --git a/k8s/helm/apigwms/templates/service.yaml b/k8s/helm/apigwms/templates/service.yaml index 2a37d3c14..aa087d428 100644 --- a/k8s/helm/apigwms/templates/service.yaml +++ b/k8s/helm/apigwms/templates/service.yaml @@ -14,6 +14,10 @@ spec: targetPort: http protocol: TCP name: http + - port: {{ .Values.service.adminPort }} + targetPort: admin + protocol: TCP + name: admin selector: app: {{ template "apigwms.name" . }} release: {{ .Release.Name }} diff --git a/k8s/helm/apigwms/values.yaml b/k8s/helm/apigwms/values.yaml index 1ec7bf1c9..4a92d85e9 100644 --- a/k8s/helm/apigwms/values.yaml +++ b/k8s/helm/apigwms/values.yaml @@ -9,6 +9,7 @@ image: service: type: ClusterIP port: 80 + adminPort: 8001 ingress: enabled: true @@ -29,4 +30,16 @@ affinity: {} env: {} envoy: - configPath: /etc/envoy \ No newline at end of file + configPath: /etc/envoy + +probes: + liveness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 15 + port: 8001 + readiness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 60 + port: 8001 \ No newline at end of file diff --git a/k8s/helm/apigwwm/templates/deployment.yaml b/k8s/helm/apigwwm/templates/deployment.yaml index 8e99697f5..492fc019f 100644 --- a/k8s/helm/apigwwm/templates/deployment.yaml +++ b/k8s/helm/apigwwm/templates/deployment.yaml @@ -86,6 +86,9 @@ spec: - name: http containerPort: 80 protocol: TCP + - name: admin + containerPort: 8001 + protocol: TCP resources: {{ toYaml .Values.resources | indent 12 }} {{- with .Values.nodeSelector }} diff --git a/k8s/helm/apigwwm/templates/service.yaml b/k8s/helm/apigwwm/templates/service.yaml index 0ee3c4fb0..cb11cc665 100644 --- a/k8s/helm/apigwwm/templates/service.yaml +++ b/k8s/helm/apigwwm/templates/service.yaml @@ -14,6 +14,10 @@ spec: targetPort: http protocol: TCP name: http + - port: {{ .Values.service.adminPort }} + targetPort: admin + protocol: TCP + name: admin selector: app: {{ template "apigwwm.name" . }} release: {{ .Release.Name }} diff --git a/k8s/helm/apigwwm/values.yaml b/k8s/helm/apigwwm/values.yaml index 9cfa3de16..d866c2d3c 100644 --- a/k8s/helm/apigwwm/values.yaml +++ b/k8s/helm/apigwwm/values.yaml @@ -9,6 +9,7 @@ image: service: type: ClusterIP port: 80 + adminPort: 8001 ingress: enabled: true @@ -30,4 +31,16 @@ affinity: {} env: {} envoy: - configPath: /etc/envoy \ No newline at end of file + configPath: /etc/envoy + +probes: + liveness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 15 + port: 8001 + readiness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 60 + port: 8001 \ No newline at end of file diff --git a/k8s/helm/apigwws/envoy.yaml b/k8s/helm/apigwws/envoy.yaml index 483e97cb6..4d9f449cb 100644 --- a/k8s/helm/apigwws/envoy.yaml +++ b/k8s/helm/apigwws/envoy.yaml @@ -35,12 +35,12 @@ static_resources: - match: prefix: "/o/" route: - prefix_rewrite: "/order-api/" + prefix_rewrite: "/ordering-api/" cluster: ordering - match: - prefix: "/order-api/" + prefix: "/ordering-api/" route: - cluster: catalog + cluster: ordering - match: prefix: "/b/" route: diff --git a/k8s/helm/apigwws/templates/deployment.yaml b/k8s/helm/apigwws/templates/deployment.yaml index 6c98d752d..c0afcb1d9 100644 --- a/k8s/helm/apigwws/templates/deployment.yaml +++ b/k8s/helm/apigwws/templates/deployment.yaml @@ -85,6 +85,9 @@ spec: - name: http containerPort: 80 protocol: TCP + - name: admin + containerPort: 8001 + protocol: TCP resources: {{ toYaml .Values.resources | indent 12 }} {{- with .Values.nodeSelector }} diff --git a/k8s/helm/apigwws/templates/service.yaml b/k8s/helm/apigwws/templates/service.yaml index 5d74c2ad0..55f6daf3f 100644 --- a/k8s/helm/apigwws/templates/service.yaml +++ b/k8s/helm/apigwws/templates/service.yaml @@ -14,6 +14,10 @@ spec: targetPort: http protocol: TCP name: http + - port: {{ .Values.service.adminPort }} + targetPort: admin + protocol: TCP + name: admin selector: app: {{ template "apigwws.name" . }} release: {{ .Release.Name }} diff --git a/k8s/helm/apigwws/values.yaml b/k8s/helm/apigwws/values.yaml index 3e9ab8a7e..fb1182dac 100644 --- a/k8s/helm/apigwws/values.yaml +++ b/k8s/helm/apigwws/values.yaml @@ -9,6 +9,7 @@ image: service: type: ClusterIP port: 80 + adminPort: 8001 ingress: enabled: true @@ -30,4 +31,16 @@ affinity: {} env: {} envoy: - configPath: /etc/envoy \ No newline at end of file + configPath: /etc/envoy + +probes: + liveness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 15 + port: 8001 + readiness: + path: /ready + initialDelaySeconds: 5 + periodSeconds: 60 + port: 8001 \ No newline at end of file diff --git a/k8s/helm/webstatus/templates/configmap.yaml b/k8s/helm/webstatus/templates/configmap.yaml index 4a1b612f2..ae0c0691c 100644 --- a/k8s/helm/webstatus/templates/configmap.yaml +++ b/k8s/helm/webstatus/templates/configmap.yaml @@ -24,13 +24,13 @@ data: name__spa__hc: WebSPA HTTP Check internalurls__spa__hc: http://{{ .Values.app.svc.spa }}/hc name__apigwws__hc: Web Shopping API GW HTTP Check - internalurls__apigwws__hc: http://{{ .Values.app.svc.webshoppingapigw }}/hc + internalurls__apigwws__hc: http://{{ .Values.app.svc.webshoppingapigw }}:8001/ready name__apigwwm__hc: Web Marketing API GW HTTP Check - internalurls__apigwwm__hc: http://{{ .Values.app.svc.webmarketingapigw }}/hc + internalurls__apigwwm__hc: http://{{ .Values.app.svc.webmarketingapigw }}:8001/ready name__apigwms__hc: Mobile Shopping API GW HTTP Check - internalurls__apigwms__hc: http://{{ .Values.app.svc.mobileshoppingapigw }}/hc + internalurls__apigwms__hc: http://{{ .Values.app.svc.mobileshoppingapigw }}:8001/ready name__apigwmm__hc: Mobile Marketing API GW HTTP Check - internalurls__apigwmm__hc: http://{{ .Values.app.svc.mobilemarketingapigw }}/hc + internalurls__apigwmm__hc: http://{{ .Values.app.svc.mobilemarketingapigw }}:8001/ready name__apigwwsagg__hc: Web Shopping Aggregator GW HTTP Check internalurls__apigwwsagg__hc: http://{{ .Values.app.svc.webshoppingagg }}/hc name__apigwmsagg__hc: Mobile Shopping Aggregator HTTP Check diff --git a/k8s/helm/webstatus/values.yaml b/k8s/helm/webstatus/values.yaml index 04028eaa4..7d23ce227 100644 --- a/k8s/helm/webstatus/values.yaml +++ b/k8s/helm/webstatus/values.yaml @@ -86,6 +86,24 @@ env: key: name__payment__hc - name: HealthChecks-UI__HealthChecks__12__Uri key: internalurls__payment__hc + + - name: HealthChecks-UI__HealthChecks__13__Name + key: name__apigwws__hc + - name: HealthChecks-UI__HealthChecks__13__Uri + key: internalurls__apigwws__hc + - name: HealthChecks-UI__HealthChecks__14__Name + key: name__apigwwm__hc + - name: HealthChecks-UI__HealthChecks__14__Uri + key: internalurls__apigwwm__hc + - name: HealthChecks-UI__HealthChecks__15__Name + key: name__apigwms__hc + - name: HealthChecks-UI__HealthChecks__15__Uri + key: internalurls__apigwms__hc + - name: HealthChecks-UI__HealthChecks__16__Name + key: name__apigwmm__hc + - name: HealthChecks-UI__HealthChecks__16__Uri + key: internalurls__apigwmm__hc + # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) values: - name: ASPNETCORE_ENVIRONMENT diff --git a/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml b/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml index 483e97cb6..4d9f449cb 100644 --- a/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml +++ b/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml @@ -35,12 +35,12 @@ static_resources: - match: prefix: "/o/" route: - prefix_rewrite: "/order-api/" + prefix_rewrite: "/ordering-api/" cluster: ordering - match: - prefix: "/order-api/" + prefix: "/ordering-api/" route: - cluster: catalog + cluster: ordering - match: prefix: "/b/" route: diff --git a/src/ApiGateways/Envoy/config/webshopping/envoy.yaml b/src/ApiGateways/Envoy/config/webshopping/envoy.yaml index 483e97cb6..4d9f449cb 100644 --- a/src/ApiGateways/Envoy/config/webshopping/envoy.yaml +++ b/src/ApiGateways/Envoy/config/webshopping/envoy.yaml @@ -35,12 +35,12 @@ static_resources: - match: prefix: "/o/" route: - prefix_rewrite: "/order-api/" + prefix_rewrite: "/ordering-api/" cluster: ordering - match: - prefix: "/order-api/" + prefix: "/ordering-api/" route: - cluster: catalog + cluster: ordering - match: prefix: "/b/" route: diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.Development.json b/src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.Development.json new file mode 100644 index 000000000..19b8c1529 --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.Development.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "IncludeScopes": false, + "Debug": { + "LogLevel": { + "Default": "Debug" + } + }, + "Console": { + "LogLevel": { + "Default": "Debug" + } + } + } +} diff --git a/src/Web/WebMVC/Infrastructure/WebContextSeed.cs b/src/Web/WebMVC/Infrastructure/WebContextSeed.cs index c34730ac1..bc4165c0a 100644 --- a/src/Web/WebMVC/Infrastructure/WebContextSeed.cs +++ b/src/Web/WebMVC/Infrastructure/WebContextSeed.cs @@ -2,8 +2,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.eShopOnContainers.WebMVC; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Serilog; using System; using System.IO; using System.IO.Compression; @@ -13,9 +13,9 @@ namespace WebMVC.Infrastructure { public class WebContextSeed { - public static void Seed(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory) + public static void Seed(IApplicationBuilder applicationBuilder, IHostingEnvironment env) { - var log = loggerFactory.CreateLogger(); + var log = Serilog.Log.Logger; var settings = (AppSettings)applicationBuilder .ApplicationServices.GetRequiredService>().Value; @@ -39,7 +39,7 @@ namespace WebMVC.Infrastructure string overrideCssFile = Path.Combine(contentRootPath, "Setup", "override.css"); if (!File.Exists(overrideCssFile)) { - log.LogError("Override css file '{FileName}' does not exists.", overrideCssFile); + log.Error("Override css file '{FileName}' does not exists.", overrideCssFile); return; } @@ -48,7 +48,7 @@ namespace WebMVC.Infrastructure } catch (Exception ex) { - log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); + log.Error(ex, "EXCEPTION ERROR: {Message}", ex.Message); } } @@ -59,7 +59,7 @@ namespace WebMVC.Infrastructure string imagesZipFile = Path.Combine(contentRootPath, "Setup", "images.zip"); if (!File.Exists(imagesZipFile)) { - log.LogError("Zip file '{ZipFileName}' does not exists.", imagesZipFile); + log.Error("Zip file '{ZipFileName}' does not exists.", imagesZipFile); return; } @@ -81,14 +81,14 @@ namespace WebMVC.Infrastructure } else { - log.LogWarning("Skipped file '{FileName}' in zipfile '{ZipFileName}'", entry.Name, imagesZipFile); + log.Warning("Skipped file '{FileName}' in zipfile '{ZipFileName}'", entry.Name, imagesZipFile); } } } } catch ( Exception ex ) { - log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); + log.Error(ex, "EXCEPTION ERROR: {Message}", ex.Message); } } diff --git a/src/Web/WebMVC/Program.cs b/src/Web/WebMVC/Program.cs index a80d0514b..5a149ab44 100644 --- a/src/Web/WebMVC/Program.cs +++ b/src/Web/WebMVC/Program.cs @@ -53,15 +53,18 @@ namespace Microsoft.eShopOnContainers.WebMVC { var seqServerUrl = configuration["Serilog:SeqServerUrl"]; var logstashUrl = configuration["Serilog:LogstashgUrl"]; - return new LoggerConfiguration() - .MinimumLevel.Verbose() + var cfg = new LoggerConfiguration() + .ReadFrom.Configuration(configuration) .Enrich.WithProperty("ApplicationContext", AppName) .Enrich.FromLogContext() - .WriteTo.Console() - .WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl) - .WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://logstash:8080" : logstashUrl) - .ReadFrom.Configuration(configuration) - .CreateLogger(); + .WriteTo.Console(); + if (!string.IsNullOrWhiteSpace(seqServerUrl)) { + cfg.WriteTo.Seq(seqServerUrl); + } + if (!string.IsNullOrWhiteSpace(logstashUrl)) { + cfg.WriteTo.Http(logstashUrl); + } + return cfg.CreateLogger(); } private static IConfiguration GetConfiguration() diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs index 418164b0b..8e72ef249 100644 --- a/src/Web/WebMVC/Services/BasketService.cs +++ b/src/Web/WebMVC/Services/BasketService.cs @@ -19,8 +19,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services private readonly string _basketByPassUrl; private readonly string _purchaseUrl; - private readonly string _bffUrl; - public BasketService(HttpClient httpClient, IOptions settings, ILogger logger) { _apiClient = httpClient; diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 187e4e04d..7f4abb55f 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -46,7 +46,6 @@ namespace Microsoft.eShopOnContainers.WebMVC .AddCustomMvc(Configuration) .AddDevspaces() .AddHttpClientServices(Configuration); - //.AddHttpClientLogging(Configuration) //Opt-in HttpClientLogging config IdentityModelEventSource.ShowPII = true; // Caution! Do NOT use in production: https://aka.ms/IdentityModel/PII @@ -56,12 +55,9 @@ namespace Microsoft.eShopOnContainers.WebMVC } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IHostingEnvironment env) { JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub"); - - //loggerFactory.AddAzureWebAppDiagnostics(); - //loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); @@ -75,7 +71,6 @@ namespace Microsoft.eShopOnContainers.WebMVC if (!string.IsNullOrEmpty(pathBase)) { - loggerFactory.CreateLogger().LogDebug("Using PATH BASE '{PathBase}'", pathBase); app.UsePathBase(pathBase); } @@ -87,7 +82,7 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseMiddleware(); } - WebContextSeed.Seed(app, env, loggerFactory); + WebContextSeed.Seed(app, env); app.UseRouting(); @@ -201,21 +196,6 @@ namespace Microsoft.eShopOnContainers.WebMVC return services; } - public static IServiceCollection AddHttpClientLogging(this IServiceCollection services, IConfiguration configuration) - { - services.AddLogging(b => - { - b.AddFilter((category, level) => true); // Spam the world with logs. - - // Add console logger so we can see all the logging produced by the client by default. - b.AddConsole(c => c.IncludeScopes = true); - - // Add console logger - b.AddDebug(); - }); - - return services; - } public static IServiceCollection AddCustomAuthentication(this IServiceCollection services, IConfiguration configuration) { diff --git a/src/Web/WebMVC/appsettings.Development.json b/src/Web/WebMVC/appsettings.Development.json index 9e1db71f1..a96c927e8 100644 --- a/src/Web/WebMVC/appsettings.Development.json +++ b/src/Web/WebMVC/appsettings.Development.json @@ -1,10 +1,5 @@ { - "Logging": { - "LogLevel": { - "Default": "Debug" - } - }, - "Serilog": { + "Serilog": { "MinimumLevel": { "Default": "Debug" } diff --git a/src/Web/WebMVC/appsettings.json b/src/Web/WebMVC/appsettings.json index affc61f93..436baedb6 100644 --- a/src/Web/WebMVC/appsettings.json +++ b/src/Web/WebMVC/appsettings.json @@ -15,12 +15,7 @@ "SeqServerUrl": null, "LogstashgUrl": null, "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.eShopOnContainers": "Information", - "System": "Warning" - } + "Default": "Information" } }, "ApplicationInsights": { diff --git a/src/Web/WebStatus/appsettings.Development.json b/src/Web/WebStatus/appsettings.Development.json index 39aa0f472..0e65aa1ec 100644 --- a/src/Web/WebStatus/appsettings.Development.json +++ b/src/Web/WebStatus/appsettings.Development.json @@ -1,87 +1,7 @@ { - "HealthChecks-UI": { - "HealthChecks": [ - { - "Name": "Ordering HTTP Check", - "Uri": "http://localhost:5102/hc" - }, - { - "Name": "Ordering HTTP Background Check", - "Uri": "http://localhost:5111/hc" - }, - { - "Name": "Basket HTTP Check", - "Uri": "http://localhost:5103/hc" - }, - { - "Name": "Catalog HTTP Check", - "Uri": "http://localhost:5101/hc" - }, - { - "Name": "Identity HTTP Check", - "Uri": "http://localhost:5105/hc" - }, - { - "Name": "Marketing HTTP Check", - "Uri": "http://localhost:5110/hc" - }, - { - "Name": "Locations HTTP Check", - "Uri": "http://localhost:5109/hc" - }, - { - "Name": "Payments HTTP Check", - "Uri": "http://localhost:5108/hc" - }, - { - "Name": "WebMVC HTTP Check", - "Uri": "http://localhost:5100/hc" - }, - { - "Name": "WebSPA HTTP Check", - "Uri": "http://localhost:5104/hc" - }, - { - "Name": "SignalR HTTP Check", - "Uri": "http://localhost:5112/hc" - }, - { - "Name": "Mobile Shopping API GW HTTP Check", - "Uri": "http://localhost:5200/hc" - }, - { - "Name": "Mobile Marketing API GW HTTP Check", - "Uri": "http://localhost:5201/hc" - }, - { - "Name": "Web Shopping API GW HTTP Check", - "Uri": "http://localhost:5202/hc" - }, - { - "Name": "Web Marketing API GW HTTP Check", - "Uri": "http://localhost:5203/hc" - }, - { - "Name": "Mobile Shopping Aggregator HTTP Check", - "Uri": "http://localhost:5120/hc" - }, - { - "Name": "Web Shopping Aggregator HTTP Check", - "Uri": "http://localhost:5121/hc" - } - ], - "EvaluationTimeOnSeconds": 10, - "MinimumSecondsBetweenFailureNotifications": 60 - }, "Serilog": { - "SeqServerUrl": "http://localhost:5341/", "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.eShopOnContainers": "Information", - "System": "Warning" - } + "Default": "Debug" } } -} +} \ No newline at end of file