diff --git a/Play.Catalog/src/Play.Catalog.Service/Play.Catalog.Service.csproj b/Play.Catalog/src/Play.Catalog.Service/Play.Catalog.Service.csproj index 484f3df4a9576f4c38ebc932a9f6116bbe1142e3..0e5659adb789ad2c6544afee0ce0c71f68f98573 100644 --- a/Play.Catalog/src/Play.Catalog.Service/Play.Catalog.Service.csproj +++ b/Play.Catalog/src/Play.Catalog.Service/Play.Catalog.Service.csproj @@ -5,7 +5,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Play.Common" Version="1.0.13" /> + <PackageReference Include="Play.Common" Version="1.0.16" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> </ItemGroup> diff --git a/Play.Common/README.md b/Play.Common/README.md index 5da64cc76a1d31474145cbb2ac2a914a50f3359b..536bd683efa4bc87009cc9dc7c4c3c3707ba83e1 100644 --- a/Play.Common/README.md +++ b/Play.Common/README.md @@ -1,9 +1,15 @@ -dotnet pack src\Play.Common\ --configuration Release -p:PackageVersion=1.0.13 -o ..\packages +From Root directory -Wechseln ins Verzeichniss play.Common +dotnet pack .\Play.Common\src\Play.Common\ --configuration Release -p:PackageVersion=1.0.14 -o .\packages -dotnet nuget push Play.Common.1.0.13.nupkg --source https://git.gibb.ch/api/v4/projects/5940/packages/nuget/index.json --api-key glpat-xr4z39bn9pBiWQcygXJn +Wechseln ins Verzeichniss packages + +dotnet nuget push .\packages\Play.Common.1.0.15.nupkg --source https://git.gibb.ch/api/v4/projects/5940/packages/nuget/index.json --api-key glpat-8GxsWezmB9YrpVnGygyg + + +dotnet nuget push .\packages\Play.Catalog.Contracts.1.0.1.nupkg --source https://git.gibb.ch/api/v4/projects/5940/packages/nuget/index.json --api-key glpat-8GxsWezmB9YrpVnGygyg + diff --git a/Play.Common/src/Play.Common/Configuration/Extensions.cs b/Play.Common/src/Play.Common/Configuration/Extensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..94994f9d95871b2ee473cf1289488bc3689ee406 --- /dev/null +++ b/Play.Common/src/Play.Common/Configuration/Extensions.cs @@ -0,0 +1,29 @@ +using System; +using Azure.Identity; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Play.Common.Settings; + +namespace Play.Common.Configuration +{ + public static class Extensions + { + public static IHostBuilder ConfigureAzureKeyVault(this IHostBuilder builder) + { + return builder.ConfigureAppConfiguration((context, configurationBuilder) => + { + if (context.HostingEnvironment.IsProduction()) + { + var configuration = configurationBuilder.Build(); + var serviceSettings = configuration.GetSection(nameof(ServiceSettings)) + .Get<ServiceSettings>(); + + configurationBuilder.AddAzureKeyVault( + new Uri($"https://{serviceSettings.KeyVaultName}.vault.azure.net/"), + new DefaultAzureCredential() + ); + } + }); + } + } +} \ No newline at end of file diff --git a/Play.Common/src/Play.Common/HealthChecks/Extensions.cs b/Play.Common/src/Play.Common/HealthChecks/Extensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..70be04cd9db827274dabc27f69d916614fdfcaf4 --- /dev/null +++ b/Play.Common/src/Play.Common/HealthChecks/Extensions.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Diagnostics.HealthChecks; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using MongoDB.Driver; +using Play.Common.Settings; + +namespace Play.Common.HealthChecks +{ + public static class Extensions + { + private const string MongoCheckName = "mongodb"; + private const string ReadyTagName = "ready"; + private const string LiveTagName = "live"; + private const string HealthEndpoint = "health"; + private const int DefaultSeconds = 3; + + public static IHealthChecksBuilder AddMongoDb( + this IHealthChecksBuilder builder, + TimeSpan? timeout = default) + { + return builder.Add(new HealthCheckRegistration( + MongoCheckName, + serviceProvider => + { + var configuration = serviceProvider.GetService<IConfiguration>(); + var mongoDbSettings = configuration.GetSection(nameof(MongoDbSettings)) + .Get<MongoDbSettings>(); + var mongoClient = new MongoClient(mongoDbSettings.ConnectionString); + return new MongoDbHealthCheck(mongoClient); + }, + HealthStatus.Unhealthy, + new[] { ReadyTagName }, + TimeSpan.FromSeconds(DefaultSeconds) + )); + } + + public static void MapPlayEconomyHealthChecks(this IEndpointRouteBuilder endpoints) + { + endpoints.MapHealthChecks($"/{HealthEndpoint}/{ReadyTagName}", new HealthCheckOptions() + { + Predicate = (check) => check.Tags.Contains(ReadyTagName) + }); + endpoints.MapHealthChecks($"/{HealthEndpoint}/{LiveTagName}", new HealthCheckOptions() + { + Predicate = (check) => false + }); + } + } +} \ No newline at end of file diff --git a/Play.Common/src/Play.Common/HealthChecks/MongoDbHealthCheck.cs b/Play.Common/src/Play.Common/HealthChecks/MongoDbHealthCheck.cs new file mode 100644 index 0000000000000000000000000000000000000000..481f5af779048e5989835775dc88b2abd6191635 --- /dev/null +++ b/Play.Common/src/Play.Common/HealthChecks/MongoDbHealthCheck.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using MongoDB.Driver; + +namespace Play.Common.HealthChecks +{ + public class MongoDbHealthCheck : IHealthCheck + { + private readonly MongoClient client; + + public MongoDbHealthCheck(MongoClient client) + { + this.client = client; + } + + public async Task<HealthCheckResult> CheckHealthAsync( + HealthCheckContext context, + CancellationToken cancellationToken = default) + { + try + { + await client.ListDatabaseNamesAsync(cancellationToken); + return HealthCheckResult.Healthy(); + } + catch (Exception ex) + { + return HealthCheckResult.Unhealthy(exception: ex); + } + } + } +} \ No newline at end of file diff --git a/Play.Common/src/Play.Common/Identity/Extensions.cs b/Play.Common/src/Play.Common/Identity/Extensions.cs index 86e9936d1c25810f0f8298c60289fa5994649b34..e43c56ce03e890ee761f2b7ff2d0dde60555d2b0 100644 --- a/Play.Common/src/Play.Common/Identity/Extensions.cs +++ b/Play.Common/src/Play.Common/Identity/Extensions.cs @@ -10,7 +10,11 @@ namespace Play.Common.Identity { return services.ConfigureOptions<ConfigureJwtBearerOptions>() .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(); + .AddJwtBearer(options => + { + + options.RequireHttpsMetadata = false; + }); } } -} \ No newline at end of file +} diff --git a/Play.Common/src/Play.Common/MassTransit/Extensions.cs b/Play.Common/src/Play.Common/MassTransit/Extensions.cs index 33629b96b3be3e5e3d0e46fad12fc38844bd000c..53b3b943c60dec3d3b354e751b975216007c725c 100644 --- a/Play.Common/src/Play.Common/MassTransit/Extensions.cs +++ b/Play.Common/src/Play.Common/MassTransit/Extensions.cs @@ -13,6 +13,30 @@ namespace Play.Common.MassTransit { public static class Extensions { + private const string RabbitMq = "RABBITMQ"; + private const string ServiceBus = "SERVICEBUS"; + + public static IServiceCollection AddMassTransitWithMessageBroker( + this IServiceCollection services, + IConfiguration config, + Action<IRetryConfigurator> configureRetries = null) + { + var serviceSettings = config.GetSection(nameof(ServiceSettings)).Get<ServiceSettings>(); + + switch (serviceSettings.MessageBroker?.ToUpper()) + { + case ServiceBus: + services.AddMassTransitWithServiceBus(configureRetries); + break; + case RabbitMq: + default: + services.AddMassTransitWithRabbitMq(configureRetries); + break; + } + + return services; + } + public static IServiceCollection AddMassTransitWithRabbitMq( this IServiceCollection services, Action<IRetryConfigurator> configureRetries = null) @@ -28,6 +52,40 @@ namespace Play.Common.MassTransit return services; } + public static IServiceCollection AddMassTransitWithServiceBus( + this IServiceCollection services, + Action<IRetryConfigurator> configureRetries = null) + { + services.AddMassTransit(configure => + { + configure.AddConsumers(Assembly.GetEntryAssembly()); + configure.UsingPlayEconomyAzureServiceBus(configureRetries); + }); + + services.AddMassTransitHostedService(); + + return services; + } + + public static void UsingPlayEconomyMessageBroker( + this IServiceCollectionBusConfigurator configure, + IConfiguration config, + Action<IRetryConfigurator> configureRetries = null) + { + var serviceSettings = config.GetSection(nameof(ServiceSettings)).Get<ServiceSettings>(); + + switch (serviceSettings.MessageBroker?.ToUpper()) + { + case ServiceBus: + configure.UsingPlayEconomyAzureServiceBus(configureRetries); + break; + case RabbitMq: + default: + configure.UsingPlayEconomyRabbitMq(configureRetries); + break; + } + } + public static void UsingPlayEconomyRabbitMq( this IServiceCollectionBusConfigurator configure, Action<IRetryConfigurator> configureRetries = null) @@ -48,5 +106,26 @@ namespace Play.Common.MassTransit configurator.UseMessageRetry(configureRetries); }); } + + public static void UsingPlayEconomyAzureServiceBus( + this IServiceCollectionBusConfigurator configure, + Action<IRetryConfigurator> configureRetries = null) + { + configure.UsingAzureServiceBus((context, configurator) => + { + var configuration = context.GetService<IConfiguration>(); + var serviceSettings = configuration.GetSection(nameof(ServiceSettings)).Get<ServiceSettings>(); + var serviceBusSettings = configuration.GetSection(nameof(ServiceBusSettings)).Get<ServiceBusSettings>(); + configurator.Host(serviceBusSettings.ConnectionString); + configurator.ConfigureEndpoints(context, new KebabCaseEndpointNameFormatter(serviceSettings.ServiceName, false)); + + if (configureRetries == null) + { + configureRetries = (retryConfigurator) => retryConfigurator.Interval(3, TimeSpan.FromSeconds(5)); + } + + configurator.UseMessageRetry(configureRetries); + }); + } } } \ No newline at end of file diff --git a/Play.Common/src/Play.Common/Play.Common.csproj b/Play.Common/src/Play.Common/Play.Common.csproj index 2e9f83aba07a7dff6d7c1d6f64b2e6d2b69bdca2..707d300a11f1170feeaf76a314e4c2fe24f2a083 100644 --- a/Play.Common/src/Play.Common/Play.Common.csproj +++ b/Play.Common/src/Play.Common/Play.Common.csproj @@ -3,13 +3,16 @@ <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <PackageDescription>Common libraries used by Play Economy services.</PackageDescription> - <Authors>Thomas Staub</Authors> + <Authors>Julio Casal</Authors> <Company>.NET Microservices</Company> </PropertyGroup> <ItemGroup> + <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" /> + <PackageReference Include="Azure.Identity" Version="1.8.0" /> <PackageReference Include="MassTransit.AspNetCore" Version="7.3.1" /> <PackageReference Include="MassTransit.RabbitMQ" Version="7.3.1" /> + <PackageReference Include="MassTransit.Azure.ServiceBus.Core" Version="7.3.1" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" /> diff --git a/Play.Common/src/Play.Common/Settings/MongoDbSettings.cs b/Play.Common/src/Play.Common/Settings/MongoDbSettings.cs index 8a0be7dbcc0082d1c8639a38a1ab008fa04a2a42..0d1bcf341c8a3dcc3d3a86b8980fcbe2567037a3 100644 --- a/Play.Common/src/Play.Common/Settings/MongoDbSettings.cs +++ b/Play.Common/src/Play.Common/Settings/MongoDbSettings.cs @@ -2,10 +2,18 @@ namespace Play.Common.Settings { public class MongoDbSettings { + private string connectionString; + public string Host { get; init; } public int Port { get; init; } - public string ConnectionString => $"mongodb://{Host}:{Port}"; + public string ConnectionString + { + get { return string.IsNullOrWhiteSpace(connectionString) + ? $"mongodb://{Host}:{Port}" : connectionString; } + init { connectionString = value; } + } + } } \ No newline at end of file diff --git a/Play.Common/src/Play.Common/Settings/ServiceBusSettings.cs b/Play.Common/src/Play.Common/Settings/ServiceBusSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..065122a438eb22c3104d8f782c465e6e18860cd0 --- /dev/null +++ b/Play.Common/src/Play.Common/Settings/ServiceBusSettings.cs @@ -0,0 +1,7 @@ +namespace Play.Common.Settings +{ + public class ServiceBusSettings + { + public string ConnectionString { get; init; } + } +} \ No newline at end of file diff --git a/Play.Common/src/Play.Common/Settings/ServiceSettings.cs b/Play.Common/src/Play.Common/Settings/ServiceSettings.cs index 046b6611edc9d3e0aa00168178c70a53a5094af2..1f2f474a17e8a11b8401c32f6fe51f1d42ce866f 100644 --- a/Play.Common/src/Play.Common/Settings/ServiceSettings.cs +++ b/Play.Common/src/Play.Common/Settings/ServiceSettings.cs @@ -4,5 +4,7 @@ namespace Play.Common.Settings { public string ServiceName { get; init; } public string Authority { get; init; } + public string MessageBroker { get; init; } + public string KeyVaultName { get; init; } } } \ No newline at end of file diff --git a/Play.Common1/.gitignore b/Play.Common1/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d45db4db8eb8081e523f72d74122f277777999ae --- /dev/null +++ b/Play.Common1/.gitignore @@ -0,0 +1,2 @@ +[Bb]in/ +[Oo]bj/ \ No newline at end of file diff --git a/Play.Common1/.vscode/tasks.json b/Play.Common1/.vscode/tasks.json new file mode 100644 index 0000000000000000000000000000000000000000..35f4315bb0d2d41b6a3f49132a24954e618a29ad --- /dev/null +++ b/Play.Common1/.vscode/tasks.json @@ -0,0 +1,46 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/Play.Common/Play.Common.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/src/Play.Common/Play.Common.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/src/Play.Common/Play.Common.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Play.Common1/README.md b/Play.Common1/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a4c6b88a06180412ccbc36eea424bccc3212bf06 --- /dev/null +++ b/Play.Common1/README.md @@ -0,0 +1,16 @@ + +From Root directory + +dotnet pack .\Play.Common\src\Play.Common\ --configuration Release -p:PackageVersion=1.0.14 -o .\packages + + + + + +Wechseln ins Verzeichniss packages + +dotnet nuget push .\packages\Play.Common.1.0.15.nupkg --source https://git.gibb.ch/api/v4/projects/5940/packages/nuget/index.json --api-key glpat-8GxsWezmB9YrpVnGygyg + + + + diff --git a/Play.Common/src/Play.Common/.vs/Play.Common/DesignTimeBuild/.dtbcache.v2 b/Play.Common1/src/Play.Common/.vs/Play.Common/DesignTimeBuild/.dtbcache.v2 similarity index 100% rename from Play.Common/src/Play.Common/.vs/Play.Common/DesignTimeBuild/.dtbcache.v2 rename to Play.Common1/src/Play.Common/.vs/Play.Common/DesignTimeBuild/.dtbcache.v2 diff --git a/Play.Common/src/Play.Common/.vs/Play.Common/FileContentIndex/55a3eb04-01a5-4be6-9993-d1a5d9968f14.vsidx b/Play.Common1/src/Play.Common/.vs/Play.Common/FileContentIndex/55a3eb04-01a5-4be6-9993-d1a5d9968f14.vsidx similarity index 100% rename from Play.Common/src/Play.Common/.vs/Play.Common/FileContentIndex/55a3eb04-01a5-4be6-9993-d1a5d9968f14.vsidx rename to Play.Common1/src/Play.Common/.vs/Play.Common/FileContentIndex/55a3eb04-01a5-4be6-9993-d1a5d9968f14.vsidx diff --git a/Play.Common/src/Play.Common/.vs/Play.Common/FileContentIndex/read.lock b/Play.Common1/src/Play.Common/.vs/Play.Common/FileContentIndex/read.lock similarity index 100% rename from Play.Common/src/Play.Common/.vs/Play.Common/FileContentIndex/read.lock rename to Play.Common1/src/Play.Common/.vs/Play.Common/FileContentIndex/read.lock diff --git a/Play.Common/src/Play.Common/.vs/Play.Common/v17/.futdcache.v2 b/Play.Common1/src/Play.Common/.vs/Play.Common/v17/.futdcache.v2 similarity index 100% rename from Play.Common/src/Play.Common/.vs/Play.Common/v17/.futdcache.v2 rename to Play.Common1/src/Play.Common/.vs/Play.Common/v17/.futdcache.v2 diff --git a/Play.Common/src/Play.Common/.vs/Play.Common/v17/.suo b/Play.Common1/src/Play.Common/.vs/Play.Common/v17/.suo similarity index 100% rename from Play.Common/src/Play.Common/.vs/Play.Common/v17/.suo rename to Play.Common1/src/Play.Common/.vs/Play.Common/v17/.suo diff --git a/Play.Common1/src/Play.Common/HealthChecks/Extensions.cs b/Play.Common1/src/Play.Common/HealthChecks/Extensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..70be04cd9db827274dabc27f69d916614fdfcaf4 --- /dev/null +++ b/Play.Common1/src/Play.Common/HealthChecks/Extensions.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Diagnostics.HealthChecks; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using MongoDB.Driver; +using Play.Common.Settings; + +namespace Play.Common.HealthChecks +{ + public static class Extensions + { + private const string MongoCheckName = "mongodb"; + private const string ReadyTagName = "ready"; + private const string LiveTagName = "live"; + private const string HealthEndpoint = "health"; + private const int DefaultSeconds = 3; + + public static IHealthChecksBuilder AddMongoDb( + this IHealthChecksBuilder builder, + TimeSpan? timeout = default) + { + return builder.Add(new HealthCheckRegistration( + MongoCheckName, + serviceProvider => + { + var configuration = serviceProvider.GetService<IConfiguration>(); + var mongoDbSettings = configuration.GetSection(nameof(MongoDbSettings)) + .Get<MongoDbSettings>(); + var mongoClient = new MongoClient(mongoDbSettings.ConnectionString); + return new MongoDbHealthCheck(mongoClient); + }, + HealthStatus.Unhealthy, + new[] { ReadyTagName }, + TimeSpan.FromSeconds(DefaultSeconds) + )); + } + + public static void MapPlayEconomyHealthChecks(this IEndpointRouteBuilder endpoints) + { + endpoints.MapHealthChecks($"/{HealthEndpoint}/{ReadyTagName}", new HealthCheckOptions() + { + Predicate = (check) => check.Tags.Contains(ReadyTagName) + }); + endpoints.MapHealthChecks($"/{HealthEndpoint}/{LiveTagName}", new HealthCheckOptions() + { + Predicate = (check) => false + }); + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/HealthChecks/MongoDbHealthCheck.cs b/Play.Common1/src/Play.Common/HealthChecks/MongoDbHealthCheck.cs new file mode 100644 index 0000000000000000000000000000000000000000..481f5af779048e5989835775dc88b2abd6191635 --- /dev/null +++ b/Play.Common1/src/Play.Common/HealthChecks/MongoDbHealthCheck.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using MongoDB.Driver; + +namespace Play.Common.HealthChecks +{ + public class MongoDbHealthCheck : IHealthCheck + { + private readonly MongoClient client; + + public MongoDbHealthCheck(MongoClient client) + { + this.client = client; + } + + public async Task<HealthCheckResult> CheckHealthAsync( + HealthCheckContext context, + CancellationToken cancellationToken = default) + { + try + { + await client.ListDatabaseNamesAsync(cancellationToken); + return HealthCheckResult.Healthy(); + } + catch (Exception ex) + { + return HealthCheckResult.Unhealthy(exception: ex); + } + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/IEntity.cs b/Play.Common1/src/Play.Common/IEntity.cs new file mode 100644 index 0000000000000000000000000000000000000000..b2d061679aebc53fa6943be81bfb61f487a8b5fb --- /dev/null +++ b/Play.Common1/src/Play.Common/IEntity.cs @@ -0,0 +1,9 @@ +using System; + +namespace Play.Common +{ + public interface IEntity + { + Guid Id { get; set; } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/IRepository.cs b/Play.Common1/src/Play.Common/IRepository.cs new file mode 100644 index 0000000000000000000000000000000000000000..8b33b2b02b7806919a60d34046ac2d9e022d301e --- /dev/null +++ b/Play.Common1/src/Play.Common/IRepository.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; + +namespace Play.Common +{ + public interface IRepository<T> where T : IEntity + { + Task CreateAsync(T entity); + Task<IReadOnlyCollection<T>> GetAllAsync(); + Task<IReadOnlyCollection<T>> GetAllAsync(Expression<Func<T, bool>> filter); + Task<T> GetAsync(Guid id); + Task<T> GetAsync(Expression<Func<T, bool>> filter); + Task RemoveAsync(Guid id); + Task UpdateAsync(T entity); + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/Identity/ConfigureJwtBearerOptions.cs b/Play.Common1/src/Play.Common/Identity/ConfigureJwtBearerOptions.cs new file mode 100644 index 0000000000000000000000000000000000000000..faddf8a03d8591d3284ff3fcbee4270ebbf88721 --- /dev/null +++ b/Play.Common1/src/Play.Common/Identity/ConfigureJwtBearerOptions.cs @@ -0,0 +1,62 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Options; +using Microsoft.IdentityModel.Tokens; +using Play.Common.Settings; + +namespace Play.Common.Identity +{ + public class ConfigureJwtBearerOptions : IConfigureNamedOptions<JwtBearerOptions> + { + private const string AccessTokenParameter = "access_token"; + private const string MessageHubPath = "/messageHub"; + + private readonly IConfiguration configuration; + + public ConfigureJwtBearerOptions(IConfiguration configuration) + { + this.configuration = configuration; + } + + public void Configure(string name, JwtBearerOptions options) + { + if (name == JwtBearerDefaults.AuthenticationScheme) + { + var serviceSettings = configuration.GetSection(nameof(ServiceSettings)) + .Get<ServiceSettings>(); + + options.Authority = serviceSettings.Authority; + options.Audience = serviceSettings.ServiceName; + options.MapInboundClaims = false; + options.TokenValidationParameters = new TokenValidationParameters + { + NameClaimType = "name", + RoleClaimType = "role" + }; + + options.Events = new JwtBearerEvents + { + OnMessageReceived = context => + { + var accessToken = context.Request.Query[AccessTokenParameter]; + var path = context.HttpContext.Request.Path; + + if (!string.IsNullOrEmpty(accessToken) && + path.StartsWithSegments(MessageHubPath)) + { + context.Token = accessToken; + } + + return Task.CompletedTask; + } + }; + } + } + + public void Configure(JwtBearerOptions options) + { + Configure(Options.DefaultName, options); + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/Identity/Extensions.cs b/Play.Common1/src/Play.Common/Identity/Extensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..86e9936d1c25810f0f8298c60289fa5994649b34 --- /dev/null +++ b/Play.Common1/src/Play.Common/Identity/Extensions.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.Extensions.DependencyInjection; + +namespace Play.Common.Identity +{ + public static class Extensions + { + public static AuthenticationBuilder AddJwtBearerAuthentication(this IServiceCollection services) + { + return services.ConfigureOptions<ConfigureJwtBearerOptions>() + .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) + .AddJwtBearer(); + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/MassTransit/Extensions.cs b/Play.Common1/src/Play.Common/MassTransit/Extensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..33629b96b3be3e5e3d0e46fad12fc38844bd000c --- /dev/null +++ b/Play.Common1/src/Play.Common/MassTransit/Extensions.cs @@ -0,0 +1,52 @@ +using System; +using System.Reflection; +using GreenPipes; +using GreenPipes.Configurators; +using MassTransit; +using MassTransit.Definition; +using MassTransit.ExtensionsDependencyInjectionIntegration; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Play.Common.Settings; + +namespace Play.Common.MassTransit +{ + public static class Extensions + { + public static IServiceCollection AddMassTransitWithRabbitMq( + this IServiceCollection services, + Action<IRetryConfigurator> configureRetries = null) + { + services.AddMassTransit(configure => + { + configure.AddConsumers(Assembly.GetEntryAssembly()); + configure.UsingPlayEconomyRabbitMq(configureRetries); + }); + + services.AddMassTransitHostedService(); + + return services; + } + + public static void UsingPlayEconomyRabbitMq( + this IServiceCollectionBusConfigurator configure, + Action<IRetryConfigurator> configureRetries = null) + { + configure.UsingRabbitMq((context, configurator) => + { + var configuration = context.GetService<IConfiguration>(); + var serviceSettings = configuration.GetSection(nameof(ServiceSettings)).Get<ServiceSettings>(); + var rabbitMQSettings = configuration.GetSection(nameof(RabbitMQSettings)).Get<RabbitMQSettings>(); + configurator.Host(rabbitMQSettings.Host); + configurator.ConfigureEndpoints(context, new KebabCaseEndpointNameFormatter(serviceSettings.ServiceName, false)); + + if (configureRetries == null) + { + configureRetries = (retryConfigurator) => retryConfigurator.Interval(3, TimeSpan.FromSeconds(5)); + } + + configurator.UseMessageRetry(configureRetries); + }); + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/MongoDB/Extensions.cs b/Play.Common1/src/Play.Common/MongoDB/Extensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..aa52bf50c2f4fd4f5b7a5182e3df15e8b3c506a5 --- /dev/null +++ b/Play.Common1/src/Play.Common/MongoDB/Extensions.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using MongoDB.Bson; +using MongoDB.Bson.Serialization; +using MongoDB.Bson.Serialization.Serializers; +using MongoDB.Driver; +using Play.Common.Settings; + +namespace Play.Common.MongoDB +{ + public static class Extensions + { + public static IServiceCollection AddMongo(this IServiceCollection services) + { + BsonSerializer.RegisterSerializer(new GuidSerializer(BsonType.String)); + BsonSerializer.RegisterSerializer(new DateTimeOffsetSerializer(BsonType.String)); + + services.AddSingleton(serviceProvider => + { + var configuration = serviceProvider.GetService<IConfiguration>(); + var serviceSettings = configuration.GetSection(nameof(ServiceSettings)).Get<ServiceSettings>(); + var mongoDbSettings = configuration.GetSection(nameof(MongoDbSettings)).Get<MongoDbSettings>(); + var mongoClient = new MongoClient(mongoDbSettings.ConnectionString); + return mongoClient.GetDatabase(serviceSettings.ServiceName); + }); + + return services; + } + + public static IServiceCollection AddMongoRepository<T>(this IServiceCollection services, string collectionName) + where T : IEntity + { + services.AddSingleton<IRepository<T>>(serviceProvider => + { + var database = serviceProvider.GetService<IMongoDatabase>(); + return new MongoRepository<T>(database, collectionName); + }); + + return services; + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/MongoDB/MongoRepository.cs b/Play.Common1/src/Play.Common/MongoDB/MongoRepository.cs new file mode 100644 index 0000000000000000000000000000000000000000..6e91c2cfde09fe96cb223a491eae81aa816ab530 --- /dev/null +++ b/Play.Common1/src/Play.Common/MongoDB/MongoRepository.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using MongoDB.Driver; + +namespace Play.Common.MongoDB +{ + + public class MongoRepository<T> : IRepository<T> where T : IEntity + { + private readonly IMongoCollection<T> dbCollection; + private readonly FilterDefinitionBuilder<T> filterBuilder = Builders<T>.Filter; + + public MongoRepository(IMongoDatabase database, string collectionName) + { + dbCollection = database.GetCollection<T>(collectionName); + } + + public async Task<IReadOnlyCollection<T>> GetAllAsync() + { + return await dbCollection.Find(filterBuilder.Empty).ToListAsync(); + } + + public async Task<IReadOnlyCollection<T>> GetAllAsync(Expression<Func<T, bool>> filter) + { + return await dbCollection.Find(filter).ToListAsync(); + } + + public async Task<T> GetAsync(Guid id) + { + FilterDefinition<T> filter = filterBuilder.Eq(entity => entity.Id, id); + return await dbCollection.Find(filter).FirstOrDefaultAsync(); + } + + public async Task<T> GetAsync(Expression<Func<T, bool>> filter) + { + return await dbCollection.Find(filter).FirstOrDefaultAsync(); + } + + public async Task CreateAsync(T entity) + { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + await dbCollection.InsertOneAsync(entity); + } + + public async Task UpdateAsync(T entity) + { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + FilterDefinition<T> filter = filterBuilder.Eq(existingEntity => existingEntity.Id, entity.Id); + await dbCollection.ReplaceOneAsync(filter, entity); + } + + public async Task RemoveAsync(Guid id) + { + FilterDefinition<T> filter = filterBuilder.Eq(entity => entity.Id, id); + await dbCollection.DeleteOneAsync(filter); + } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/Play.Common.csproj b/Play.Common1/src/Play.Common/Play.Common.csproj new file mode 100644 index 0000000000000000000000000000000000000000..2e9f83aba07a7dff6d7c1d6f64b2e6d2b69bdca2 --- /dev/null +++ b/Play.Common1/src/Play.Common/Play.Common.csproj @@ -0,0 +1,20 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net7.0</TargetFramework> + <PackageDescription>Common libraries used by Play Economy services.</PackageDescription> + <Authors>Thomas Staub</Authors> + <Company>.NET Microservices</Company> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="MassTransit.AspNetCore" Version="7.3.1" /> + <PackageReference Include="MassTransit.RabbitMQ" Version="7.3.1" /> + <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" /> + <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> + <PackageReference Include="MongoDB.Driver" Version="2.18.0" /> + </ItemGroup> + +</Project> diff --git a/Play.Common/src/Play.Common/Play.Common.sln b/Play.Common1/src/Play.Common/Play.Common.sln similarity index 100% rename from Play.Common/src/Play.Common/Play.Common.sln rename to Play.Common1/src/Play.Common/Play.Common.sln diff --git a/Play.Common1/src/Play.Common/Settings/MongoDbSettings.cs b/Play.Common1/src/Play.Common/Settings/MongoDbSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..8a0be7dbcc0082d1c8639a38a1ab008fa04a2a42 --- /dev/null +++ b/Play.Common1/src/Play.Common/Settings/MongoDbSettings.cs @@ -0,0 +1,11 @@ +namespace Play.Common.Settings +{ + public class MongoDbSettings + { + public string Host { get; init; } + + public int Port { get; init; } + + public string ConnectionString => $"mongodb://{Host}:{Port}"; + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/Settings/RabbitMQSettings.cs b/Play.Common1/src/Play.Common/Settings/RabbitMQSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..467fc242a455aa5f2811ccea3e13fe57fc3b06ce --- /dev/null +++ b/Play.Common1/src/Play.Common/Settings/RabbitMQSettings.cs @@ -0,0 +1,7 @@ +namespace Play.Common.Settings +{ + public class RabbitMQSettings + { + public string Host { get; init; } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/Settings/ServiceBusSettings.cs b/Play.Common1/src/Play.Common/Settings/ServiceBusSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..065122a438eb22c3104d8f782c465e6e18860cd0 --- /dev/null +++ b/Play.Common1/src/Play.Common/Settings/ServiceBusSettings.cs @@ -0,0 +1,7 @@ +namespace Play.Common.Settings +{ + public class ServiceBusSettings + { + public string ConnectionString { get; init; } + } +} \ No newline at end of file diff --git a/Play.Common1/src/Play.Common/Settings/ServiceSettings.cs b/Play.Common1/src/Play.Common/Settings/ServiceSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..046b6611edc9d3e0aa00168178c70a53a5094af2 --- /dev/null +++ b/Play.Common1/src/Play.Common/Settings/ServiceSettings.cs @@ -0,0 +1,8 @@ +namespace Play.Common.Settings +{ + public class ServiceSettings + { + public string ServiceName { get; init; } + public string Authority { get; init; } + } +} \ No newline at end of file diff --git a/Play.Common/src/Play.Common/nuget.config b/Play.Common1/src/Play.Common/nuget.config similarity index 100% rename from Play.Common/src/Play.Common/nuget.config rename to Play.Common1/src/Play.Common/nuget.config diff --git a/Play.Identity/kubernetes/identity.yaml b/Play.Identity/kubernetes/identity.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f0e505b798d6ca383eaadd490a47bb01aa79bfbf --- /dev/null +++ b/Play.Identity/kubernetes/identity.yaml @@ -0,0 +1,84 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: identity-deployment +spec: + selector: + matchLabels: + app: identity + template: + metadata: + labels: + app: identity + azure.workload.identity/use: "true" + spec: + serviceAccountName: identity-serviceaccount + containers: + - name: identity + image: playeconomy.azurecr.io/play.identity:1.0.10 + env: + - name: ServiceSettings__MessageBroker + value: SERVICEBUS + - name: ServiceSettings__KeyVaultName + value: playeconomy + - name: IdentitySettings__PathBase + value: /identity-svc + - name: IdentitySettings__CertificateCerFilePath + value: "/certificates/certificate.crt" + - name: IdentitySettings__CertificateKeyFilePath + value: "/certificates/certificate.key" + - name: IdentityServerSettings__Clients__0__RedirectUris__0 + value: https://playeconomy.eastus.cloudapp.azure.com/authentication/login-callback + - name: IdentityServerSettings__Clients__0__PostLogoutRedirectUris__0 + value: https://playeconomy.eastus.cloudapp.azure.com/authentication/logout-callback + resources: + limits: + memory: "128Mi" + cpu: "150m" + ports: + - containerPort: 5002 + livenessProbe: + httpGet: + path: /health/live + port: 5002 + initialDelaySeconds: 10 + readinessProbe: + httpGet: + path: /health/ready + port: 5002 + initialDelaySeconds: 10 + volumeMounts: + - name: certificate-volume + mountPath: /certificates + volumes: + - name: certificate-volume + secret: + secretName: signing-cert + items: + - key: tls.key + path: certificate.key + - key: tls.crt + path: certificate.crt + +--- +apiVersion: v1 +kind: Service +metadata: + name: identity-service +spec: + type: ClusterIP + selector: + app: identity + ports: + - port: 80 + targetPort: 5002 + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: identity-serviceaccount + annotations: + azure.workload.identity/client-id: b68260b6-466a-4483-b432-6df6f7073df1 + labels: + azure.workload.identity/use: "true" \ No newline at end of file diff --git a/Play.Identity/kubernetes/singning-cer.yaml b/Play.Identity/kubernetes/singning-cer.yaml new file mode 100644 index 0000000000000000000000000000000000000000..99ac088d7532aeb84c70783b5864c2ad232123ed --- /dev/null +++ b/Play.Identity/kubernetes/singning-cer.yaml @@ -0,0 +1,11 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: signing-cert +spec: + secretName: signing-cert + issuerRef: + name: letsencrypt-prod + kind: ClusterIssuer + dnsNames: + - playeconomy.eastus.cloudapp.azure.com \ No newline at end of file diff --git a/Play.Identity/src/Play.Identity.Service/Play.Identity.Service.csproj b/Play.Identity/src/Play.Identity.Service/Play.Identity.Service.csproj index 187d9c41d052f43316f122c6816c2c74bd1dd778..bd8aaa3bc8e5398f7f9d96933f8dccd89cbb97e1 100644 --- a/Play.Identity/src/Play.Identity.Service/Play.Identity.Service.csproj +++ b/Play.Identity/src/Play.Identity.Service/Play.Identity.Service.csproj @@ -11,7 +11,7 @@ <PackageReference Include="Duende.IdentityServer.AspNetIdentity" Version="6.1.7" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.0" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.0" /> - <PackageReference Include="play.common" Version="1.0.7" /> + <PackageReference Include="play.common" Version="1.0.16" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> </ItemGroup> diff --git a/Play.Identity/src/Play.Identity.Service/Program.cs b/Play.Identity/src/Play.Identity.Service/Program.cs index 6360a0d3c9096e0d25f5e81310b959f159b3dda7..e1ebc238f2ee363096e2d6ddf07b3ffceb55cfd7 100644 --- a/Play.Identity/src/Play.Identity.Service/Program.cs +++ b/Play.Identity/src/Play.Identity.Service/Program.cs @@ -12,6 +12,7 @@ using Microsoft.Extensions.DependencyInjection; using MongoDB.Bson; using MongoDB.Bson.Serialization; using MongoDB.Bson.Serialization.Serializers; +using Play.Common.HealthChecks; using Play.Common.MassTransit; using Play.Common.Settings; using Play.Identity.Service.Entities; @@ -120,6 +121,9 @@ namespace Play.Identity.Service } }); }); + + services.AddHealthChecks() + .AddMongoDb(); } @@ -187,6 +191,7 @@ namespace Play.Identity.Service { endpoints.MapControllers(); endpoints.MapRazorPages(); + endpoints.MapPlayEconomyHealthChecks(); }); } } diff --git a/Play.Infra/cert-manager/acme-challenge.yaml b/Play.Infra/cert-manager/acme-challenge.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b624a3c221d4af9bc646c2dd344f8b21cd4d6deb --- /dev/null +++ b/Play.Infra/cert-manager/acme-challenge.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: acme-challenge-service +spec: + ports: + - port: 80 + targetPort: 8089 + selector: + acme.cert-manager.io/http01-solver: "true" + +--- +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + name: acme-challenge-mapping +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + prefix: /.well-known/acme-challenge/ + rewrite: "" + service: acme-challenge-service \ No newline at end of file diff --git a/Play.Infra/cert-manager/cluster-issuer.yaml b/Play.Infra/cert-manager/cluster-issuer.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fb3843e37fe059c63637a9f3b02696a0f292502b --- /dev/null +++ b/Play.Infra/cert-manager/cluster-issuer.yaml @@ -0,0 +1,14 @@ +apiVersion: cert-manager.io/v1 +kind: ClusterIssuer +metadata: + name: letsencrypt-prod +spec: + acme: + server: https://acme-v02.api.letsencrypt.org/directory + email: julioc@dotnetmicroservices.com + privateKeySecretRef: + name: letsencrypt-prod + solvers: + - http01: + ingress: + class: nginx \ No newline at end of file diff --git a/Play.Infra/emissary-ingress/host.yaml b/Play.Infra/emissary-ingress/host.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9c5e477f9042bbe1ead7d3710dd73580aa224e31 --- /dev/null +++ b/Play.Infra/emissary-ingress/host.yaml @@ -0,0 +1,10 @@ +apiVersion: getambassador.io/v3alpha1 +kind: Host +metadata: + name: playeconomy-host +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + acmeProvider: + email: julioc@dotnetmicroservices.com + tlsSecret: + name: playeconomy-tls \ No newline at end of file diff --git a/Play.Infra/emissary-ingress/listener.yaml b/Play.Infra/emissary-ingress/listener.yaml new file mode 100644 index 0000000000000000000000000000000000000000..30a2c6d9dfd6e079d30d3cc4529b681c8b338731 --- /dev/null +++ b/Play.Infra/emissary-ingress/listener.yaml @@ -0,0 +1,24 @@ +apiVersion: getambassador.io/v3alpha1 +kind: Listener +metadata: + name: http-listener +spec: + port: 8080 + protocol: HTTP + securityModel: XFP # X-Forwarded-Proto + hostBinding: + namespace: + from: SELF + +--- +apiVersion: getambassador.io/v3alpha1 +kind: Listener +metadata: + name: https-listener +spec: + port: 8443 + protocol: HTTPS + securityModel: XFP + hostBinding: + namespace: + from: SELF \ No newline at end of file diff --git a/Play.Infra/emissary-ingress/mappings.yaml b/Play.Infra/emissary-ingress/mappings.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3c9411c7fe0b95c34bc8317dec1214b67cc79a2d --- /dev/null +++ b/Play.Infra/emissary-ingress/mappings.yaml @@ -0,0 +1,50 @@ +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + name: identity-mapping +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + prefix: /identity-svc/ + service: identity-service.identity + +--- +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + name: catalog-mapping +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + prefix: /catalog-svc/ + service: catalog-service.catalog + +--- +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + name: inventory-mapping +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + prefix: /inventory-svc/ + service: inventory-service.inventory + +--- +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + name: trading-mapping +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + prefix: /trading-svc/ + service: trading-service.trading + allow_upgrade: + - websocket + +--- +apiVersion: getambassador.io/v3alpha1 +kind: Mapping +metadata: + name: frontend-mapping +spec: + hostname: playeconomy.eastus.cloudapp.azure.com + prefix: / + service: frontend-client.frontend diff --git a/Play.Infra/emissary-ingress/tls-certificate.yaml b/Play.Infra/emissary-ingress/tls-certificate.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d45492db6104a5fb478968d118b6168c5d506478 --- /dev/null +++ b/Play.Infra/emissary-ingress/tls-certificate.yaml @@ -0,0 +1,11 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: playeconomy-tls-cert +spec: + secretName: playeconomy-tls + issuerRef: + name: letsencrypt-prod + kind: ClusterIssuer + dnsNames: + - "playeconomy.eastus.cloudapp.azure.com" \ No newline at end of file diff --git a/Play.Inventory/src/Play.Inventory.Service/Play.Inventory.Service.csproj b/Play.Inventory/src/Play.Inventory.Service/Play.Inventory.Service.csproj index 45f4b3d95f655bed7de48ba52075e2a4a9f43c4e..028c72d0b80e2ac557fc3e63d9bd5227d168161f 100644 --- a/Play.Inventory/src/Play.Inventory.Service/Play.Inventory.Service.csproj +++ b/Play.Inventory/src/Play.Inventory.Service/Play.Inventory.Service.csproj @@ -7,7 +7,7 @@ <ItemGroup> <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.0" /> <PackageReference Include="Play.Catalog.Contracts" Version="1.0.1" /> - <PackageReference Include="Play.Common" Version="1.0.13" /> + <PackageReference Include="Play.Common" Version="1.0.16" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> </ItemGroup> diff --git a/Play.Trading/src/Play.Trading.Service/Play.Trading.Service.csproj b/Play.Trading/src/Play.Trading.Service/Play.Trading.Service.csproj index 82df04ac9f9553291170d6b8118c28010cbcb622..cd621ae29927656ba19a9091c8d7ee0249e8ffeb 100644 --- a/Play.Trading/src/Play.Trading.Service/Play.Trading.Service.csproj +++ b/Play.Trading/src/Play.Trading.Service/Play.Trading.Service.csproj @@ -7,7 +7,7 @@ <ItemGroup> <PackageReference Include="MassTransit.MongoDB" Version="7.3.1" /> <PackageReference Include="Play.Catalog.Contracts" Version="1.0.1" /> - <PackageReference Include="Play.Common" Version="1.0.13" /> + <PackageReference Include="Play.Common" Version="1.0.16" /> <PackageReference Include="Play.Identity.Contracts" Version="1.0.1" /> <PackageReference Include="Play.Inventory.Contracts" Version="1.0.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> diff --git a/README.md b/README.md index 557e5e5ef7ef4bf65bc302d98a5ea371c0908461..4c886699e1e6da471a5e49dcc2b4e39edd8b75cc 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,17 @@ Login: admin@play.com PW: Pass@word1 -https://learn.dotnetacademy.io/enrollments \ No newline at end of file +https://learn.dotnetacademy.io/enrollments + + +| Microservice | Port http |Port https| +|--|--|--| +|Catalog | 5000 |5001| +|Inventory |5004 |5005| +|Trading | 5006 |5007| +|Frontend | 3000 || +|Frontendv2| 5008 |5009| +|Identity| 5002 |5003| +|Mongo | 27017 || +|rabbistmq| 5672 / 15672 || + diff --git a/packages/Play.Common.1.0.15.nupkg b/packages/Play.Common.1.0.15.nupkg new file mode 100644 index 0000000000000000000000000000000000000000..105adc0b1e54bb8ad029fe538688920edaf56aec Binary files /dev/null and b/packages/Play.Common.1.0.15.nupkg differ diff --git a/packages/Play.Common.1.0.16.nupkg b/packages/Play.Common.1.0.16.nupkg new file mode 100644 index 0000000000000000000000000000000000000000..8ca039a7ccf46f90deab390734a3be99ab782cdc Binary files /dev/null and b/packages/Play.Common.1.0.16.nupkg differ