diff --git a/ServiceFabric/Linux/.dockerignore b/ServiceFabric/Linux/.dockerignore
new file mode 100644
index 000000000..df2e0fe50
--- /dev/null
+++ b/ServiceFabric/Linux/.dockerignore
@@ -0,0 +1,9 @@
+.dockerignore
+.env
+.git
+.gitignore
+.vs
+.vscode
+*/bin
+*/obj
+**/.toolstarget
\ No newline at end of file
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj
index d0ca885ee..f7182778f 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj
@@ -6,6 +6,8 @@
True
win7-x64
False
+ Linux
+ 860c6d00-8a17-45b6-be76-28c2395d468e
@@ -16,6 +18,7 @@
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json
index 85d6777e6..23b43ba43 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "marketing.api",
- "Port": 80
+ "Host": "marketingapi.eshoponservicefabric",
+ "Port": 5110
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "locations.api",
- "Port": 80
+ "Host": "locationsapi.eshoponservicefabric",
+ "Port": 5109
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
@@ -26,9 +26,9 @@
}
],
- "GlobalConfiguration": {
- "RequestIdKey": "OcRequestId",
- "AdministrationPath": "/administration"
- }
+ "GlobalConfiguration": {
+ "RequestIdKey": "OcRequestId",
+ "AdministrationPath": "/administration"
+ }
}
\ No newline at end of file
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json
index 0fd6d9024..3733f4a51 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json
@@ -1,115 +1,115 @@
{
- "ReRoutes": [
- {
- "DownstreamPathTemplate": "/api/{version}/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "catalog.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/api/{version}/c/{everything}",
- "UpstreamHttpMethod": [ "GET" ]
- },
- {
- "DownstreamPathTemplate": "/api/{version}/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "basket.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/api/{version}/b/{everything}",
- "UpstreamHttpMethod": [],
- "AuthenticationOptions": {
- "AuthenticationProviderKey": "IdentityApiKey",
- "AllowedScopes": []
+ "ReRoutes": [
+ {
+ "DownstreamPathTemplate": "/api/{version}/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
- },
- {
- "DownstreamPathTemplate": "/api/{version}/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "ordering.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/api/{version}/o/{everything}",
- "UpstreamHttpMethod": [],
- "AuthenticationOptions": {
- "AuthenticationProviderKey": "IdentityApiKey",
- "AllowedScopes": []
+ ],
+ "UpstreamPathTemplate": "/api/{version}/c/{everything}",
+ "UpstreamHttpMethod": [ "GET" ]
+ },
+ {
+ "DownstreamPathTemplate": "/api/{version}/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
- },
- {
- "DownstreamPathTemplate": "/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "mobileshoppingagg",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/{everything}",
- "UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
- "AuthenticationOptions": {
- "AuthenticationProviderKey": "IdentityApiKey",
- "AllowedScopes": []
- }
- },
- {
- "DownstreamPathTemplate": "/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "ordering.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/orders-api/{everything}",
- "UpstreamHttpMethod": []
- },
- {
- "DownstreamPathTemplate": "/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "basket.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/basket-api/{everything}",
- "UpstreamHttpMethod": []
- },
- {
- "DownstreamPathTemplate": "/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "catalog.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/catalog-api/{everything}",
- "UpstreamHttpMethod": []
- },
- {
- "DownstreamPathTemplate": "/{everything}",
- "DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "payment.api",
- "Port": 80
- }
- ],
- "UpstreamPathTemplate": "/payment-api/{everything}",
- "UpstreamHttpMethod": []
+ ],
+ "UpstreamPathTemplate": "/api/{version}/b/{everything}",
+ "UpstreamHttpMethod": [],
+ "AuthenticationOptions": {
+ "AuthenticationProviderKey": "IdentityApiKey",
+ "AllowedScopes": []
}
-
- ],
+ },
+ {
+ "DownstreamPathTemplate": "/api/{version}/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
+ }
+ ],
+ "UpstreamPathTemplate": "/api/{version}/o/{everything}",
+ "UpstreamHttpMethod": [],
+ "AuthenticationOptions": {
+ "AuthenticationProviderKey": "IdentityApiKey",
+ "AllowedScopes": []
+ }
+ },
+ {
+ "DownstreamPathTemplate": "/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "mobileshoppingagg.eshoponservicefabric",
+ "Port": 5120
+ }
+ ],
+ "UpstreamPathTemplate": "/{everything}",
+ "UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
+ "AuthenticationOptions": {
+ "AuthenticationProviderKey": "IdentityApiKey",
+ "AllowedScopes": []
+ }
+ },
+ {
+ "DownstreamPathTemplate": "/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
+ }
+ ],
+ "UpstreamPathTemplate": "/orders-api/{everything}",
+ "UpstreamHttpMethod": []
+ },
+ {
+ "DownstreamPathTemplate": "/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
+ }
+ ],
+ "UpstreamPathTemplate": "/basket-api/{everything}",
+ "UpstreamHttpMethod": []
+ },
+ {
+ "DownstreamPathTemplate": "/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
+ }
+ ],
+ "UpstreamPathTemplate": "/catalog-api/{everything}",
+ "UpstreamHttpMethod": []
+ },
+ {
+ "DownstreamPathTemplate": "/{everything}",
+ "DownstreamScheme": "http",
+ "DownstreamHostAndPorts": [
+ {
+ "Host": "paymentapi.eshoponservicefabric",
+ "Port": 5108
+ }
+ ],
+ "UpstreamPathTemplate": "/payment-api/{everything}",
+ "UpstreamHttpMethod": []
+ }
+
+ ],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json
index 8afe4a4d6..338ee7f0e 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "marketing.api",
- "Port": 80
+ "Host": "marketingapi.eshoponservicefabric",
+ "Port": 5110
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "locations.api",
- "Port": 80
+ "Host": "locationsapi.eshoponservicefabric",
+ "Port": 5109
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json
index b3e01d773..727a7da8b 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "catalog.api",
- "Port": 80
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "basket.api",
- "Port": 80
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
@@ -33,8 +33,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.api",
- "Port": 80
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
@@ -49,8 +49,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "webshoppingagg",
- "Port": 80
+ "Host": "webshoppingagg.eshoponservicefabric",
+ "Port": 5121
}
],
"UpstreamPathTemplate": "/{everything}",
@@ -65,8 +65,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.api",
- "Port": 80
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
@@ -77,7 +77,7 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.signalrhub",
+ "Host": "ordering.signalrhub.eshoponservicefabric",
"Port": 80
}
],
@@ -89,8 +89,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "basket.api",
- "Port": 80
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
@@ -101,8 +101,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "catalog.api",
- "Port": 80
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
@@ -113,8 +113,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "payment.api",
- "Port": 80
+ "Host": "paymentapi.eshoponservicefabric",
+ "Port": 5108
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Controllers/ConfigurationController.cs b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Controllers/ConfigurationController.cs
index f3d060ce1..d1efd1e04 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Controllers/ConfigurationController.cs
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Controllers/ConfigurationController.cs
@@ -11,20 +11,20 @@ namespace ApiGw_Base.Controllers
public class ConfigurationController : ControllerBase
{
[HttpGet("mobile/marketing")]
- public IActionResult MobileMarketing() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Marketing);
+ public IActionResult MobileMarketing() => ReadConfigurationFile(Channel.Mobile, ChannelType.Marketing);
[HttpGet("mobile/shopping")]
- public IActionResult MobileShopping() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Shopping);
+ public IActionResult MobileShopping() => ReadConfigurationFile(Channel.Mobile, ChannelType.Shopping);
[HttpGet("web/marketing")]
- public IActionResult WebMarketing() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Marketing);
+ public IActionResult WebMarketing() => ReadConfigurationFile(Channel.Web, ChannelType.Marketing);
[HttpGet("web/shopping")]
- public IActionResult WebShopping() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Shopping);
+ public IActionResult WebShopping() => ReadConfigurationFile(Channel.Web, ChannelType.Shopping);
- private IActionResult ReadConfigurationFile(ConfigurationType configurationType, ConfigurationBffType configurationBffType)
+ private IActionResult ReadConfigurationFile(Channel channel, ChannelType channelType)
{
- var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{configurationType}.Bff.{configurationBffType}.json";
+ var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{channel}.Bff.{channelType}.json";
using (var streamReader = new StreamReader(path, Encoding.UTF8))
{
@@ -32,7 +32,7 @@ namespace ApiGw_Base.Controllers
if (string.IsNullOrWhiteSpace(jsonString))
{
- return BadRequest($"Configuration file 'configuration.{configurationType}.Bff.{configurationBffType}.json' not found");
+ return BadRequest($"Configuration file 'configuration.{channel}.Bff.{channelType}.json' not found");
}
return Ok(jsonString);
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ConfigurationType.cs b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/Channel.cs
similarity index 67%
rename from ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ConfigurationType.cs
rename to ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/Channel.cs
index 54bb41913..9fe7a915e 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ConfigurationType.cs
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/Channel.cs
@@ -1,6 +1,6 @@
namespace ApiGw_Base.Enums
{
- public enum ConfigurationType
+ public enum Channel
{
Web,
Mobile
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ConfigurationBffType.cs b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ChannelType.cs
similarity index 67%
rename from ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ConfigurationBffType.cs
rename to ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ChannelType.cs
index 72de5df8a..6f968027c 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ConfigurationBffType.cs
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Enums/ChannelType.cs
@@ -1,6 +1,6 @@
namespace ApiGw_Base.Enums
{
- public enum ConfigurationBffType
+ public enum ChannelType
{
Marketing,
Shopping
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml
index ad84ffd8a..aaaba1127 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml
@@ -1,9 +1,10 @@
-
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml
index 3538961fa..86a02a3bc 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml
@@ -17,9 +17,18 @@
ApiGw_Base.exe
CodePackage
+
-
+
+
+
+
+
+
+
@@ -32,6 +41,7 @@
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json
index a4095d193..f0d583199 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json
@@ -1,13 +1,13 @@
-{
- "$schema": "http://json.schemastore.org/launchsettings.json",
+{
"iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51647",
"sslPort": 44363
}
},
+ "$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
@@ -21,10 +21,15 @@
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
- "applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "applicationUrl": "https://localhost:5001;http://localhost:5000"
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values"
}
}
}
\ No newline at end of file
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
index 37a0974bf..3673aa6c5 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
@@ -13,6 +13,11 @@
+
-
+
diff --git a/ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingSignalrhubPkg/Config/Settings.xml b/ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingSignalrhubPkg/Config/Settings.xml
new file mode 100644
index 000000000..ad84ffd8a
--- /dev/null
+++ b/ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingSignalrhubPkg/Config/Settings.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingSignalrhubPkg/ServiceManifest.xml b/ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingSignalrhubPkg/ServiceManifest.xml
new file mode 100644
index 000000000..7437a02b2
--- /dev/null
+++ b/ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingSignalrhubPkg/ServiceManifest.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ eshop/ordering.signalrhub:#{tag}#
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json
index 85d6777e6..52c122bf1 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Marketing.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "marketing.api",
- "Port": 80
+ "Host": "marketingapi.eshoponservicefabric",
+ "Port": 5110
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "locations.api",
- "Port": 80
+ "Host": "locationsapi.eshoponservicefabric",
+ "Port": 5109
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json
index 0fd6d9024..9acbf4756 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Mobile.Bff.Shopping.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "catalog.api",
- "Port": 80
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "basket.api",
- "Port": 80
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
@@ -33,8 +33,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.api",
- "Port": 80
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
@@ -49,8 +49,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "mobileshoppingagg",
- "Port": 80
+ "Host": "mobileshoppingagg.eshoponservicefabric",
+ "Port": 5120
}
],
"UpstreamPathTemplate": "/{everything}",
@@ -65,8 +65,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.api",
- "Port": 80
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
@@ -77,8 +77,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "basket.api",
- "Port": 80
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
@@ -89,8 +89,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "catalog.api",
- "Port": 80
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
@@ -101,8 +101,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "payment.api",
- "Port": 80
+ "Host": "paymentapi.eshoponservicefabric",
+ "Port": 5108
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json
index 8afe4a4d6..338ee7f0e 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Marketing.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "marketing.api",
- "Port": 80
+ "Host": "marketingapi.eshoponservicefabric",
+ "Port": 5110
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "locations.api",
- "Port": 80
+ "Host": "locationsapi.eshoponservicefabric",
+ "Port": 5109
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json
index b3e01d773..727a7da8b 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Configurations/configuration.Web.Bff.Shopping.json
@@ -5,8 +5,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "catalog.api",
- "Port": 80
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
@@ -17,8 +17,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "basket.api",
- "Port": 80
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
@@ -33,8 +33,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.api",
- "Port": 80
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
@@ -49,8 +49,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "webshoppingagg",
- "Port": 80
+ "Host": "webshoppingagg.eshoponservicefabric",
+ "Port": 5121
}
],
"UpstreamPathTemplate": "/{everything}",
@@ -65,8 +65,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.api",
- "Port": 80
+ "Host": "orderingapi.eshoponservicefabric",
+ "Port": 5102
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
@@ -77,7 +77,7 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "ordering.signalrhub",
+ "Host": "ordering.signalrhub.eshoponservicefabric",
"Port": 80
}
],
@@ -89,8 +89,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "basket.api",
- "Port": 80
+ "Host": "basketapi.eshoponservicefabric",
+ "Port": 5103
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
@@ -101,8 +101,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "catalog.api",
- "Port": 80
+ "Host": "catalogapi.eshoponservicefabric",
+ "Port": 5101
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
@@ -113,8 +113,8 @@
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
- "Host": "payment.api",
- "Port": 80
+ "Host": "paymentapi.eshoponservicefabric",
+ "Port": 5108
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Controllers/ConfigurationController.cs b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Controllers/ConfigurationController.cs
index f3d060ce1..d1efd1e04 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Controllers/ConfigurationController.cs
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Controllers/ConfigurationController.cs
@@ -11,20 +11,20 @@ namespace ApiGw_Base.Controllers
public class ConfigurationController : ControllerBase
{
[HttpGet("mobile/marketing")]
- public IActionResult MobileMarketing() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Marketing);
+ public IActionResult MobileMarketing() => ReadConfigurationFile(Channel.Mobile, ChannelType.Marketing);
[HttpGet("mobile/shopping")]
- public IActionResult MobileShopping() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Shopping);
+ public IActionResult MobileShopping() => ReadConfigurationFile(Channel.Mobile, ChannelType.Shopping);
[HttpGet("web/marketing")]
- public IActionResult WebMarketing() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Marketing);
+ public IActionResult WebMarketing() => ReadConfigurationFile(Channel.Web, ChannelType.Marketing);
[HttpGet("web/shopping")]
- public IActionResult WebShopping() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Shopping);
+ public IActionResult WebShopping() => ReadConfigurationFile(Channel.Web, ChannelType.Shopping);
- private IActionResult ReadConfigurationFile(ConfigurationType configurationType, ConfigurationBffType configurationBffType)
+ private IActionResult ReadConfigurationFile(Channel channel, ChannelType channelType)
{
- var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{configurationType}.Bff.{configurationBffType}.json";
+ var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{channel}.Bff.{channelType}.json";
using (var streamReader = new StreamReader(path, Encoding.UTF8))
{
@@ -32,7 +32,7 @@ namespace ApiGw_Base.Controllers
if (string.IsNullOrWhiteSpace(jsonString))
{
- return BadRequest($"Configuration file 'configuration.{configurationType}.Bff.{configurationBffType}.json' not found");
+ return BadRequest($"Configuration file 'configuration.{channel}.Bff.{channelType}.json' not found");
}
return Ok(jsonString);
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ConfigurationType.cs b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/Channel.cs
similarity index 67%
rename from ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ConfigurationType.cs
rename to ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/Channel.cs
index 54bb41913..9fe7a915e 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ConfigurationType.cs
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/Channel.cs
@@ -1,6 +1,6 @@
namespace ApiGw_Base.Enums
{
- public enum ConfigurationType
+ public enum Channel
{
Web,
Mobile
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ConfigurationBffType.cs b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ChannelType.cs
similarity index 67%
rename from ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ConfigurationBffType.cs
rename to ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ChannelType.cs
index 72de5df8a..6f968027c 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ConfigurationBffType.cs
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/Enums/ChannelType.cs
@@ -1,6 +1,6 @@
namespace ApiGw_Base.Enums
{
- public enum ConfigurationBffType
+ public enum ChannelType
{
Marketing,
Shopping
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/PackageRoot/ServiceManifest.xml b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/PackageRoot/ServiceManifest.xml
index e255fe7fd..04809e38c 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/PackageRoot/ServiceManifest.xml
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApiGw_Base/PackageRoot/ServiceManifest.xml
@@ -19,7 +19,13 @@
-
+
+
+
+
+
+
+
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
index 37a0974bf..b50069649 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml
@@ -12,6 +12,12 @@
+
+
+
+
+
+
@@ -20,7 +26,7 @@
ServiceFabric PowerShell module.
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
-
+
diff --git a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/PublishProfiles/Local.5Node.xml b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/PublishProfiles/Local.5Node.xml
index f42d759c3..d630c33f8 100644
--- a/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/PublishProfiles/Local.5Node.xml
+++ b/ServiceFabric/Windows/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/eShopOnServiceFabricApiGW/PublishProfiles/Local.5Node.xml
@@ -8,4 +8,7 @@
-->
+
+
+
\ No newline at end of file
diff --git a/docker-compose.override.yml b/docker-compose.override.yml
index a0a3b35b7..619d630bb 100644
--- a/docker-compose.override.yml
+++ b/docker-compose.override.yml
@@ -378,5 +378,4 @@ services:
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- - "5100:80"
-
+ - "5100:80"
\ No newline at end of file
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 4bf465565..f9a15adf2 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -303,5 +303,4 @@ services:
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes.
- # The API Gateway redirects and access through the internal port (80).
-
+ # The API Gateway redirects and access through the internal port (80).
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 95610ebd5..6e39af415 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -215,5 +215,4 @@ services:
depends_on:
- webshoppingagg
- webshoppingapigw
- - webmarketingapigw
-
+ - webmarketingapigw
\ No newline at end of file
diff --git a/src/ApiGateways/ApiGw-Base/Enums/OrchestratorType.cs b/src/ApiGateways/ApiGw-Base/Enums/OrchestratorType.cs
new file mode 100644
index 000000000..f037fd272
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Enums/OrchestratorType.cs
@@ -0,0 +1,8 @@
+namespace OcelotApiGw.Enums
+{
+ public enum OrchestratorType
+ {
+ K8S,
+ SF
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Models/ServiceFabricSettings.cs b/src/ApiGateways/ApiGw-Base/Models/ServiceFabricSettings.cs
new file mode 100644
index 000000000..898b88676
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Models/ServiceFabricSettings.cs
@@ -0,0 +1,13 @@
+namespace OcelotApiGw.Models
+{
+ public class ServiceFabricSettings
+ {
+ public string UrlMobilMarketing { get; set; }
+
+ public string UrlMobilShopping { get; set; }
+
+ public string UrlWebMarketing { get; set; }
+
+ public string UrlWebShopping { get; set; }
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Orchestrators/IOrchestratorStrategy.cs b/src/ApiGateways/ApiGw-Base/Orchestrators/IOrchestratorStrategy.cs
new file mode 100644
index 000000000..eb5b6e59e
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Orchestrators/IOrchestratorStrategy.cs
@@ -0,0 +1,12 @@
+using Microsoft.Extensions.Configuration;
+using OcelotApiGw.Enums;
+
+namespace OcelotApiGw.Orchestrators
+{
+ public interface IOrchestratorStrategy
+ {
+ OrchestratorType OrchestratorType { get; }
+
+ IConfigurationBuilder ConfigureOrchestrator(IConfigurationBuilder builder);
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Orchestrators/Kubernetes.cs b/src/ApiGateways/ApiGw-Base/Orchestrators/Kubernetes.cs
new file mode 100644
index 000000000..1e2a70d69
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Orchestrators/Kubernetes.cs
@@ -0,0 +1,12 @@
+using Microsoft.Extensions.Configuration;
+using OcelotApiGw.Enums;
+
+namespace OcelotApiGw.Orchestrators
+{
+ public class Kubernetes : IOrchestratorStrategy
+ {
+ public OrchestratorType OrchestratorType => OrchestratorType.K8S;
+
+ public IConfigurationBuilder ConfigureOrchestrator(IConfigurationBuilder builder) => builder;
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Orchestrators/ServiceFabric.cs b/src/ApiGateways/ApiGw-Base/Orchestrators/ServiceFabric.cs
new file mode 100644
index 000000000..4c8b3db3c
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Orchestrators/ServiceFabric.cs
@@ -0,0 +1,30 @@
+using Microsoft.Extensions.Configuration;
+using OcelotApiGw.Enums;
+using OcelotApiGw.Providers;
+using OcelotApiGw.Services;
+
+namespace OcelotApiGw.Orchestrators
+{
+ public class ServiceFabric : IOrchestratorStrategy
+ {
+ private readonly ISettingService _settingService;
+
+ public ServiceFabric(ISettingService settingService)
+ {
+ _settingService = settingService;
+ }
+
+ public OrchestratorType OrchestratorType => OrchestratorType.SF;
+
+ public IConfigurationBuilder ConfigureOrchestrator(IConfigurationBuilder builder)
+ {
+ var config = _settingService.GetConfiguration();
+
+ var memoryFileProvider = new InMemoryFileProvider(config);
+
+ builder.AddJsonFile(memoryFileProvider, string.Empty, false, false);
+
+ return builder;
+ }
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Program.cs b/src/ApiGateways/ApiGw-Base/Program.cs
index c8f8d7993..84dfa57d7 100644
--- a/src/ApiGateways/ApiGw-Base/Program.cs
+++ b/src/ApiGateways/ApiGw-Base/Program.cs
@@ -1,11 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
+using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
+using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
@@ -16,24 +12,22 @@ namespace OcelotApiGw
{
public static void Main(string[] args)
{
- BuildWebHost(args).Run();
- }
-
- public static IWebHost BuildWebHost(string[] args)
- {
- IWebHostBuilder builder = WebHost.CreateDefaultBuilder(args);
- builder.ConfigureServices(s => s.AddSingleton(builder))
- .ConfigureAppConfiguration(ic => ic.AddJsonFile(Path.Combine("configuration", "configuration.json")))
- .UseStartup()
+ WebHost.CreateDefaultBuilder(args)
+ .ConfigureAppConfiguration((hostingContext, config) =>
+ {
+ config.SetBasePath(Directory.GetCurrentDirectory());
+ config.AddJsonFile(Path.Combine("configuration", "configuration.json"));
+ config.AddCommandLine(args);
+ })
.UseSerilog((builderContext, config) =>
{
config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console();
- });
- IWebHost host = builder.Build();
- return host;
+ })
+ .Build()
+ .Run();
}
}
}
diff --git a/src/ApiGateways/ApiGw-Base/Providers/InMemoryFile.cs b/src/ApiGateways/ApiGw-Base/Providers/InMemoryFile.cs
new file mode 100644
index 000000000..46e8fe676
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Providers/InMemoryFile.cs
@@ -0,0 +1,28 @@
+using Microsoft.Extensions.FileProviders;
+using System;
+using System.IO;
+using System.Text;
+
+namespace OcelotApiGw.Providers
+{
+ public class InMemoryFile : IFileInfo
+ {
+ private readonly byte[] _data;
+
+ public InMemoryFile(string data) => _data = Encoding.UTF8.GetBytes(data);
+
+ public Stream CreateReadStream() => new MemoryStream(_data);
+
+ public bool Exists { get; } = true;
+
+ public long Length => _data.Length;
+
+ public string PhysicalPath { get; } = string.Empty;
+
+ public string Name { get; } = string.Empty;
+
+ public DateTimeOffset LastModified { get; } = DateTimeOffset.UtcNow;
+
+ public bool IsDirectory { get; } = false;
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Providers/InMemoryFileProvider.cs b/src/ApiGateways/ApiGw-Base/Providers/InMemoryFileProvider.cs
new file mode 100644
index 000000000..357e96ac6
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Providers/InMemoryFileProvider.cs
@@ -0,0 +1,18 @@
+using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Primitives;
+
+namespace OcelotApiGw.Providers
+{
+ public class InMemoryFileProvider : IFileProvider
+ {
+ private readonly IFileInfo _fileInfo;
+
+ public InMemoryFileProvider(string data) => _fileInfo = new InMemoryFile(data);
+
+ public IFileInfo GetFileInfo(string subpath) => _fileInfo;
+
+ public IDirectoryContents GetDirectoryContents(string subpath) => null;
+
+ public IChangeToken Watch(string filter) => NullChangeToken.Singleton;
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Services/ISettingService.cs b/src/ApiGateways/ApiGw-Base/Services/ISettingService.cs
new file mode 100644
index 000000000..04df974ff
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Services/ISettingService.cs
@@ -0,0 +1,7 @@
+namespace OcelotApiGw.Services
+{
+ public interface ISettingService
+ {
+ string GetConfiguration();
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Services/SettingService.cs b/src/ApiGateways/ApiGw-Base/Services/SettingService.cs
new file mode 100644
index 000000000..11ba2a561
--- /dev/null
+++ b/src/ApiGateways/ApiGw-Base/Services/SettingService.cs
@@ -0,0 +1,51 @@
+using Microsoft.Extensions.Options;
+using OcelotApiGw.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+namespace OcelotApiGw.Services
+{
+ public class SettingService : ISettingService
+ {
+ private readonly HttpClient _httpClient;
+ private readonly ServiceFabricSettings _serviceFabricSettings;
+
+ public SettingService(HttpClient httpClient, IOptions serviceFabricSettings)
+ {
+ _httpClient = httpClient;
+ _serviceFabricSettings = serviceFabricSettings.Value;
+ }
+
+ public string GetConfiguration()
+ {
+ var strings = new List();
+
+ var tasks = new Func[]
+ {
+ async () => {
+ var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlMobilMarketing);
+ strings.Add(configuration);
+ },
+ async () => {
+ var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlMobilShopping);
+ strings.Add(configuration);
+ },
+ async () => {
+ var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlWebMarketing);
+ strings.Add(configuration);
+ },
+ async () => {
+ var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlWebShopping);
+ strings.Add(configuration);
+ }
+ };
+
+ Task.WaitAll(tasks.Select(task => task()).ToArray());
+
+ return string.Join(',', strings);
+ }
+ }
+}
diff --git a/src/ApiGateways/ApiGw-Base/Startup.cs b/src/ApiGateways/ApiGw-Base/Startup.cs
index cd90bd7ca..61da4f463 100644
--- a/src/ApiGateways/ApiGw-Base/Startup.cs
+++ b/src/ApiGateways/ApiGw-Base/Startup.cs
@@ -1,84 +1,90 @@
-using Microsoft.AspNetCore.Builder;
+using HealthChecks.UI.Client;
+using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.HealthChecks;
+using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
+using OcelotApiGw.Enums;
+using OcelotApiGw.Models;
+using OcelotApiGw.Orchestrators;
+using OcelotApiGw.Providers;
+using OcelotApiGw.Services;
using System;
-using HealthChecks.UI.Client;
-using Microsoft.Extensions.Diagnostics.HealthChecks;
+using System.Linq;
namespace OcelotApiGw
{
public class Startup
{
- private readonly IConfiguration _cfg;
+ private IConfiguration _configuration;
public Startup(IConfiguration configuration)
{
- _cfg = configuration;
+ _configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
- var identityUrl = _cfg.GetValue("IdentityUrl");
+ var identityUrl = _configuration.GetValue("IdentityUrl");
var authenticationProviderKey = "IdentityApiKey";
services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy())
- .AddUrlGroup(new Uri(_cfg["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
- .AddUrlGroup(new Uri(_cfg["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
- .AddUrlGroup(new Uri(_cfg["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
- .AddUrlGroup(new Uri(_cfg["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
- .AddUrlGroup(new Uri(_cfg["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
- .AddUrlGroup(new Uri(_cfg["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
- .AddUrlGroup(new Uri(_cfg["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
+ .AddUrlGroup(new Uri(_configuration["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
+ .AddUrlGroup(new Uri(_configuration["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
+ .AddUrlGroup(new Uri(_configuration["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
+ .AddUrlGroup(new Uri(_configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
+ .AddUrlGroup(new Uri(_configuration["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
+ .AddUrlGroup(new Uri(_configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
+ .AddUrlGroup(new Uri(_configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
services.AddCors(options =>
{
- options.AddPolicy("CorsPolicy",
- builder => builder
- .AllowAnyMethod()
- .AllowAnyHeader()
- .SetIsOriginAllowed((host) => true)
- .AllowCredentials());
+ options.AddPolicy("CorsPolicy", builder =>
+ builder.AllowAnyOrigin()
+ .AllowAnyMethod()
+ .AllowAnyHeader()
+ .AllowCredentials());
+ })
+ .AddTransient()
+ .AddTransient()
+ .AddTransient()
+ .AddAuthentication()
+ .AddJwtBearer(authenticationProviderKey, options =>
+ {
+ options.Authority = identityUrl;
+ options.RequireHttpsMetadata = false;
+ options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
+ {
+ ValidAudiences = new[] { "orders", "basket", "locations", "marketing", "mobileshoppingagg", "webshoppingagg" }
+ };
});
- services.AddAuthentication()
- .AddJwtBearer(authenticationProviderKey, x =>
- {
- x.Authority = identityUrl;
- x.RequireHttpsMetadata = false;
- x.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
- {
- ValidAudiences = new[] { "orders", "basket", "locations", "marketing", "mobileshoppingagg", "webshoppingagg" }
- };
- x.Events = new Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents()
- {
- OnAuthenticationFailed = async ctx =>
- {
- int i = 0;
- },
- OnTokenValidated = async ctx =>
- {
- int i = 0;
- },
+ services.Configure(_configuration);
+ services.AddHttpClient();
- OnMessageReceived = async ctx =>
- {
- int i = 0;
- }
- };
- });
+ var orchestratorType = _configuration.GetValue("OrchestratorType");
- services.AddOcelot(_cfg);
+ var config = new ConfigurationBuilder()
+ .AddConfiguration(_configuration);
+
+ _configuration = services.BuildServiceProvider()
+ .GetServices()
+ .Single(strategy => strategy.OrchestratorType == orchestratorType)
+ .ConfigureOrchestrator(config)
+ .Build();
+
+ services.AddOcelot(_configuration);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
- var pathBase = _cfg["PATH_BASE"];
+ var pathBase = _configuration.GetValue("PATH_BASE");
if (!string.IsNullOrEmpty(pathBase))
{
@@ -101,11 +107,13 @@ namespace OcelotApiGw
Predicate = r => r.Name.Contains("self")
});
- loggerFactory.AddConsole(_cfg.GetSection("Logging"));
+#pragma warning disable CS0618 // Type or member is obsolete
+ loggerFactory.AddConsole(_configuration.GetSection("Logging"));
+#pragma warning restore CS0618 // Type or member is obsolete
- app.UseCors("CorsPolicy");
-
- app.UseOcelot().Wait();
+ app.UseCors("CorsPolicy")
+ .UseOcelot()
+ .Wait();
}
}
}
diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj
index 077d6c624..3139a40a2 100644
--- a/src/Services/Identity/Identity.API/Identity.API.csproj
+++ b/src/Services/Identity/Identity.API/Identity.API.csproj
@@ -27,9 +27,9 @@
+
-
diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj
index 8bbb27b96..db91c710d 100644
--- a/src/Web/WebStatus/WebStatus.csproj
+++ b/src/Web/WebStatus/WebStatus.csproj
@@ -27,4 +27,9 @@
+
+
+
+
+