migrate marketing
This commit is contained in:
parent
577aca1d4c
commit
66bee87584
@ -6,6 +6,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Polly" Version="$(Polly)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(Microsoft_AspNetCore_Hosting_Abstractions)" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore)" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="$(Microsoft_EntityFrameworkCore_Design)" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(Microsoft_EntityFrameworkCore_Relational)" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(Microsoft_EntityFrameworkCore_SqlServer)" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="$(System_Data_SqlClient)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -3,7 +3,6 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Polly;
|
||||
using Polly.Retry;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
@ -18,7 +17,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||
return orchestratorType?.ToUpper() == "K8S";
|
||||
}
|
||||
|
||||
public static IWebHost MigrateDbContext<TContext>(this IWebHost webHost, Action<TContext,IServiceProvider> seeder) where TContext : DbContext
|
||||
public static IWebHost MigrateDbContext<TContext>(this IWebHost webHost, Action<TContext, IServiceProvider> seeder) where TContext : DbContext
|
||||
{
|
||||
var underK8s = webHost.IsInKubernetes();
|
||||
|
||||
@ -71,7 +70,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||
}
|
||||
|
||||
private static void InvokeSeeder<TContext>(Action<TContext, IServiceProvider> seeder, TContext context, IServiceProvider services)
|
||||
where TContext : DbContext
|
||||
where TContext : DbContext
|
||||
{
|
||||
context.Database.Migrate();
|
||||
seeder(context, services);
|
||||
|
@ -4,6 +4,7 @@
|
||||
<TargetFramework>$(NetCoreTargetVersion)</TargetFramework>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
||||
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,8 +1,8 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY scripts scripts/
|
||||
|
@ -8,6 +8,7 @@
|
||||
<PackageId>Catalog.API</PackageId>
|
||||
<UserSecretsId>aspnet-Catalog.API-20161122013618</UserSecretsId>
|
||||
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY scripts scripts/
|
||||
|
@ -9,6 +9,7 @@
|
||||
<AssemblyName />
|
||||
<ApplicationInsightsResourceId>/subscriptions/6c22bb55-0221-4ce4-9bf1-3c4a10a7294c/resourcegroups/eshop-log/providers/microsoft.insights/components/eshopappinsights</ApplicationInsightsResourceId>
|
||||
<ApplicationInsightsAnnotationResourceId>/subscriptions/6c22bb55-0221-4ce4-9bf1-3c4a10a7294c/resourcegroups/eshop-log/providers/microsoft.insights/components/eshopappinsights</ApplicationInsightsAnnotationResourceId>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -30,7 +31,6 @@
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="$(Microsoft_ApplicationInsights_AspNetCore)" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="$(Microsoft_ApplicationInsights_DependencyCollector)" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="$(Microsoft_ApplicationInsights_Kubernetes)" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.2.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="$(Microsoft_AspNetCore_Diagnostics_HealthChecks)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="$(Microsoft_AspNetCore_HealthChecks)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="$(Microsoft_Extensions_Configuration_AzureKeyVault)" />
|
||||
@ -46,6 +46,7 @@
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="$(Serilog_Sinks_Seq)" />
|
||||
<PackageReference Include="Serilog.Sinks.Http" Version="$(Serilog_Sinks_Http)" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(Swashbuckle_AspNetCore)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="$(Microsoft_AspNetCore_Authentication_JwtBearer)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||
|
@ -21,8 +21,6 @@
|
||||
using Infrastructure.Services;
|
||||
using IntegrationEvents.Events;
|
||||
using Marketing.API.IntegrationEvents.Handlers;
|
||||
using Microsoft.ApplicationInsights.Extensibility;
|
||||
using Microsoft.ApplicationInsights.ServiceFabric;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -30,7 +28,6 @@
|
||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using RabbitMQ.Client;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
@ -63,7 +60,7 @@
|
||||
|
||||
services.Configure<MarketingSettings>(Configuration);
|
||||
|
||||
ConfigureAuthService(services);
|
||||
ConfigureAuthService(services);
|
||||
|
||||
services.AddDbContext<MarketingContext>(options =>
|
||||
{
|
||||
@ -123,29 +120,32 @@
|
||||
|
||||
return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Add framework services.
|
||||
services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.DescribeAllEnumsAsStrings();
|
||||
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
|
||||
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo
|
||||
{
|
||||
Title = "Marketing HTTP API",
|
||||
Version = "v1",
|
||||
Description = "The Marketing Service HTTP API",
|
||||
TermsOfService = "Terms Of Service"
|
||||
Description = "The Marketing Service HTTP API"
|
||||
});
|
||||
|
||||
options.AddSecurityDefinition("oauth2", new OAuth2Scheme
|
||||
options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme
|
||||
{
|
||||
Type = "oauth2",
|
||||
Flow = "implicit",
|
||||
AuthorizationUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize",
|
||||
TokenUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token",
|
||||
Scopes = new Dictionary<string, string>()
|
||||
Flows = new OpenApi.Models.OpenApiOAuthFlows()
|
||||
{
|
||||
{ "marketing", "Marketing API" }
|
||||
Implicit = new OpenApi.Models.OpenApiOAuthFlow()
|
||||
{
|
||||
AuthorizationUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
|
||||
TokenUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),
|
||||
Scopes = new Dictionary<string, string>()
|
||||
{
|
||||
{ "marketing", "Marketing API" }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -178,7 +178,7 @@
|
||||
}
|
||||
|
||||
// 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, ILoggerFactory loggerFactory)
|
||||
{
|
||||
//loggerFactory.AddAzureWebAppDiagnostics();
|
||||
//loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
|
||||
@ -213,7 +213,7 @@
|
||||
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Marketing.API V1");
|
||||
c.OAuthClientId("marketingswaggerui");
|
||||
c.OAuthAppName("Marketing Swagger UI");
|
||||
});
|
||||
});
|
||||
|
||||
ConfigureEventBus(app);
|
||||
}
|
||||
@ -228,12 +228,6 @@
|
||||
// Enable K8s telemetry initializer
|
||||
services.AddApplicationInsightsKubernetesEnricher();
|
||||
}
|
||||
if (orchestratorType?.ToUpper() == "SF")
|
||||
{
|
||||
// Enable SF telemetry initializer
|
||||
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
|
||||
new FabricTelemetryInitializer());
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureAuthService(IServiceCollection services)
|
||||
@ -241,7 +235,7 @@
|
||||
// prevent from mapping "sub" claim to nameidentifier.
|
||||
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
|
||||
|
||||
services.AddAuthentication(options=>
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
@ -265,7 +259,7 @@
|
||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
|
||||
|
@ -43,10 +43,15 @@
|
||||
<Microsoft_AspNetCore_TestHost>3.0.0-preview6.19307.2</Microsoft_AspNetCore_TestHost>
|
||||
<Microsoft_Azure_ServiceBus>3.0.0</Microsoft_Azure_ServiceBus>
|
||||
<Microsoft_CSharp>4.5.0</Microsoft_CSharp>
|
||||
<Microsoft_EntityFrameworkCore>2.2.2</Microsoft_EntityFrameworkCore>
|
||||
<Microsoft_EntityFrameworkCore_Design>2.2.2</Microsoft_EntityFrameworkCore_Design>
|
||||
<Microsoft_EntityFrameworkCore_Relational>2.2.2</Microsoft_EntityFrameworkCore_Relational>
|
||||
<Microsoft_EntityFrameworkCore_SqlServer>2.2.2</Microsoft_EntityFrameworkCore_SqlServer>
|
||||
|
||||
<Microsoft_AspNetCore_Hosting_Abstractions>3.0.0-preview4-19123-01</Microsoft_AspNetCore_Hosting_Abstractions>
|
||||
<System_Data_SqlClient>4.7.0-preview6.19303.8</System_Data_SqlClient>
|
||||
|
||||
<Microsoft_EntityFrameworkCore>3.0.0-preview6.19304.10</Microsoft_EntityFrameworkCore>
|
||||
<Microsoft_EntityFrameworkCore_Design>3.0.0-preview6.19304.10</Microsoft_EntityFrameworkCore_Design>
|
||||
<Microsoft_EntityFrameworkCore_Relational>3.0.0-preview6.19304.10</Microsoft_EntityFrameworkCore_Relational>
|
||||
<Microsoft_EntityFrameworkCore_SqlServer>3.0.0-preview6.19304.10</Microsoft_EntityFrameworkCore_SqlServer>
|
||||
|
||||
<Microsoft_Extensions_Configuration_AzureKeyVault>2.2.0</Microsoft_Extensions_Configuration_AzureKeyVault>
|
||||
<Microsoft_Extensions_DependencyInjection_Abstractions>2.2.0</Microsoft_Extensions_DependencyInjection_Abstractions>
|
||||
<Microsoft_Extensions_Diagnostics_HealthChecks>2.2.0</Microsoft_Extensions_Diagnostics_HealthChecks>
|
||||
|
Loading…
x
Reference in New Issue
Block a user