diff --git a/etc/docker/docker-compose.infrastructure.override.yml b/etc/docker/docker-compose.infrastructure.override.yml index e6eaa32c..c2ba1033 100644 --- a/etc/docker/docker-compose.infrastructure.override.yml +++ b/etc/docker/docker-compose.infrastructure.override.yml @@ -16,8 +16,3 @@ services: environment: SA_PASSWORD: "myPassw0rd" ACCEPT_EULA: "Y" - - consul: - ports: - - "8500:8500" - - "8600:8600" \ No newline at end of file diff --git a/etc/docker/docker-compose.infrastructure.yml b/etc/docker/docker-compose.infrastructure.yml index 1d04929a..eb2ec29d 100644 --- a/etc/docker/docker-compose.infrastructure.yml +++ b/etc/docker/docker-compose.infrastructure.yml @@ -20,12 +20,6 @@ services: - sqldata:/var/opt/mssql networks: - eshoponabp-network - - consul: - container_name: consul - image: consul - networks: - - eshoponabp-network volumes: sqldata: diff --git a/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs b/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs index 2f73ba66..d1d65f16 100644 --- a/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs +++ b/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs @@ -41,12 +41,12 @@ namespace EShopOnAbp.InternalGateway var configuration = context.ServiceProvider.GetRequiredService(); var routes = configuration.GetSection("Routes").Get>(); - foreach (var config in routes.GroupBy(t => t.ServiceName).Select(r => r.First()).Distinct()) + foreach (var config in routes.GroupBy(t => t.ServiceKey).Select(r => r.First()).Distinct()) { var url = $"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; - options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceName} API"); + options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); } diff --git a/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json b/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json index 8826d7d8..8c6acb10 100644 --- a/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json +++ b/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json @@ -12,7 +12,7 @@ "AllowedHosts": "*", "Routes": [ { - "ServiceName": "Identity Service", + "ServiceKey": "Identity Service", "DownstreamPathTemplate": "/api/identity/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -25,7 +25,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Identity Service", + "ServiceKey": "Identity Service", "DownstreamPathTemplate": "/api/account/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -38,7 +38,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Saas Service", + "ServiceKey": "Saas Service", "DownstreamPathTemplate": "/api/saas/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -51,7 +51,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/abp/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -64,7 +64,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/feature-management/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -77,7 +77,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/permission-management/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -90,7 +90,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/setting-management/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -103,7 +103,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Payment Service", + "ServiceKey": "Payment Service", "DownstreamPathTemplate": "/api/payment/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs index 4fe91f5f..cf71cce0 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs @@ -41,12 +41,12 @@ namespace EShopOnAbp.WebPublicGateway { var configuration = context.ServiceProvider.GetRequiredService(); var routes = configuration.GetSection("Routes").Get>(); - foreach (var config in routes.GroupBy(t => t.ServiceName).Select(r => r.First()).Distinct()) + foreach (var config in routes.GroupBy(t => t.ServiceKey).Select(r => r.First()).Distinct()) { var url = $"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; - options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceName} API"); + options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); } diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json index 1e8dea1a..312cbe61 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json @@ -19,7 +19,7 @@ "AllowedHosts": "*", "Routes": [ { - "ServiceName": "Identity Service", + "ServiceKey": "Identity Service", "DownstreamPathTemplate": "/api/account/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -32,7 +32,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/abp/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -45,7 +45,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Catalog Service", + "ServiceKey": "Catalog Service", "DownstreamPathTemplate": "/api/catalog/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -58,7 +58,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Basket Service", + "ServiceKey": "Basket Service", "DownstreamPathTemplate": "/api/basket/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -71,7 +71,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Ordering Service", + "ServiceKey": "Ordering Service", "DownstreamPathTemplate": "/api/ordering/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ diff --git a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs index ac8bc417..119ed7b5 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs +++ b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs @@ -44,12 +44,12 @@ namespace EShopOnAbp.WebGateway var configuration = context.ServiceProvider.GetRequiredService(); var routes = configuration.GetSection("Routes").Get>(); - foreach (var config in routes.GroupBy(t => t.ServiceName).Select(r => r.First()).Distinct()) + foreach (var config in routes.GroupBy(t => t.ServiceKey).Select(r => r.First()).Distinct()) { var url = $"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; - options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceName} API"); + options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); } diff --git a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json index c8e3a58e..13fb37e6 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json +++ b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json @@ -19,7 +19,7 @@ "AllowedHosts": "*", "Routes": [ { - "ServiceName": "Identity Service", + "ServiceKey": "Identity Service", "DownstreamPathTemplate": "/api/identity/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -32,7 +32,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Identity Service", + "ServiceKey": "Identity Service", "DownstreamPathTemplate": "/api/account/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -45,7 +45,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Saas Service", + "ServiceKey": "Saas Service", "DownstreamPathTemplate": "/api/multi-tenancy/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -58,7 +58,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/abp/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -71,7 +71,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/feature-management/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -84,7 +84,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/permission-management/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ @@ -97,7 +97,7 @@ "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { - "ServiceName": "Administration Service", + "ServiceKey": "Administration Service", "DownstreamPathTemplate": "/api/setting-management/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs index 74f65e11..2e64a6ab 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs +++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs @@ -98,7 +98,6 @@ namespace EShopOnAbp.AdministrationService app.UseAbpSerilogEnrichers(); app.UseAuditing(); app.UseUnitOfWork(); - app.UseConsul(); app.UseConfiguredEndpoints(endpoints => { //endpoints.MapMetrics(); diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs index 6b760721..80122c46 100644 --- a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs +++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs @@ -91,7 +91,6 @@ namespace EShopOnAbp.IdentityService app.UseAbpSerilogEnrichers(); app.UseAuditing(); app.UseUnitOfWork(); - app.UseConsul(); app.UseConfiguredEndpoints(endpoints => { // endpoints.MapMetrics(); diff --git a/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/SaasServiceHttpApiHostModule.cs b/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/SaasServiceHttpApiHostModule.cs index 26e040ee..72a2cf94 100644 --- a/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/SaasServiceHttpApiHostModule.cs +++ b/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/SaasServiceHttpApiHostModule.cs @@ -98,7 +98,6 @@ namespace EShopOnAbp.SaasService app.UseAbpSerilogEnrichers(); app.UseAuditing(); app.UseUnitOfWork(); - app.UseConsul(); app.UseConfiguredEndpoints(endpoints => { // endpoints.MapMetrics(); diff --git a/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj b/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj index 204aa15d..2621e58c 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj +++ b/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbp.Shared.Hosting.Gateways.csproj @@ -7,7 +7,6 @@ - diff --git a/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbpSharedHostingGatewaysModule.cs b/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbpSharedHostingGatewaysModule.cs index c0227815..895cfabf 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbpSharedHostingGatewaysModule.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Gateways/EShopOnAbpSharedHostingGatewaysModule.cs @@ -1,11 +1,9 @@ using EShopOnAbp.Shared.Hosting.AspNetCore; using Microsoft.Extensions.DependencyInjection; using Ocelot.DependencyInjection; -using Ocelot.Provider.Consul; using Ocelot.Provider.Polly; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.Modularity; -using Volo.Abp.Swashbuckle; namespace EShopOnAbp.Shared.Hosting.Gateways { @@ -20,7 +18,6 @@ namespace EShopOnAbp.Shared.Hosting.Gateways var configuration = context.Services.GetConfiguration(); context.Services.AddOcelot(configuration) - .AddConsul() .AddPolly(); } } diff --git a/shared/EShopOnAbp.Shared.Hosting.Gateways/OcelotConfiguration.cs b/shared/EShopOnAbp.Shared.Hosting.Gateways/OcelotConfiguration.cs index 12b69886..288b697e 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Gateways/OcelotConfiguration.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Gateways/OcelotConfiguration.cs @@ -4,7 +4,7 @@ namespace EShopOnAbp.Shared.Hosting.Gateways { public class OcelotConfiguration { - public string ServiceName { get; set; } + public string ServiceKey { get; set; } public string DownstreamPathTemplate { get; set; } public string DownstreamScheme { get; set; } public string UpstreamPathTemplate { get; set; } diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/ConsulConfigurationExtensions.cs b/shared/EShopOnAbp.Shared.Hosting.Microservices/ConsulConfigurationExtensions.cs deleted file mode 100644 index 16c795c3..00000000 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/ConsulConfigurationExtensions.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Consul; -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace EShopOnAbp.Shared.Hosting.Microservices -{ - public static class ConsulConfigurationExtensions - { - public static IServiceCollection AddConsulConfig(this IServiceCollection services, IConfiguration configuration) - { - services.AddSingleton(p => new ConsulClient(consulConfig => - { - var address = configuration.GetValue("Consul:Host"); - consulConfig.Address = new Uri(address); - })); - return services; - } - - public static string UseConsul(this IApplicationBuilder app) - { - var appLifetime = app.ApplicationServices.GetService(); - using (var scope = app.ApplicationServices.CreateScope()) - { - var configuration = scope.ServiceProvider.GetService(); - - bool isEnabled = configuration.GetValue("Consul:Enabled"); - string serviceName = configuration.GetValue("Consul:Service"); - var appString = configuration.GetValue("App:SelfUrl"); - Uri appUrl = new Uri(appString, UriKind.Absolute); - - if (!isEnabled) - return String.Empty; - - Guid serviceId = Guid.NewGuid(); - string consulServiceID = $"{serviceName}:{serviceId}"; - - var client = scope.ServiceProvider.GetService(); - - var consulServiceRegistration = new AgentServiceRegistration - { - Name = serviceName, - ID = consulServiceID, - Address = appUrl.Host, - Port = appUrl.Port - }; - - client.Agent.ServiceRegister(consulServiceRegistration); - appLifetime.ApplicationStopping.Register(() => - { - client.Agent.ServiceDeregister(consulServiceRegistration.ID); - }); - - return consulServiceID; - } - } - } -} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj index af2b2407..8edbb281 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj @@ -12,7 +12,6 @@ - diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs index 62c6eb0b..f2554fb3 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs @@ -2,7 +2,6 @@ using EShopOnAbp.SaasService.EntityFrameworkCore; using EShopOnAbp.Shared.Hosting.AspNetCore; using Microsoft.AspNetCore.DataProtection; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using StackExchange.Redis; using Volo.Abp.AspNetCore.MultiTenancy; @@ -45,8 +44,6 @@ namespace EShopOnAbp.Shared.Hosting.Microservices context.Services .AddDataProtection() .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys"); - - context.Services.AddConsulConfig(configuration); } } } \ No newline at end of file