From 2d4f9d332360ae2b35f051b65d9631dc1128d1af Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Mon, 29 May 2017 15:42:09 +0200 Subject: [PATCH 1/3] Add ESHOP_AZURE_SERVICE_BUS variable from .env with default value --- docker-compose.override.yml | 8 ++++---- docker-compose.prod.yml | 8 ++++---- docker-compose.vs.debug.yml | 2 +- docker-compose.vs.release.yml | 2 +- docker-compose.yml | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 04d1c4d9c..3d63a5547 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' # The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine. # The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: @@ -14,7 +14,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=basket.data - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5103:80" @@ -24,7 +24,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5101:80" @@ -45,7 +45,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5102:80" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index c5d8839ea..30a8c764f 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' # The Production docker-compose file has to have the external/real IPs or DNS names for the services # The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: @@ -19,7 +19,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=basket.data - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5103:80" @@ -29,7 +29,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5101:80" @@ -50,7 +50,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5102:80" diff --git a/docker-compose.vs.debug.yml b/docker-compose.vs.debug.yml index 2e7145637..413940bef 100644 --- a/docker-compose.vs.debug.yml +++ b/docker-compose.vs.debug.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' services: basket.api: diff --git a/docker-compose.vs.release.yml b/docker-compose.vs.release.yml index d1ca5b2c6..6637b71b5 100644 --- a/docker-compose.vs.release.yml +++ b/docker-compose.vs.release.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' services: basket.api: diff --git a/docker-compose.yml b/docker-compose.yml index 09212da8e..6a0953706 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' services: basket.api: From 83ae0d48fcee2da667290d3d3d425571bffdf6b5 Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Tue, 30 May 2017 17:56:36 +0200 Subject: [PATCH 2/3] remove ServiceBusConnectionString variable from appsettings.json --- src/Services/Basket/Basket.API/BasketSettings.cs | 2 -- src/Services/Basket/Basket.API/appsettings.json | 1 - src/Services/Catalog/Catalog.API/CatalogSettings.cs | 2 -- src/Services/Catalog/Catalog.API/settings.json | 1 - src/Services/Ordering/Ordering.API/settings.json | 1 - 5 files changed, 7 deletions(-) diff --git a/src/Services/Basket/Basket.API/BasketSettings.cs b/src/Services/Basket/Basket.API/BasketSettings.cs index 721461a1c..9d143545a 100644 --- a/src/Services/Basket/Basket.API/BasketSettings.cs +++ b/src/Services/Basket/Basket.API/BasketSettings.cs @@ -5,7 +5,5 @@ public string ConnectionString { get; set; } public string EventBusConnection { get; set; } - - public string ServiceBusConnectionString { get; set; } } } diff --git a/src/Services/Basket/Basket.API/appsettings.json b/src/Services/Basket/Basket.API/appsettings.json index 718639474..6d49d9475 100644 --- a/src/Services/Basket/Basket.API/appsettings.json +++ b/src/Services/Basket/Basket.API/appsettings.json @@ -9,7 +9,6 @@ }, "IdentityUrl": "http://localhost:5105", "ConnectionString": "127.0.0.1", - "ServiceBusConnectionString": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=oA6WpfCfCbScZbQa/DBOLfwl6oi5ezPsCYL7QsTb4PY=;EntityPath=eshop_event_bus", "AzureServiceBusEnabled": "true", "SubscriptionClientName": "Basket" } \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/CatalogSettings.cs b/src/Services/Catalog/Catalog.API/CatalogSettings.cs index 62e92c6ce..af6e0ab13 100644 --- a/src/Services/Catalog/Catalog.API/CatalogSettings.cs +++ b/src/Services/Catalog/Catalog.API/CatalogSettings.cs @@ -5,7 +5,5 @@ public string ExternalCatalogBaseUrl {get;set;} public string EventBusConnection { get; set; } - - public string ServiceBusConnectionString { get; set; } } } diff --git a/src/Services/Catalog/Catalog.API/settings.json b/src/Services/Catalog/Catalog.API/settings.json index 3cfe64f5e..82bbc4c1d 100644 --- a/src/Services/Catalog/Catalog.API/settings.json +++ b/src/Services/Catalog/Catalog.API/settings.json @@ -9,7 +9,6 @@ "Microsoft": "Information" } }, - "ServiceBusConnectionString": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=oA6WpfCfCbScZbQa/DBOLfwl6oi5ezPsCYL7QsTb4PY=;EntityPath=eshop_event_bus", "AzureServiceBusEnabled": "true", "SubscriptionClientName": "Catalog" } diff --git a/src/Services/Ordering/Ordering.API/settings.json b/src/Services/Ordering/Ordering.API/settings.json index 1270a34f6..00970cbec 100644 --- a/src/Services/Ordering/Ordering.API/settings.json +++ b/src/Services/Ordering/Ordering.API/settings.json @@ -9,7 +9,6 @@ "Microsoft": "Information" } }, - "ServiceBusConnectionString": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=oA6WpfCfCbScZbQa/DBOLfwl6oi5ezPsCYL7QsTb4PY=;EntityPath=eshop_event_bus", "AzureServiceBusEnabled": "true", "SubscriptionClientName": "Ordering" } From 18167186c9b3f5ed3b616cb9e73f33a05be56dab Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Tue, 30 May 2017 17:59:57 +0200 Subject: [PATCH 3/3] Apply EventBusConnectionChanges --- src/Services/Basket/Basket.API/Startup.cs | 2 +- src/Services/Basket/Basket.API/appsettings.json | 2 +- src/Services/Catalog/Catalog.API/Startup.cs | 2 +- src/Services/Catalog/Catalog.API/settings.json | 2 +- src/Services/Ordering/Ordering.API/Startup.cs | 2 +- src/Services/Ordering/Ordering.API/settings.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 9c975d4ff..ea4c8cad4 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -79,7 +79,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API var settings = sp.GetRequiredService>().Value; var logger = sp.GetRequiredService>(); - var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.ServiceBusConnectionString); + var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection); return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); }); diff --git a/src/Services/Basket/Basket.API/appsettings.json b/src/Services/Basket/Basket.API/appsettings.json index 6d49d9475..f062f76d7 100644 --- a/src/Services/Basket/Basket.API/appsettings.json +++ b/src/Services/Basket/Basket.API/appsettings.json @@ -9,6 +9,6 @@ }, "IdentityUrl": "http://localhost:5105", "ConnectionString": "127.0.0.1", - "AzureServiceBusEnabled": "true", + "AzureServiceBusEnabled": false, "SubscriptionClientName": "Basket" } \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index 25255cbaa..edc63c29d 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -118,7 +118,7 @@ var settings = sp.GetRequiredService>().Value; var logger = sp.GetRequiredService>(); - var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.ServiceBusConnectionString); + var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection); return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); }); diff --git a/src/Services/Catalog/Catalog.API/settings.json b/src/Services/Catalog/Catalog.API/settings.json index 82bbc4c1d..29d7240f6 100644 --- a/src/Services/Catalog/Catalog.API/settings.json +++ b/src/Services/Catalog/Catalog.API/settings.json @@ -9,6 +9,6 @@ "Microsoft": "Information" } }, - "AzureServiceBusEnabled": "true", + "AzureServiceBusEnabled": false, "SubscriptionClientName": "Catalog" } diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 7728725c1..9116a3ad2 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -121,7 +121,7 @@ { var logger = sp.GetRequiredService>(); - var serviceBusConnectionString = Configuration["ServiceBusConnectionString"]; + var serviceBusConnectionString = Configuration["EventBusConnection"]; var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); diff --git a/src/Services/Ordering/Ordering.API/settings.json b/src/Services/Ordering/Ordering.API/settings.json index 00970cbec..9f1c58322 100644 --- a/src/Services/Ordering/Ordering.API/settings.json +++ b/src/Services/Ordering/Ordering.API/settings.json @@ -9,6 +9,6 @@ "Microsoft": "Information" } }, - "AzureServiceBusEnabled": "true", + "AzureServiceBusEnabled": false, "SubscriptionClientName": "Ordering" }