Browse Source

Merge pull request #18 from dotnet-architecture/dev

PR to merge into skynode dev branch
pull/391/head
Dexter Valkyrie 7 years ago
committed by GitHub
parent
commit
e2844c32d0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
151 changed files with 3710 additions and 2034 deletions
  1. +1
    -1
      .env
  2. +1
    -1
      ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricBus/Bus/ApplicationParameters/Cloud.xml
  3. +1
    -1
      ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricNoSql/NoSQL/ApplicationParameters/Cloud.xml
  4. +1
    -1
      ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricRedis/Redis/ApplicationParameters/Cloud.xml
  5. +1
    -1
      ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricSql/Sql/ApplicationParameters/Cloud.xml
  6. +4
    -2
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml
  7. +3
    -2
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
  8. +2
    -2
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
  9. +3
    -2
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
  10. +4
    -3
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
  11. +3
    -2
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
  12. +2
    -2
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
  13. +8
    -7
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml
  14. +1
    -1
      ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml
  15. +1
    -1
      ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationParameters/Cloud.xml
  16. +9
    -2
      ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
  17. +1
    -1
      ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml
  18. +1
    -1
      ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml
  19. +1
    -1
      ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationParameters/Cloud.xml
  20. +10
    -9
      ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml
  21. +1
    -1
      ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml
  22. +1
    -1
      ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricBus/Bus/ApplicationParameters/Cloud.xml
  23. +1
    -1
      ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricNoSql/NoSQL/ApplicationParameters/Cloud.xml
  24. +1
    -1
      ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricRedis/Redis/ApplicationParameters/Cloud.xml
  25. +2
    -2
      ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricSql/Sql/ApplicationPackageRoot/SqlServerPkg/ServiceManifest.xml
  26. +1
    -1
      ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricSql/Sql/ApplicationParameters/Cloud.xml
  27. +4
    -2
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml
  28. +2
    -1
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
  29. +2
    -2
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
  30. +2
    -1
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
  31. +3
    -2
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
  32. +2
    -1
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
  33. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
  34. +8
    -7
      ServiceFabric/Windows/eShopOnServiceFabric/ApplicationParameters/Cloud.xml
  35. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml
  36. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationParameters/Cloud.xml
  37. +8
    -1
      ServiceFabric/Windows/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
  38. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml
  39. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml
  40. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationParameters/Cloud.xml
  41. +10
    -9
      ServiceFabric/Windows/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml
  42. +1
    -1
      ServiceFabric/Windows/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml
  43. +7
    -4
      cli-mac/build-bits.sh
  44. +2
    -2
      cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1
  45. +82
    -36
      deploy/az/servicefabric/LinuxContainers/readme.md
  46. +5
    -5
      deploy/az/servicefabric/LinuxContainers/servicefabricdeploy.parameters.json
  47. +11
    -11
      deploy/az/servicefabric/LinuxContainers/servicefabricdeploysecured.parameters.json
  48. +90
    -40
      deploy/az/servicefabric/WindowsContainers/readme.md
  49. +7
    -7
      deploy/az/servicefabric/WindowsContainers/servicefabricdeploy.parameters.json
  50. +10
    -10
      deploy/az/servicefabric/WindowsContainers/servicefabricdeploysecured.parameters.json
  51. +3
    -3
      docker-compose.ci.build.yml
  52. +15
    -0
      docker-compose.override.yml
  53. +83
    -26
      docker-compose.prod.yml
  54. +0
    -5
      docker-compose.yml
  55. +1
    -52
      eShopOnContainers-ServicesAndWebApps.sln
  56. BIN
      img/appinsights/create-insights.PNG
  57. BIN
      img/appinsights/settings-insights.PNG
  58. BIN
      img/sf/set-instrumentationkey.PNG
  59. +1
    -0
      k8s/conf_local.yml
  60. +25
    -0
      k8s/deployments.yaml
  61. +1
    -1
      src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj
  62. +4
    -2
      src/BuildingBlocks/DataProtection/DataProtection/DataProtectionBuilderExtensions.cs
  63. +1
    -1
      src/BuildingBlocks/DataProtection/DataProtection/RedisXmlRepository.cs
  64. +1
    -0
      src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj
  65. +22
    -3
      src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs
  66. +21
    -2
      src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs
  67. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs
  68. +0
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/IOrderService.cs
  69. +3
    -20
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderMockService.cs
  70. +1
    -22
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs
  71. +0
    -2
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/User/UserService.cs
  72. +23
    -9
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml
  73. +0
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj
  74. +79
    -0
      src/Services/Basket/Basket.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs
  75. +11
    -4
      src/Services/Basket/Basket.API/Startup.cs
  76. +4
    -3
      src/Services/Catalog/Catalog.API/Startup.cs
  77. +6
    -5
      src/Services/Identity/Identity.API/Startup.cs
  78. +79
    -0
      src/Services/Location/Locations.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs
  79. +10
    -3
      src/Services/Location/Locations.API/Startup.cs
  80. +79
    -0
      src/Services/Marketing/Marketing.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs
  81. +10
    -3
      src/Services/Marketing/Marketing.API/Startup.cs
  82. +79
    -0
      src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs
  83. +10
    -3
      src/Services/Ordering/Ordering.API/Startup.cs
  84. +3
    -2
      src/Services/Payment/Payment.API/Startup.cs
  85. +80
    -0
      src/Web/WebMVC/Infrastructure/Middlewares/ByPassAuthMiddleware.cs
  86. +6
    -3
      src/Web/WebMVC/Infrastructure/ResilientHttpClientFactory.cs
  87. +11
    -3
      src/Web/WebMVC/Startup.cs
  88. +3
    -2
      src/Web/WebSPA/Startup.cs
  89. +3
    -2
      src/Web/WebStatus/Startup.cs
  90. +0
    -1
      src/Web/WebStatus/Views/Shared/_Layout.cshtml
  91. +4
    -5
      test/Services/FunctionalTests/FunctionalTests.csproj
  92. +5
    -3
      test/Services/FunctionalTests/Services/Basket/BasketScenariosBase.cs
  93. +16
    -0
      test/Services/FunctionalTests/Services/Basket/appsettings.json
  94. +4
    -2
      test/Services/FunctionalTests/Services/Catalog/CatalogScenariosBase.cs
  95. +2
    -1
      test/Services/FunctionalTests/Services/Catalog/appsettings.json
  96. +4
    -2
      test/Services/FunctionalTests/Services/Location/LocationsScenariosBase.cs
  97. +7
    -7
      test/Services/FunctionalTests/Services/Marketing/MarketingScenarios.cs
  98. +4
    -2
      test/Services/FunctionalTests/Services/Marketing/MarketingScenariosBase.cs
  99. +2
    -1
      test/Services/FunctionalTests/Services/Marketing/appsettings.json
  100. +3
    -2
      test/Services/FunctionalTests/Services/Ordering/OrderingScenarios.cs

+ 1
- 1
.env View File

@ -24,4 +24,4 @@ ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92
#ESHOP_SERVICE_BUS_USERNAME=<ServiceBusUserName-OnlyUsedIfUsingRabbitMQUnderwindows>
#ESHOP_SERVICE_BUS_PASSWORD=<ServiceBusUserPassword-OnlyUsedIfUsingRabbitMQUnderwindows>
#INSTRUMENTATION_KEY=
#ORCHESTRATOR_TYPE=<k8S/SF>
#USE_LOADTEST=<True/False>

+ 1
- 1
ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricBus/Bus/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/Bus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="RabbitMQ_InstanceCount" Value="-1" />
<Parameter Name="RabbitMQ_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricNoSql/NoSQL/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/NoSQL" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="MongoDB_InstanceCount" Value="-1" />
<Parameter Name="MongoDB_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricRedis/Redis/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/Redis" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="BasketData_InstanceCount" Value="-1" />
<Parameter Name="BasketData_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Linux/Infrastructure/eShopOnServiceFabricSql/Sql/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/Sql" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="SqlServer_InstanceCount" Value="-1" />
<Parameter Name="SqlServer_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 4
- 2
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -12,7 +12,8 @@
<Parameter Name="CatalogApi_InstanceCount" DefaultValue="-1" />
<Parameter Name="BasketApi_InstanceCount" DefaultValue="-1" />
<Parameter Name="IdentityUrlExternal" DefaultValue="" />
<Parameter Name="PicBaseUrl" DefaultValue="" />
<Parameter Name="PicBaseUrlCatalog" DefaultValue="" />
<Parameter Name="PicBaseUrlMarketing" DefaultValue="" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
@ -25,6 +26,7 @@
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrlMarketing]"/>
</EnvironmentOverrides>
<Policies>
<ContainerHostPolicies CodePackageRef="Code">
@ -70,7 +72,7 @@
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="CatalogApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrl]"/>
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrlCatalog]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides>
<Policies>


+ 3
- 2
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/basket.api:latest</ImageName>
<ImageName>eshop/basket.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -29,6 +29,7 @@
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
</EnvironmentVariables>
</CodePackage>
@ -41,7 +42,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="BasketApiTypeEndpoint" Port="5103" UriScheme="http" PathSuffix="eShopOnServiceFabric/BasketApi"/>
<Endpoint Name="BasketApiTypeEndpoint" Port="5103" UriScheme="http"/>
</Endpoints>
</Resources>
</ServiceManifest>


+ 2
- 2
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/catalog.api:latest</ImageName>
<ImageName>eshop/catalog.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -44,7 +44,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="CatalogApiTypeEndpoint" Port="5101" UriScheme="http" PathSuffix="eShopOnServiceFabric/CatalogApi"/>
<Endpoint Name="CatalogApiTypeEndpoint" Port="5101" UriScheme="http"/>
</Endpoints>
</Resources>
</ServiceManifest>

+ 3
- 2
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/locations.api:latest</ImageName>
<ImageName>eshop/locations.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -30,6 +30,7 @@
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
</EnvironmentVariables>
</CodePackage>
@ -42,7 +43,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="LocationsApiTypeEndpoint" Port="5109" PathSuffix="eShopOnServiceFabric/LocationsApi"/>
<Endpoint Name="LocationsApiTypeEndpoint" Port="5109"/>
</Endpoints>
</Resources>
</ServiceManifest>

+ 4
- 3
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/marketing.api:latest</ImageName>
<ImageName>eshop/marketing.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -27,7 +27,7 @@
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="CampaignDetailFunctionUri" Value=""/>
<EnvironmentVariable Name="PicBaseUrl" Value="http://marketingapi.eshoponservicefabric:5110/api/v1/campaigns/[0]/pic/"/>
<EnvironmentVariable Name="PicBaseUrl" Value=""/>
<EnvironmentVariable Name="AzureStorageAccountName" Value=""/>
<EnvironmentVariable Name="AzureStorageAccountKey" Value=""/>
<EnvironmentVariable Name="AzureStorageEnabled" Value="False"/>
@ -36,6 +36,7 @@
<EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
</EnvironmentVariables>
</CodePackage>
@ -48,7 +49,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="MarketingApiTypeEndpoint" Port="5110" PathSuffix="eShopOnServiceFabric/MarketingApi"/>
<Endpoint Name="MarketingApiTypeEndpoint" Port="5110"/>
</Endpoints>
</Resources>
</ServiceManifest>

+ 3
- 2
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/ordering.api:latest</ImageName>
<ImageName>eshop/ordering.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -32,6 +32,7 @@
<EnvironmentVariable Name="CheckUpdateTime" Value="30000"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
</EnvironmentVariables>
</CodePackage>
@ -44,7 +45,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="OrderingApiTypeEndpoint" Port="5102" UriScheme="http" PathSuffix="eShopOnServiceFabric/OrderingApi"/>
<Endpoint Name="OrderingApiTypeEndpoint" Port="5102" UriScheme="http"/>
</Endpoints>
</Resources>
</ServiceManifest>

+ 2
- 2
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/payment.api:latest</ImageName>
<ImageName>eshop/payment.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -38,7 +38,7 @@
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Name="PaymentApiTypeEndpoint" Port="5108" PathSuffix="eShopOnServiceFabric/PaymentApi"/>
<Endpoint Name="PaymentApiTypeEndpoint" Port="5108"/>
</Endpoints>
</Resources>
</ServiceManifest>

+ 8
- 7
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml View File

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabric" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="MarketingApi_InstanceCount" Value="-1" />
<Parameter Name="LocationsApi_InstanceCount" Value="-1" />
<Parameter Name="PaymentApi_InstanceCount" Value="-1" />
<Parameter Name="OrderingApi_InstanceCount" Value="-1" />
<Parameter Name="CatalogApi_InstanceCount" Value="-1" />
<Parameter Name="BasketApi_InstanceCount" Value="-1" />
<Parameter Name="MarketingApi_InstanceCount" Value="1" />
<Parameter Name="LocationsApi_InstanceCount" Value="1" />
<Parameter Name="PaymentApi_InstanceCount" Value="1" />
<Parameter Name="OrderingApi_InstanceCount" Value="1" />
<Parameter Name="CatalogApi_InstanceCount" Value="1" />
<Parameter Name="BasketApi_InstanceCount" Value="1" />
<Parameter Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="PicBaseUrl" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" />
<Parameter Name="PicBaseUrlCatalog" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" />
<Parameter Name="PicBaseUrlMarketing" Value="http://#{your_sf_dns}#:5110/api/v1/campaigns/[0]/pic/" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/identity.api:latest</ImageName>
<ImageName>eshop/identity.api:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->


+ 1
- 1
ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricIdSrv" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="IdentityApi_InstanceCount" Value="-1" />
<Parameter Name="IdentityApi_InstanceCount" Value="1" />
<Parameter Name="SpaClient" Value="http://#{your_sf_dns}#:5104" />
<Parameter Name="XamarinCallback" Value="http://#{your_sf_dns}#:5105/xamarincallback" />
<Parameter Name="MvcClient" Value="http://#{your_sf_dns}#:5100" />


+ 9
- 2
ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/webmvc:latest</ImageName>
<ImageName>eshop/webmvc:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -28,11 +28,18 @@
<EnvironmentVariable Name="IdentityUrl" Value=""/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="CatalogUrlHC" Value="http://catalogapi.eshoponservicefabric:5101/hc"/>
<EnvironmentVariable Name="OrderingUrlHC" Value="http://orderingapi.eshoponservicefabric:5102/hc"/>
<EnvironmentVariable Name="IdentityUrlHC" Value="http://identityapi.eshoponservicefabric:5105/hc"/>
<EnvironmentVariable Name="BasketUrlHC" Value="http://basketapi.eshoponservicefabric:5103/hc"/>
<EnvironmentVariable Name="PaymentUrlHC" Value="http://paymentapi.eshoponservicefabric:5108/hc"/>
<EnvironmentVariable Name="MarketingUrlHC" Value="http://marketingapi.eshoponservicefabric:5110/hc"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="True"/>
</EnvironmentVariables>
</CodePackage>
<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="1.0.0" />


+ 1
- 1
ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricWebMVC" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="WebMVC_InstanceCount" Value="-1" />
<Parameter Name="WebMVC_InstanceCount" Value="1" />
<Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters>

+ 1
- 1
ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/webspa:latest</ImageName>
<ImageName>eshop/webspa:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->


+ 1
- 1
ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricWebSPA" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="WebSPA_InstanceCount" Value="-1" />
<Parameter Name="WebSPA_InstanceCount" Value="1" />
<Parameter Name="CatalogUrl" Value="http://#{your_sf_dns}#:5101" />
<Parameter Name="OrderingUrl" Value="http://#{your_sf_dns}#:5102" />
<Parameter Name="BasketUrl" Value="http://#{your_sf_dns}#:5103" />


+ 10
- 9
ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml View File

@ -15,21 +15,22 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/webstatus:latest</ImageName>
<ImageName>eshop/webstatus:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
<EnvironmentVariables>
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
<EnvironmentVariable Name="CatalogUrl" Value="http://catalogapi.eshoponservicefabric:5101"/>
<EnvironmentVariable Name="OrderingUrl" Value="http://orderingapi.eshoponservicefabric:5102"/>
<EnvironmentVariable Name="BasketUrl" Value="http://basketapi.eshoponservicefabric:5103"/>
<EnvironmentVariable Name="IdentityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="mvc" Value="http://webmvc.eshoponservicefabric:5100"/>
<EnvironmentVariable Name="spa" Value="http://webspa.eshoponservicefabric:5104"/>
<EnvironmentVariable Name="CatalogUrl" Value="http://catalogapi.eshoponservicefabric:5101/hc"/>
<EnvironmentVariable Name="OrderingUrl" Value="http://orderingapi.eshoponservicefabric:5102/hc"/>
<EnvironmentVariable Name="BasketUrl" Value="http://basketapi.eshoponservicefabric:5103/hc"/>
<EnvironmentVariable Name="IdentityUrl" Value="http://identityapi.eshoponservicefabric:5105/hc"/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110/hc"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109/hc"/>
<EnvironmentVariable Name="PaymentUrl" Value="http://paymentapi.eshoponservicefabric:5108/hc"/>
<EnvironmentVariable Name="mvc" Value="http://webmvc.eshoponservicefabric:5100/hc"/>
<EnvironmentVariable Name="spa" Value="http://webspa.eshoponservicefabric:5104/hc"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables>


+ 1
- 1
ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricWebStatus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="WebStatus_InstanceCount" Value="-1" />
<Parameter Name="WebStatus_InstanceCount" Value="1" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricBus/Bus/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/Bus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="RabbitMQ_InstanceCount" Value="-1" />
<Parameter Name="RabbitMQ_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricNoSql/NoSQL/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/NoSQL" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="MongoDB_InstanceCount" Value="-1" />
<Parameter Name="MongoDB_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricRedis/Redis/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/Redis" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="BasketData_InstanceCount" Value="-1" />
<Parameter Name="BasketData_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 2
- 2
ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricSql/Sql/ApplicationPackageRoot/SqlServerPkg/ServiceManifest.xml View File

@ -15,12 +15,12 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>microsoft/mssql-server-windows-developer:2016-sp1-windowsservercore-10.0.14393.1480</ImageName>
<ImageName>microsoft/mssql-server-windows-developer:2017</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
<EnvironmentVariables>
<EnvironmentVariable Name="MSSQL_SA_PASSWORD" Value="Pass@word"/>
<EnvironmentVariable Name="SA_PASSWORD" Value="Pass@word"/>
<EnvironmentVariable Name="ACCEPT_EULA" Value="Y"/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 1
ServiceFabric/Windows/Infrastructure/eShopOnServiceFabricSql/Sql/ApplicationParameters/Cloud.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/Sql" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="SqlServer_InstanceCount" Value="-1" />
<Parameter Name="SqlServer_InstanceCount" Value="1" />
</Parameters>
</Application>

+ 4
- 2
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -12,7 +12,8 @@
<Parameter Name="CatalogApi_InstanceCount" DefaultValue="-1" />
<Parameter Name="BasketApi_InstanceCount" DefaultValue="-1" />
<Parameter Name="IdentityUrlExternal" DefaultValue="" />
<Parameter Name="PicBaseUrl" DefaultValue="" />
<Parameter Name="PicBaseUrlCatalog" DefaultValue="" />
<Parameter Name="PicBaseUrlMarketing" DefaultValue="" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
@ -25,6 +26,7 @@
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value="[InstrumentationKey]"/>
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrlMarketing]"/>
</EnvironmentOverrides>
<Policies>
<ContainerHostPolicies CodePackageRef="Code">
@ -70,7 +72,7 @@
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="CatalogApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrl]"/>
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrlCatalog]"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides>
<Policies>


+ 2
- 1
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/basket.api-win</ImageName>
<ImageName>eshop/basket.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -31,6 +31,7 @@
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="False"/>
</EnvironmentVariables>
</CodePackage>


+ 2
- 2
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml View File

@ -15,13 +15,13 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/catalog.api-win</ImageName>
<ImageName>eshop/catalog.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
<EnvironmentVariables>
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
<EnvironmentVariable Name="ConnectionString" Value="Data Source=sqlserver.eshoponservicefabricsql,5433;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word"/>
<EnvironmentVariable Name="PicBaseUrl" Value="http://catalogapi.eshoponservicefabric:5101/api/v1/catalog/items/[0]/pic/"/>
<EnvironmentVariable Name="AzureStorageAccountName" Value=""/>


+ 2
- 1
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/locations.api-win</ImageName>
<ImageName>eshop/locations.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -32,6 +32,7 @@
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="False"/>
</EnvironmentVariables>
</CodePackage>


+ 3
- 2
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/marketing.api-win</ImageName>
<ImageName>eshop/marketing.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -27,7 +27,7 @@
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="CampaignDetailFunctionUri" Value=""/>
<EnvironmentVariable Name="PicBaseUrl" Value="http://marketingapi.eshoponservicefabric:5110/api/v1/campaigns/[0]/pic/"/>
<EnvironmentVariable Name="PicBaseUrl" Value=""/>
<EnvironmentVariable Name="AzureStorageAccountName" Value=""/>
<EnvironmentVariable Name="AzureStorageAccountKey" Value=""/>
<EnvironmentVariable Name="AzureStorageEnabled" Value="False"/>
@ -38,6 +38,7 @@
<EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="False"/>
</EnvironmentVariables>
</CodePackage>


+ 2
- 1
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/ordering.api-win</ImageName>
<ImageName>eshop/ordering.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -34,6 +34,7 @@
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="False"/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/payment.api-win</ImageName>
<ImageName>eshop/payment.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->


+ 8
- 7
ServiceFabric/Windows/eShopOnServiceFabric/ApplicationParameters/Cloud.xml View File

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabric" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="MarketingApi_InstanceCount" Value="-1" />
<Parameter Name="LocationsApi_InstanceCount" Value="-1" />
<Parameter Name="PaymentApi_InstanceCount" Value="-1" />
<Parameter Name="OrderingApi_InstanceCount" Value="-1" />
<Parameter Name="CatalogApi_InstanceCount" Value="-1" />
<Parameter Name="BasketApi_InstanceCount" Value="-1" />
<Parameter Name="MarketingApi_InstanceCount" Value="1" />
<Parameter Name="LocationsApi_InstanceCount" Value="1" />
<Parameter Name="PaymentApi_InstanceCount" Value="1" />
<Parameter Name="OrderingApi_InstanceCount" Value="1" />
<Parameter Name="CatalogApi_InstanceCount" Value="1" />
<Parameter Name="BasketApi_InstanceCount" Value="1" />
<Parameter Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="PicBaseUrl" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" />
<Parameter Name="PicBaseUrlCatalog" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" />
<Parameter Name="PicBaseUrlMarketing" Value="http://#{your_sf_dns}#:5110/api/v1/campaigns/[0]/pic/" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters>
</Application>

+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/identity.api-win</ImageName>
<ImageName>eshop/identity.api-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->


+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricIdSrv" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="IdentityApi_InstanceCount" Value="-1" />
<Parameter Name="IdentityApi_InstanceCount" Value="1" />
<Parameter Name="SpaClient" Value="http://#{your_sf_dns}#:5104" />
<Parameter Name="XamarinCallback" Value="http://#{your_sf_dns}#:5105/xamarincallback" />
<Parameter Name="MvcClient" Value="http://#{your_sf_dns}#:5100" />


+ 8
- 1
ServiceFabric/Windows/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/webmvc-win</ImageName>
<ImageName>eshop/webmvc-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
@ -28,8 +28,15 @@
<EnvironmentVariable Name="IdentityUrl" Value=""/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="CatalogUrlHC" Value="http://catalogapi.eshoponservicefabric:5101/hc"/>
<EnvironmentVariable Name="OrderingUrlHC" Value="http://orderingapi.eshoponservicefabric:5102/hc"/>
<EnvironmentVariable Name="IdentityUrlHC" Value="http://identityapi.eshoponservicefabric:5105/hc"/>
<EnvironmentVariable Name="BasketUrlHC" Value="http://basketapi.eshoponservicefabric:5103/hc"/>
<EnvironmentVariable Name="PaymentUrlHC" Value="http://paymentapi.eshoponservicefabric:5108/hc"/>
<EnvironmentVariable Name="MarketingUrlHC" Value="http://marketingapi.eshoponservicefabric:5110/hc"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
<EnvironmentVariable Name="UseLoadTest" Value="False"/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricWebMVC" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="WebMVC_InstanceCount" Value="-1" />
<Parameter Name="WebMVC_InstanceCount" Value="1" />
<Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters>

+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml View File

@ -15,7 +15,7 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/webspa-win</ImageName>
<ImageName>eshop/webspa-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->


+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricWebSPA" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="WebSPA_InstanceCount" Value="-1" />
<Parameter Name="WebSPA_InstanceCount" Value="1" />
<Parameter Name="CatalogUrl" Value="http://#{your_sf_dns}#:5101" />
<Parameter Name="OrderingUrl" Value="http://#{your_sf_dns}#:5102" />
<Parameter Name="BasketUrl" Value="http://#{your_sf_dns}#:5103" />


+ 10
- 9
ServiceFabric/Windows/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml View File

@ -15,21 +15,22 @@
<EntryPoint>
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
<ContainerHost>
<ImageName>eshop/webstatus-win</ImageName>
<ImageName>eshop/webstatus-win:#{tag}#</ImageName>
</ContainerHost>
</EntryPoint>
<!-- Pass environment variables to your container: -->
<EnvironmentVariables>
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
<EnvironmentVariable Name="CatalogUrl" Value="http://catalogapi.eshoponservicefabric:5101"/>
<EnvironmentVariable Name="OrderingUrl" Value="http://orderingapi.eshoponservicefabric:5102"/>
<EnvironmentVariable Name="BasketUrl" Value="http://basketapi.eshoponservicefabric:5103"/>
<EnvironmentVariable Name="IdentityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="mvc" Value="http://webmvc.eshoponservicefabric:5100"/>
<EnvironmentVariable Name="spa" Value="http://webspa.eshoponservicefabric:5104"/>
<EnvironmentVariable Name="CatalogUrl" Value="http://catalogapi.eshoponservicefabric:5101/hc"/>
<EnvironmentVariable Name="OrderingUrl" Value="http://orderingapi.eshoponservicefabric:5102/hc"/>
<EnvironmentVariable Name="BasketUrl" Value="http://basketapi.eshoponservicefabric:5103/hc"/>
<EnvironmentVariable Name="IdentityUrl" Value="http://identityapi.eshoponservicefabric:5105/hc"/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110/hc"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109/hc"/>
<EnvironmentVariable Name="PaymentUrl" Value="http://paymentapi.eshoponservicefabric:5108/hc"/>
<EnvironmentVariable Name="mvc" Value="http://webmvc.eshoponservicefabric:5100/hc"/>
<EnvironmentVariable Name="spa" Value="http://webspa.eshoponservicefabric:5104/hc"/>
<EnvironmentVariable Name="ApplicationInsights:InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables>


+ 1
- 1
ServiceFabric/Windows/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Application Name="fabric:/eShopOnServiceFabricWebStatus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters>
<Parameter Name="WebStatus_InstanceCount" Value="-1" />
<Parameter Name="WebStatus_InstanceCount" Value="1" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters>
</Application>

+ 7
- 4
cli-mac/build-bits.sh View File

@ -3,12 +3,15 @@
# List of microservices here needs to be updated to include all the new microservices (Marketing, etc.)
projectList=(
"../src/Services/Catalog/Catalog.API"
"../src/Services/Basket/Basket.API"
"../src/Services/Ordering/Ordering.API"
"../src/Services/Identity/Identity.API"
"../src/Web/WebMVC"
"../src/Web/WebSPA"
"../src/Services/Identity/Identity.API"
"../src/Services/Catalog/Catalog.API"
"../src/Services/Ordering/Ordering.API"
"../src/Services/Basket/Basket.API"
"../src/Services/Location/Locations.API"
"../src/Services/Marketing/Marketing.API"
"../src/Services/Payment/Payment.API"
"../src/Web/WebStatus"
)


+ 2
- 2
cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1 View File

@ -21,6 +21,6 @@ try {
Write-Host "Rule found"
}
catch [Exception] {
New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5110" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5110" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
}

+ 82
- 36
deploy/az/servicefabric/LinuxContainers/readme.md View File

@ -1,83 +1,129 @@
# Deploying Azure Service Fabric (No Secured)
# Deploying a Service Fabric cluster based on Linux nodes
The ARM template `servicefabricdeploy.json` and its parameter file (`servicefabricdeploy.parameters.json`) are used to create a service fabric cluster environment for linux containers.
## A. Unsecured cluster (SF Linux cluster)
For a secured cluster, see option B. below.
## Editing servicefabricdeploy.parameters.json file
You can always deploy a SF cluster through the Azure portal, as explained in this article: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-azure-cluster
However, when creating a cluster, there are quite a few configurations to take into account, like enabling the internal DNS service or Reverse Proxy service, choosing between Linux/Windows, open/publish your application ports in the load-balancer and most of all (the most complex setup) how to create a secure cluster.
Because of those reasons, we have created a set of ARM templates and scripts so you can create, re-create and configure the SF clusters much faster, as explained below:
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\LinuxContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/LinuxContainers), you can find the ARM template `servicefabricdeploy.json` and its parameters file (`servicefabricdeploy.parameters.json`) to create a Service Fabric cluster environment for Linux Containers.
## Edit the servicefabricdeploy.parameters.json file
Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
- clusterName: Name of your SF cluster
- clusterLocation: Datacenter location, like westus or westeurope
- computeLocation: Datacenter location, like westus or westeurope
- adminUserName: user-name for VMs administration
- adminPassword: user-password for VMs administration
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
- webMvcHttpPort: port externally exposed for the WebMVC app
- webSpaHttpPort: port externally exposed for the WebSPA app
- webStatusHttpPort: port externally exposed for the WebStatus app
- IdSrvHttpRule: port externally exposed for the Identity app
Optionally, you could modify which ports are opened in the LoadBalancer for the multiple eShopOnContainer apps and API services.
By default, they are setup as:
- webMvcHttpPort: 5100
- webSpaHttpPort: 5104
- webStatusHttpPort: 5107
- IdSrvHttpRule: 5105
- BasketApiHttpRule: 5103
- CatalogApiHttpRule: 5101
- OrderingApiHttpRule: 5102
- MarketingApiHttpRule: 5110
- LocationsApiHttpRule: 5109
## Deploy the template
## Deploy the Service Fabric cluster using the script and ARM templates
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type:
For example, to deploy the cluster to a new resourcegroup located in westus, go to `deploy\az` folder and type:
```
create-resources.cmd servicefabric\LinuxContainers\servicefabricdeploy newResourceGroup -c westus
create-resources.cmd servicefabric\LinuxContainers\servicefabricdeploy qa-eshop-sflinux-resgrp -c westus
```
## Deploy eShopOnServiceFabric with Visual Studio.
Alternatively, instead of using ARM templates, you can deploy eShop on service fabric directly by publishing the project eShopOnServiceFabric in eShopOnContainers-ServicesAndWebApps.sln with Visual Studio publish tool.
You should see a similar execution to the following:
![image](https://user-images.githubusercontent.com/1712635/31638180-15da9f84-b287-11e7-9d4e-604f33690198.png)
# Deploying Azure Service Fabric (Secured)
Now, if you go to your subscription in Azure, you should be able to see the SF cluster already created and available, like in the following image:
![image](https://user-images.githubusercontent.com/1712635/31638398-3fc08ad8-b288-11e7-879b-fc4df0daad2b.png)
In this case, this is an unsecured SF cluster with a single Linux node, good for initial tests and getting started with SF.
## B. Secured cluster (SF Linux cluster)
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\LinuxContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/LinuxContainers), you can find the ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) to create a secured Service Fabric cluster environment for Linux Containers (IN THIS CASE, IT IS A SECURED CLUSTER USING A CERTIFICATE).
The ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) are used to create a service fabric cluster environment for linux containers secured with a certificate.
## Create Azure Keyvault service
Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
<img src="../../../../img/sf/create-kv.png">
![image](https://user-images.githubusercontent.com/1712635/31638848-9b266530-b28a-11e7-953b-1e3ec1a54f77.png)
## Generate a certificate in Azure Keyvault
In a POWER-SHELL window, move to the folder [..\deploy\az\servicefabric\LinuxContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/LinuxContainers).
**Select your Azure subscription** You might have [several Azure subscriptions](https://docs.microsoft.com/en-us/cli/azure/account#set) as shown if you type the following.
>```
>az account list
>```
If you have multiple subscription accounts, you first need to select the Azure subscription account you want to target. Type the following:
>```
>az account set --subscription "Your Azure Subscription Name or ID"
>```
Execute the gen-keyvaultcert.ps1 script to generate and download a certificate from Keyvault.
```
.\gen-keyvaultcert.ps1 -vaultName <your_keyvault_service> -certName <your_cert_name> -certPwd <your_cert_pwd> -subjectName CN=<your_sf_dns_name>.westeurope.cloudapp.azure.com -saveDir C:\Users\<user>\Downloads
```
You should see a similar execution to the following:
![image](https://user-images.githubusercontent.com/1712635/31640172-93efcca0-b291-11e7-970e-5b5e6bf07042.png)
IMPORTANT: At this point, copy/cut the .PFX certificate file saved in the downloads forlder and save it in a secure place.
## Install the certificate
Install the certificate under 'Current User' store location and check it as exportable.
Install the certificate (by double-clicking on the .PFX file) under 'Current User' store location (by default location) and check it as exportable.
<img src="https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/img/sf/install-cert.PNG">
Also, install the same certificate as CA (Certificate Authority) under Current User, too.
<img src="../../../../img/sf/install-cert.png">
![image](https://user-images.githubusercontent.com/1712635/31642795-c6ffa434-b2a1-11e7-8ff8-2a63549a780e.png)
## Editing servicefabricdeploysecured.parameters.json file
Edit the following params in `servicefabricdeploysecured.parameters.json` file to set your values:
Edit the parameters in `servicefabricdeploysecured.parameters.json` in a similar way you can do with the unsecured .json file shown above (clusterName, dnsName, etc.), plus edit the following values:
- clusterName: Name of your SF cluster
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
- sourceVaultValue: keyvault resource id (check azure keyvault properties)
- certificateUrlValue: certificate url (check azure Keyvault certificate properties)
- certificateThumbprint: certificate thumbprint (check azure Keyvault certificate properties)
- sourceVaultValue: Your Azure Keyvault's RESOURCE ID (check Azure keyvault properties, similar to: /subscriptions/e1234ac1-c09c-3jaf-6767-98b3c5f1f246/resourceGroups/eshop-global-resgrp/providers/Microsoft.KeyVault/vaults/eshopkeyvault")
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
- certificateUrlValue: Your certificate Secret Identifier (check Azure Keyvault secret certificate properties, should be in the format of https://<name of the vault>.vault.azure.net:443/secrets/<exact location>, similar to:
https://eshopkeyvault.vault.azure.net/secrets/pro-eshop-sflinux-cluster-cert/fd47684442c04cdj83b3hfe4h8e08123)
- webMvcHttpPort: port externally exposed for the WebMVC app
- webSpaHttpPort: port externally exposed for the WebSPA app
- webStatusHttpPort: port externally exposed for the WebStatus app
- IdSrvHttpRule: port externally exposed for the Identity app
- certificateThumbprint: certificate thumbprint (check azure Keyvault certificate thumbprint, something like 69JK453486D55A6818577Z0699100365HDK70FCE)
## Deploy the template
## Deploy the secured SF Linux cluster
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
Once parameters file is edited you can deploy it using [create-resources script](../readme.md).
Use a command prompt window positioned into the deploy\az folder.
```
create-resources.cmd servicefabric\LinuxContainers\servicefabricdeploysecured newResourceGroup -c westus
create-resources.cmd servicefabric\LinuxContainers\servicefabricdeploysecured pro-eshop-sflinux-resgrp -c westus
```
The execution should be something like the following:
![image](https://user-images.githubusercontent.com/1712635/31642529-54479704-b2a0-11e7-90ee-2abf32c92205.png)
Once the cluster is created you can explore it with Azure's portal, like in the following image:
![image](https://user-images.githubusercontent.com/1712635/31642956-b7cfc8d0-b2a2-11e7-8ede-a141ec190eb4.png)
## Deploy eShopOnServiceFabric with Visual Studio.
Modify the cloud.xml file of each Service Fabric application in PublishProfile directory and set your certificate settings to be able to deploy eshopOnContainers in the secured cluster:


+ 5
- 5
deploy/az/servicefabric/LinuxContainers/servicefabricdeploy.parameters.json View File

@ -3,19 +3,19 @@
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"value": "your_sf_name"
"value": "qa-eshop-sflinux-cluster"
},
"clusterLocation": {
"value": "westeurope"
"value": "westus"
},
"computeLocation": {
"value": "westeurope"
"value": "westus"
},
"adminUserName": {
"value": "eshop"
},
"adminPassword": {
"value": "your_admin_password"
"value": "Your_complex_Pass@word1"
},
"nicName": {
"value": "NIC-eshoponsflin"
@ -24,7 +24,7 @@
"value": "eshoponsflin-PubIP"
},
"dnsName": {
"value": "your_sf_dns"
"value": "qa-eshop-sflinux-cluster"
},
"virtualNetworkName": {
"value": "VNet-eshoponsflin"


+ 11
- 11
deploy/az/servicefabric/LinuxContainers/servicefabricdeploysecured.parameters.json View File

@ -3,19 +3,19 @@
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"value": "your_sf_name"
"value": "pro-eshop-sflinux-cluster"
},
"clusterLocation": {
"value": "westeurope"
"value": "westus"
},
"computeLocation": {
"value": "westeurope"
"value": "westus"
},
"adminUserName": {
"value": "eshop"
},
"adminPassword": {
"value": "your_admin_password"
"value": "Pass@word1"
},
"nicName": {
"value": "NIC-eshopsflinsec"
@ -24,25 +24,25 @@
"value": "eshopsflinsec-PubIP"
},
"dnsName": {
"value": "your_sf_dns"
"value": "pro-eshop-sflinux-cluster"
},
"virtualNetworkName": {
"value": "VNet-eshopsflinsec"
"value": "VNet-eshopsflin"
},
"lbName": {
"value": "LB-eshopsflinsec"
"value": "LB-eshopsflin"
},
"lbIPName": {
"value": "LBIP-eshopsflinsec"
"value": "LBIP-eshopsflin"
},
"sourceVaultValue": {
"value": ""
"value": "your-value-check-keyvault-at-azure"
},
"certificateUrlValue": {
"value": ""
"value": "your-value-check-keyvault-at-azure"
},
"certificateThumbprint": {
"value": ""
"value": "your-value-check-keyvault-at-azure"
},
"vmImageSku": {
"value": "16.04-LTS"


+ 90
- 40
deploy/az/servicefabric/WindowsContainers/readme.md View File

@ -1,84 +1,134 @@
# Deploying Azure Service Fabric (No Secured)
# Deploying a Service Fabric cluster based on Windows nodes
The ARM template `servicefabricdeploy.json` and its parameter file (`servicefabricdeploy.parameters.json`) are used to create a service fabric cluster environment for windows containers.
## A. Unsecured cluster (SF Windows cluster)
For a secured cluster, see option B. below.
## Editing servicefabricdeploy.parameters.json file
You can always deploy a SF cluster through the Azure portal, as explained in this article: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-azure-cluster
However, when creating a cluster, there are quite a few configurations to take into account, like enabling the internal DNS service or Reverse Proxy service, choosing between Linux/Windows, open/publish your application ports in the load-balancer and most of all (the most complex setup) how to create a secure cluster.
Because of those reasons, we have created a set of ARM templates and scripts so you can create, re-create and configure the SF clusters much faster, as explained below:
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\WindowsContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/WindowsContainers), you can find the ARM template `servicefabricdeploy.json` and its parameters file (`servicefabricdeploy.parameters.json`) to create a Service Fabric cluster environment for Windows Containers (NOT SECURED CLUSTER).
## Edit the servicefabricdeploy.parameters.json file
Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
- clusterName: Name of your SF cluster
- clusterLocation: Datacenter location, like westus or westeurope
- computeLocation: Datacenter location, like westus or westeurope
- adminUserName: user-name for VMs administration
- adminPassword: user-password for VMs administration
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
Optionally, you could modify which ports are opened in the LoadBalancer for the multiple eShopOnContainer apps and API services.
By default, they are setup as:
- webMvcHttpPort: 5100
- webSpaHttpPort: 5104
- webStatusHttpPort: 5107
- IdSrvHttpRule: 5105
- BasketApiHttpRule: 5103
- CatalogApiHttpRule: 5101
- OrderingApiHttpRule: 5102
- MarketingApiHttpRule: 5110
- LocationsApiHttpRule: 5109
- webMvcHttpPort: port externally exposed for the WebMVC app
- webSpaHttpPort: port externally exposed for the WebSPA app
- webStatusHttpPort: port externally exposed for the WebStatus app
- IdSrvHttpRule: port externally exposed for the Identity app
## Deploy the template
## Deploy the Service Fabric cluster using the script and ARM templates
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type:
For example, to deploy the cluster to a new resourcegroup located in westus, using the Command Prompt, go to `deploy\az` folder and type:
```
create-resources.cmd servicefabric\WindowsContainers\servicefabricdeploy newResourceGroup -c westus
create-resources.cmd servicefabric\WindowsContainers\servicefabricdeploy qa-eshop-sfwin-resgrp -c westus
```
## Deploy eShopOnServiceFabric with Visual Studio.
Alternatively, instead of using ARM templates, you can deploy eShop on service fabric directly by publishing the project eShopOnServiceFabric in eShopOnContainers-ServicesAndWebApps.sln with Visual Studio publish tool.
You should see a similar execution to the following:
![image](https://user-images.githubusercontent.com/1712635/31638979-4881d7aa-b28b-11e7-873c-e1185043a9eb.png)
Now, if you go to your subscription in Azure, you should be able to see the SF cluster already created and available, like in the following image:
# Deploying Azure Service Fabric (Secured)
![image](https://user-images.githubusercontent.com/1712635/31639043-9b26c786-b28b-11e7-8d59-eeea97f74176.png)
The ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) are used to create a service fabric cluster environment for windows containers secured with a certificate.
In this case, this is an unsecured SF cluster with a single Windows node, good for initial tests and getting started with SF.
## B. Secured cluster (SF Windows cluster)
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\WindowsContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/WindowsContainers), you can find the ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) to create a secured Service Fabric cluster environment for Windows Containers (IN THIS CASE, IT IS A SECURED CLUSTER USING A CERTIFICATE).
## Create Azure Keyvault service
Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
<img src="../../../../img/sf/create-kv.PNG">
![image](https://user-images.githubusercontent.com/1712635/31638848-9b266530-b28a-11e7-953b-1e3ec1a54f77.png)
## Generate a certificate in Azure Keyvault
Execute the gen-keyvaultcert.ps1 script to generate and download a certificate from Keyvault.
In a POWER-SHELL window, move to the folder [..\deploy\az\servicefabric\WindowsContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/WindowsContainers).
**Select your Azure subscription** You might have [several Azure subscriptions](https://docs.microsoft.com/en-us/cli/azure/account#set) as shown if you type the following.
>```
>az account list
>```
If you have multiple subscription accounts, you first need to select the Azure subscription account you want to target. Type the following:
>```
>az account set --subscription "Your Azure Subscription Name or ID"
>```
**Execute the gen-keyvaultcert.ps1 script** to generate and download a certificate from Keyvault.
Make sure you're going to run it against the Azure subscription you mean it.
You might need to authenticate from the browser when running this PowerShell script.
```
.\gen-keyvaultcert.ps1 -vaultName <your_keyvault_service> -certName <your_cert_name> -certPwd <your_cert_pwd> -subjectName CN=<your_sf_dns_name>.westeurope.cloudapp.azure.com -saveDir C:\Users\<user>\Downloads
.\gen-keyvaultcert.ps1 -vaultName <your_keyvault_service> -certName <your_cert_name> -certPwd <your_cert_pwd> -subjectName CN=<your_sf_dns_name>.westus.cloudapp.azure.com -saveDir C:\Users\<your-user>\Downloads
```
You should see a similar execution to the following:
![image](https://user-images.githubusercontent.com/1712635/31640172-93efcca0-b291-11e7-970e-5b5e6bf07042.png)
IMPORTANT: At this point, copy/cut the .PFX certificate file saved in the downloads forlder and save it in a secure place.
## Install the certificate
Install the certificate under 'Current User' store location and check it as exportable.
Install the certificate (by double-clicking on the .PFX file) under 'Current User' store location (by default location) and check it as exportable.
<img src="../../../../img/sf/install-cert.PNG">
Also, install the same certificate as CA (Certificate Authority) under Current User, too.
![image](https://user-images.githubusercontent.com/1712635/31642795-c6ffa434-b2a1-11e7-8ff8-2a63549a780e.png)
## Editing servicefabricdeploysecured.parameters.json file
Edit the following params in `servicefabricdeploysecured.parameters.json` file to set your values:
Edit the parameters in `servicefabricdeploysecured.parameters.json` in a similar way you can do with the unsecured .json file shown above (clusterName, dnsName, etc.), plus edit the following values:
- clusterName: Name of your SF cluster
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
- sourceVaultValue: keyvault resource id (check azure keyvault properties)
- certificateUrlValue: certificate url (check azure Keyvault certificate properties)
- certificateThumbprint: certificate thumbprint (check azure Keyvault certificate properties)
- sourceVaultValue: Your Azure Keyvault's RESOURCE ID (check Azure keyvault properties, similar to: /subscriptions/e1234ac1-c09c-3jaf-6767-98b3c5f1f246/resourceGroups/eshop-global-resgrp/providers/Microsoft.KeyVault/vaults/eshopkeyvault")
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
- certificateUrlValue: Your certificate Secret Identifier (check Azure Keyvault secret certificate properties, should be in the format of https://<name of the vault>.vault.azure.net:443/secrets/<exact location>, similar to:
https://eshopkeyvault.vault.azure.net/secrets/pro-eshop-sfwin-cluster-cert/w647684642cGE2sj83b3hfe4h8e08963)
- webMvcHttpPort: port externally exposed for the WebMVC app
- webSpaHttpPort: port externally exposed for the WebSPA app
- webStatusHttpPort: port externally exposed for the WebStatus app
- IdSrvHttpRule: port externally exposed for the Identity app
- certificateThumbprint: certificate thumbprint (check azure Keyvault certificate thumbprint, something like 88JK453486D55A6818573G0DW9100365HDK70HDK)
## Deploy the template
## Deploy the secured SF cluster (Windows nodes)
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
Once parameters file is edited you can deploy it using [create-resources script](../readme.md).
Use a command prompt window positioned into the deploy\az folder.
```
create-resources.cmd servicefabric\WindowsContainers\servicefabricdeploysecured newResourceGroup -c westus
create-resources.cmd servicefabric\WindowsContainers\servicefabricdeploysecured pro-eshop-sfwin-resgrp -c westus
```
## Deploy eShopOnServiceFabric with Visual Studio.
The execution should be something like the following:
![image](https://user-images.githubusercontent.com/1712635/31641955-0bc9d59e-b29d-11e7-9230-5ba02843d98a.png)
Once the cluster is created you can explore it with Azure's portal, like in the following image:
![image](https://user-images.githubusercontent.com/1712635/31642431-bf1c409e-b29f-11e7-980f-a7685a45108c.png)
In this case, the ARM template is creating a 5 node cluster when creating a SECURE cluster for "production".
# Deploy eShopOnServiceFabric with Visual Studio.
Modify the cloud.xml file of each Service Fabric application in PublishProfile directory and set your certificate settings to be able to deploy eshopOnContainers in the secured cluster:


+ 7
- 7
deploy/az/servicefabric/WindowsContainers/servicefabricdeploy.parameters.json View File

@ -3,19 +3,19 @@
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"value": "eshoponservicefabric"
"value": "qa-eshop-sfwin-cluster"
},
"clusterLocation": {
"value": "westeurope"
"value": "westus"
},
"computeLocation": {
"value": "westeurope"
"value": "westus"
},
"adminUserName": {
"value": "eshop"
},
"adminPassword": {
"value": "your_password"
"value": "Your_complex_Pass@word1"
},
"nicName": {
"value": "NIC-eshopsfwin"
@ -24,7 +24,7 @@
"value": "eshopsfwin-PubIP"
},
"dnsName": {
"value": "eshoponservicefabric"
"value": "qa-eshop-sfwin-cluster"
},
"virtualNetworkName": {
"value": "VNet-eshopsfwin"
@ -36,10 +36,10 @@
"value": "LBIP-eshopsfwin"
},
"applicationDiagnosticsStorageAccountName": {
"value": "sfdgeshopsfwin6744"
"value": "sfdgqaeshopsfwin"
},
"supportLogStorageAccountName": {
"value": "sflogseshopsfwin3480"
"value": "sflogsqaeshopsfwin"
},
"vmImageSku": {
"value": "2016-Datacenter-with-Containers"


+ 10
- 10
deploy/az/servicefabric/WindowsContainers/servicefabricdeploysecured.parameters.json View File

@ -3,19 +3,19 @@
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"value": "your_sf_name"
"value": "pro-eshop-sfwin-cluster"
},
"clusterLocation": {
"value": "westeurope"
"value": "westus"
},
"computeLocation": {
"value": "westeurope"
"value": "westus"
},
"adminUserName": {
"value": "eshop"
},
"adminPassword": {
"value": "your_admin_password"
"value": "Your_complex_Pass@word1"
},
"nicName": {
"value": "NIC-eshopsfwin"
@ -24,7 +24,7 @@
"value": "eshopsfwin-PubIP"
},
"dnsName": {
"value": "your_sf_dns"
"value": "pro-eshop-sfwin-cluster"
},
"virtualNetworkName": {
"value": "VNet-eshopsfwin"
@ -36,19 +36,19 @@
"value": "LBIP-eshopsfwin"
},
"applicationDiagnosticsStorageAccountName": {
"value": "sfdgeshopsfwin6744"
"value": "sfdgqaeshopsfwinsec"
},
"supportLogStorageAccountName": {
"value": "sflogseshopsfwin3480"
"value": "sflogsqaeshopsfwinsec"
},
"sourceVaultValue": {
"value": ""
"value": "your-value-check-keyvault-at-azure"
},
"certificateUrlValue": {
"value": ""
"value": "your-value-check-keyvault-at-azure"
},
"certificateThumbprint": {
"value": ""
"value": "your-value-check-keyvault-at-azure"
},
"vmImageSku": {
"value": "2016-Datacenter-with-Containers"


+ 3
- 3
docker-compose.ci.build.yml View File

@ -2,7 +2,7 @@ version: '3'
services:
ci-build:
image: microsoft/aspnetcore-build:2.0
image: microsoft/aspnetcore-build:2.0.2 #Depending on the bug below, you can also try this other SDK image: microsoft/aspnetcore-build:1.0-2.0-2017-10 or microsoft/aspnetcore-build:1.0-2.0
volumes:
- .:/src
- ./cli-linux:/cli-linux
@ -11,8 +11,8 @@ services:
# Next line is using the .sln file to compile all the projects.
# Sometime there is an issue in msbuild exits the process before finishing building the bits: (https://github.com/Microsoft/msbuild/issues/2153)
# Random error: error MSB4017: The build stopped unexpectedly be cause of an unexpected logger failure.
#command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln --verbosity minimal && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish --verbosity minimal"
command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
# NOTE: Using build-bits-linux.sh from Linux build container exits before ending.
command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && pushd /cli-linux && ./build-bits-linux.sh /src"
#command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && pushd /cli-linux && ./build-bits-linux.sh /src"

+ 15
- 0
docker-compose.override.yml View File

@ -21,6 +21,8 @@ services:
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5103:80"
@ -77,6 +79,7 @@ services:
- GracePeriodTime=1
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5102:80"
@ -100,6 +103,7 @@ services:
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5110:80"
@ -144,6 +148,7 @@ services:
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5100:80"
@ -192,6 +197,7 @@ services:
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5109:80"
@ -206,3 +212,12 @@ services:
nosql.data:
ports:
- "27017:27017"
basket.data:
ports:
- "6379:6379"
rabbitmq:
ports:
- "15672:15672"
- "5672:5672"

+ 83
- 26
docker-compose.prod.yml View File

@ -6,13 +6,15 @@ version: '3'
# but values present in the environment vars at runtime will always override those defined inside the .env file
# An external IP or DNS name has to be used when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance.
#
# Set ASPNETCORE_ENVIRONMENT=Development to get errors while testing.
# IMPORTANT: Note that this compose file uses ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP instead of ESHOP_EXTERNAL_DNS_NAME_OR_IP
# Set ASPNETCORE_ENVIRONMENT=Development, instead Production, if you want to show up errors while testing.
#
# You need to start it with the following CLI command:
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
services:
basket.api:
environment:
- ASPNETCORE_ENVIRONMENT=Production
@ -21,7 +23,13 @@ services:
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5103:80"
@ -32,11 +40,15 @@ services:
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5101:80"
@ -45,14 +57,16 @@ services:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:80
- SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104
- XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback
- ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word}
- XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback #localhost do not work for UWP login, so we have to use "external" IP always
- ConnectionString=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word}
- MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110.
- LocationApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5109
- MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
- OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
- UseCustomizationData=True
- OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5105:80"
@ -64,10 +78,15 @@ services:
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- CheckUpdateTime=30000
- GracePeriodTime=1
- GracePeriodTime=1
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5102:80"
@ -79,6 +98,8 @@ services:
- MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data}
- MongoDatabase=MarketingDb
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
@ -87,6 +108,9 @@ services:
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5110:80"
@ -96,15 +120,19 @@ services:
- ASPNETCORE_URLS=http://0.0.0.0:80
- CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101
- OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5110.
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
- MarketingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110
- LocationsUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5109
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5104:80"
@ -115,25 +143,22 @@ services:
- CatalogUrl=http://catalog.api
- OrderingUrl=http://ordering.api
- BasketUrl=http://basket.api
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- MarketingUrl=http://marketing.api #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- LocationsUrl=http://locations.api
- IdentityUrl=http://10.0.75.1:5105
- MarketingUrl=http://marketing.api #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. #Remote: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5100:80"
sql.data:
environment:
- MSSQL_SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
- MSSQL_PID=Developer
ports:
- "5433:1433"
nosql.data:
ports:
- "27017:27017"
webstatus:
environment:
- ASPNETCORE_ENVIRONMENT=Production
@ -144,18 +169,24 @@ services:
- IdentityUrl=http://identity.api/hc
- LocationsUrl=http://locations.api/hc
- MarketingUrl=http://marketing.api/hc
- PaymentUrl=http://payment.api/hc
- mvc=http://webmvc/hc
- spa=http://webspa/hc
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5107:80"
payment.api:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5108
- ASPNETCORE_URLS=http://0.0.0.0:80
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5108:80"
@ -168,6 +199,32 @@ services:
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5109:80"
sql.data:
environment:
- MSSQL_SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
- MSSQL_PID=Developer
ports:
- "5433:1433"
nosql.data:
ports:
- "27017:27017"
basket.data:
ports:
- "6379:6379"
rabbitmq:
ports:
- "5109:80"
- "15672:15672"
- "5672:5672"

+ 0
- 5
docker-compose.yml View File

@ -104,11 +104,6 @@ services:
basket.data:
image: redis
ports:
- "6379:6379"
rabbitmq:
image: rabbitmq:3-management
ports:
- "15672:15672"
- "5672:5672"

+ 1
- 52
eShopOnContainers-ServicesAndWebApps.sln View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.15
VisualStudioVersion = 15.0.27004.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}"
EndProject
@ -79,8 +79,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Health
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.SqlServer", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj", "{4BD76717-3102-4969-8C2C-BAAA3F0263B6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "src\BuildingBlocks\EventBus\EventBus.Tests\EventBus.Tests.csproj", "{4A980AC4-7205-46BF-8CCB-09E44D700FD4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Location", "Location", "{41139F64-4046-4F16-96B7-D941D96FA9C6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Locations.API", "src\Services\Location\Locations.API\Locations.API.csproj", "{E7581357-FC34-474C-B8F5-307EE3CE05EF}"
@ -1029,54 +1027,6 @@ Global
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x64.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x86.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x86.Build.0 = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|ARM.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|iPhone.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|x64.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|x64.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|x86.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.AppStore|x86.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|ARM.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|iPhone.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|x64.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|x64.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|x86.ActiveCfg = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Debug|x86.Build.0 = Debug|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|Any CPU.Build.0 = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|ARM.ActiveCfg = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|ARM.Build.0 = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|iPhone.ActiveCfg = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|iPhone.Build.0 = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x64.ActiveCfg = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x64.Build.0 = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x86.ActiveCfg = Release|Any CPU
{4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x86.Build.0 = Release|Any CPU
{E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@ -1450,7 +1400,6 @@ Global
{1A01AF82-6FCB-464C-B39C-F127AEBD315D} = {022E145D-1593-47EE-9608-8E323D3C63F5}
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{4BD76717-3102-4969-8C2C-BAAA3F0263B6} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{4A980AC4-7205-46BF-8CCB-09E44D700FD4} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{41139F64-4046-4F16-96B7-D941D96FA9C6} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
{E7581357-FC34-474C-B8F5-307EE3CE05EF} = {41139F64-4046-4F16-96B7-D941D96FA9C6}
{88B22DBB-AA8F-4290-A454-2C109352C345} = {DB0EFB20-B024-4E5E-A75C-52143C131D25}


BIN
img/appinsights/create-insights.PNG View File

Before After
Width: 779  |  Height: 416  |  Size: 27 KiB

BIN
img/appinsights/settings-insights.PNG View File

Before After
Width: 817  |  Height: 258  |  Size: 23 KiB

BIN
img/sf/set-instrumentationkey.PNG View File

Before After
Width: 950  |  Height: 401  |  Size: 46 KiB

+ 1
- 0
k8s/conf_local.yml View File

@ -22,6 +22,7 @@ data:
OrderingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;
PaymentBus: rabbitmq
UseAzureServiceBus: "False"
EnableLoadTest: "False"
keystore: keystore-data
GracePeriodManager_GracePeriodTime: "1"
GracePeriodManager_CheckUpdateTime: "15000"


+ 25
- 0
k8s/deployments.yaml View File

@ -42,6 +42,11 @@ spec:
configMapKeyRef:
name: urls
key: IdentityUrl
- name: UseLoadTest
valueFrom:
configMapKeyRef:
name: externalcfg
key: EnableLoadTest
- name: OrchestratorType
value: 'K8S'
ports:
@ -269,6 +274,11 @@ spec:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
- name: UseLoadTest
valueFrom:
configMapKeyRef:
name: externalcfg
key: EnableLoadTest
- name: OrchestratorType
value: 'K8S'
ports:
@ -344,6 +354,11 @@ spec:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
- name: UseLoadTest
valueFrom:
configMapKeyRef:
name: externalcfg
key: EnableLoadTest
- name: OrchestratorType
value: 'K8S'
ports:
@ -429,6 +444,11 @@ spec:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
- name: UseLoadTest
valueFrom:
configMapKeyRef:
name: externalcfg
key: EnableLoadTest
- name: OrchestratorType
value: 'K8S'
ports:
@ -601,6 +621,11 @@ spec:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
- name: UseLoadTest
valueFrom:
configMapKeyRef:
name: externalcfg
key: EnableLoadTest
- name: OrchestratorType
value: 'K8S'
ports:


+ 1
- 1
src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj View File

@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="1.1.2" />
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.4" />
</ItemGroup>
</Project>

+ 4
- 2
src/BuildingBlocks/DataProtection/DataProtection/DataProtectionBuilderExtensions.cs View File

@ -4,6 +4,7 @@
using Microsoft.AspNetCore.DataProtection.Repositories;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using StackExchange.Redis;
using System;
using System.Linq;
using System.Net;
@ -45,10 +46,11 @@
throw new ArgumentException("Redis connection string may not be empty.", nameof(redisConnectionString));
}
var ips = Dns.GetHostAddressesAsync(redisConnectionString).Result;
var configuration = ConfigurationOptions.Parse(redisConnectionString, true);
configuration.ResolveDns = true;
return builder.Use(ServiceDescriptor.Singleton<IXmlRepository>(services =>
new RedisXmlRepository(ips.First().ToString(), services.GetRequiredService<ILogger<RedisXmlRepository>>())));
new RedisXmlRepository(configuration, services.GetRequiredService<ILogger<RedisXmlRepository>>())));
}
/// <summary>


+ 1
- 1
src/BuildingBlocks/DataProtection/DataProtection/RedisXmlRepository.cs View File

@ -65,7 +65,7 @@
/// <exception cref="System.ArgumentNullException">
/// Thrown if <paramref name="connectionString" /> or <paramref name="logger" /> is <see langword="null" />.
/// </exception>
public RedisXmlRepository(string connectionString, ILogger<RedisXmlRepository> logger)
public RedisXmlRepository(ConfigurationOptions connectionString, ILogger<RedisXmlRepository> logger)
: this(ConnectionMultiplexer.Connect(connectionString), logger)
{
}


+ 1
- 0
src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj View File

@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Polly" Version="5.3.1" />


+ 22
- 3
src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs View File

@ -10,6 +10,7 @@ using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
@ -24,13 +25,15 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
private readonly ILogger<ResilientHttpClient> _logger;
private readonly Func<string, IEnumerable<Policy>> _policyCreator;
private ConcurrentDictionary<string, PolicyWrap> _policyWrappers;
private readonly IHttpContextAccessor _httpContextAccessor;
public ResilientHttpClient(Func<string, IEnumerable<Policy>> policyCreator, ILogger<ResilientHttpClient> logger)
public ResilientHttpClient(Func<string, IEnumerable<Policy>> policyCreator, ILogger<ResilientHttpClient> logger, IHttpContextAccessor httpContextAccessor)
{
_client = new HttpClient();
_logger = logger;
_policyCreator = policyCreator;
_policyWrappers = new ConcurrentDictionary<string, PolicyWrap>();
_httpContextAccessor = httpContextAccessor;
}
@ -52,10 +55,12 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
var requestMessage = new HttpRequestMessage(HttpMethod.Delete, uri);
SetAuthorizationHeader(requestMessage);
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
}
}
if (requestId != null)
{
@ -65,6 +70,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
return await _client.SendAsync(requestMessage);
});
}
public Task<string> GetStringAsync(string uri, string authorizationToken = null, string authorizationMethod = "Bearer")
{
@ -74,6 +80,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
var requestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
SetAuthorizationHeader(requestMessage);
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
@ -108,6 +116,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
var requestMessage = new HttpRequestMessage(method, uri);
SetAuthorizationHeader(requestMessage);
requestMessage.Content = new StringContent(JsonConvert.SerializeObject(item), System.Text.Encoding.UTF8, "application/json");
if (authorizationToken != null)
@ -162,6 +172,15 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
var origin = $"{url.Scheme}://{url.DnsSafeHost}:{url.Port}";
return origin;
}
}
private void SetAuthorizationHeader(HttpRequestMessage requestMessage)
{
var authorizationHeader = _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
if (!string.IsNullOrEmpty(authorizationHeader))
{
requestMessage.Headers.Add("Authorization", new List<string>() { authorizationHeader });
}
}
}
}

+ 21
- 2
src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs View File

@ -1,6 +1,8 @@
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
@ -12,17 +14,21 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
private HttpClient _client;
private ILogger<StandardHttpClient> _logger;
private readonly IHttpContextAccessor _httpContextAccessor;
public StandardHttpClient(ILogger<StandardHttpClient> logger)
public StandardHttpClient(ILogger<StandardHttpClient> logger, IHttpContextAccessor httpContextAccessor)
{
_client = new HttpClient();
_logger = logger;
_httpContextAccessor = httpContextAccessor;
}
public async Task<string> GetStringAsync(string uri, string authorizationToken = null, string authorizationMethod = "Bearer")
{
var requestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
SetAuthorizationHeader(requestMessage);
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
@ -45,6 +51,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
var requestMessage = new HttpRequestMessage(method, uri);
SetAuthorizationHeader(requestMessage);
requestMessage.Content = new StringContent(JsonConvert.SerializeObject(item), System.Text.Encoding.UTF8, "application/json");
if (authorizationToken != null)
@ -84,6 +92,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
var requestMessage = new HttpRequestMessage(HttpMethod.Delete, uri);
SetAuthorizationHeader(requestMessage);
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
@ -96,6 +106,15 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
return await _client.SendAsync(requestMessage);
}
private void SetAuthorizationHeader(HttpRequestMessage requestMessage)
{
var authorizationHeader = _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
if (!string.IsNullOrEmpty(authorizationHeader))
{
requestMessage.Headers.Add("Authorization", new List<string>() { authorizationHeader });
}
}
}
}

+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs View File

@ -28,7 +28,7 @@ namespace eShopOnContainers.Core.Services.Basket
CustomerBasket basket =
await _requestProvider.GetAsync<CustomerBasket>(uri, token);
ServicesHelper.FixBasketItemPictureUri(basket?.Items);
ServicesHelper.FixBasketItemPictureUri(basket?.Items);
return basket;
}


+ 0
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/IOrderService.cs View File

@ -10,7 +10,6 @@ namespace eShopOnContainers.Core.Services.Order
Task CreateOrderAsync(Models.Orders.Order newOrder, string token);
Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token);
Task<Models.Orders.Order> GetOrderAsync(int orderId, string token);
Task<ObservableCollection<Models.Orders.CardType>> GetCardTypesAsync(string token);
Task<bool> CancelOrderAsync(int orderId, string token);
BasketCheckout MapOrderToBasket(Models.Orders.Order order);
}

+ 3
- 20
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderMockService.cs View File

@ -55,15 +55,8 @@ namespace eShopOnContainers.Core.Services.Order
private static List<OrderItem> MockOrderItems = new List<OrderItem>()
{
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId01, Discount = 15, ProductName = ".NET Bot Blue Sweatshirt (M)", Quantity = 1, UnitPrice = 16.50M, PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png" },
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId03, Discount = 0, ProductName = ".NET Bot Black Sweatshirt (M)", Quantity = 2, UnitPrice = 19.95M, PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_03.png" : "Assets/fake_product_03.png" }
};
private static List<CardType> MockCardTypes = new List<CardType>()
{
new CardType { Id = 1, Name = "Amex" },
new CardType { Id = 2, Name = "Visa" },
new CardType { Id = 3, Name = "MasterCard" },
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId01, Discount = 15, ProductName = ".NET Bot Blue Sweatshirt (M)", Quantity = 1, UnitPrice = 16.50M, PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png" },
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId03, Discount = 0, ProductName = ".NET Bot Black Sweatshirt (M)", Quantity = 2, UnitPrice = 19.95M, PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_03.png" : "Assets/fake_product_03.png" }
};
private static BasketCheckout MockBasketCheckout = new BasketCheckout()
@ -114,19 +107,9 @@ namespace eShopOnContainers.Core.Services.Order
}
}
public async Task<ObservableCollection<CardType>> GetCardTypesAsync(string token)
{
await Task.Delay(500);
if (!string.IsNullOrEmpty(token))
return MockCardTypes.ToObservableCollection();
else
return new ObservableCollection<CardType>();
}
public BasketCheckout MapOrderToBasket(Models.Orders.Order order)
{
return MockBasketCheckout;
return MockBasketCheckout;
}
public Task<bool> CancelOrderAsync(int orderId, string token)


+ 1
- 22
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs View File

@ -34,7 +34,7 @@ namespace eShopOnContainers.Core.Services.Order
await _requestProvider.GetAsync<ObservableCollection<Models.Orders.Order>>(uri, token);
return orders;
}
public async Task<Models.Orders.Order> GetOrderAsync(int orderId, string token)
@ -58,27 +58,6 @@ namespace eShopOnContainers.Core.Services.Order
}
}
public async Task<ObservableCollection<Models.Orders.CardType>> GetCardTypesAsync(string token)
{
try
{
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
builder.Path = "api/v1/orders/cardtypes";
string uri = builder.ToString();
ObservableCollection<Models.Orders.CardType> cardTypes =
await _requestProvider.GetAsync<ObservableCollection<Models.Orders.CardType>>(uri, token);
return cardTypes;
}
catch
{
return new ObservableCollection<Models.Orders.CardType>();
}
}
public BasketCheckout MapOrderToBasket(Models.Orders.Order order)
{
return new BasketCheckout()


+ 0
- 2
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/User/UserService.cs View File

@ -16,7 +16,6 @@ namespace eShopOnContainers.Core.Services.User
public async Task<UserInfo> GetUserInfoAsync(string authToken)
{
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.UserInfoEndpoint);
string uri = builder.ToString();
@ -25,7 +24,6 @@ namespace eShopOnContainers.Core.Services.User
await _requestProvider.GetAsync<UserInfo>(uri, authToken);
return userInfo;
}
}
}

+ 23
- 9
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml View File

@ -65,6 +65,20 @@
Value="True" />
</Style>
<Style x:Key="SettingsEntryStyle"
TargetType="{x:Type Entry}"
BasedOn="{StaticResource EntryStyle}">
<Setter Property="Margin"
Value="12, 0" />
</Style>
<Style x:Key="SettingsUwpEntryStyle"
TargetType="{x:Type Entry}"
BasedOn="{StaticResource UwpEntryStyle}">
<Setter Property="Margin"
Value="12, 0" />
</Style>
<Style x:Key="HeaderLabelStyle"
TargetType="{x:Type Label}">
<Setter Property="FontFamily"
@ -169,9 +183,9 @@
<Entry.Style>
<OnPlatform
x:TypeArguments="Style"
iOS="{StaticResource EntryStyle}"
Android="{StaticResource EntryStyle}"
WinPhone="{StaticResource UwpEntryStyle}"/>
iOS="{StaticResource SettingsEntryStyle}"
Android="{StaticResource SettingsEntryStyle}"
WinPhone="{StaticResource SettingsUwpEntryStyle}"/>
</Entry.Style>
</Entry>
</StackLayout>
@ -226,9 +240,9 @@
<Entry.Style>
<OnPlatform
x:TypeArguments="Style"
iOS="{StaticResource EntryStyle}"
Android="{StaticResource EntryStyle}"
WinPhone="{StaticResource UwpEntryStyle}"/>
iOS="{StaticResource SettingsEntryStyle}"
Android="{StaticResource SettingsEntryStyle}"
WinPhone="{StaticResource SettingsUwpEntryStyle}"/>
</Entry.Style>
</Entry>
<Label
@ -240,9 +254,9 @@
<Entry.Style>
<OnPlatform
x:TypeArguments="Style"
iOS="{StaticResource EntryStyle}"
Android="{StaticResource EntryStyle}"
WinPhone="{StaticResource UwpEntryStyle}"/>
iOS="{StaticResource SettingsEntryStyle}"
Android="{StaticResource SettingsEntryStyle}"
WinPhone="{StaticResource SettingsUwpEntryStyle}"/>
</Entry.Style>
</Entry>
<Button


+ 0
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj View File

@ -161,7 +161,6 @@
<HintPath>..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.ObjectModel" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="Validation, Version=2.2.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL">


+ 79
- 0
src/Services/Basket/Basket.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs View File

@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Basket.API.Infrastructure.Middlewares
{
class ByPassAuthMiddleware
{
private readonly RequestDelegate _next;
private string _currentUserId;
public ByPassAuthMiddleware(RequestDelegate next)
{
_next = next;
_currentUserId = null;
}
public async Task Invoke(HttpContext context)
{
var path = context.Request.Path;
if (path == "/noauth")
{
var userid = context.Request.Query["userid"];
if (!string.IsNullOrEmpty(userid))
{
_currentUserId = userid;
}
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to {_currentUserId}");
}
else if (path == "/noauth/reset")
{
_currentUserId = null;
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints.");
}
else
{
var currentUserId = _currentUserId;
var authHeader = context.Request.Headers["Authorization"];
if (authHeader != StringValues.Empty)
{
var header = authHeader.FirstOrDefault();
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length)
{
currentUserId = header.Substring("Email ".Length);
}
}
if (!string.IsNullOrEmpty(currentUserId))
{
var user = new ClaimsIdentity(new[] {
new Claim("emails", currentUserId),
new Claim("name", "Test user"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
new Claim("sub", "1234"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
, "ByPassAuth");
context.User = new ClaimsPrincipal(user);
}
await _next.Invoke(context);
}
}
}
}

+ 11
- 4
src/Services/Basket/Basket.API/Startup.cs View File

@ -1,6 +1,7 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Basket.API.Infrastructure.Filters;
using Basket.API.Infrastructure.Middlewares;
using Basket.API.IntegrationEvents.EventHandling;
using Basket.API.IntegrationEvents.Events;
using Microsoft.ApplicationInsights.Extensibility;
@ -198,7 +199,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "My API V1");
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Basket.API V1");
c.ConfigureOAuth2("basketswaggerui", "", "", "Basket Swagger UI");
});
@ -209,13 +210,14 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
@ -245,6 +247,11 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
if (Configuration.GetValue<bool>("UseLoadTest"))
{
app.UseMiddleware<ByPassAuthMiddleware>();
}
app.UseAuthentication();
}


+ 4
- 3
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -198,7 +198,7 @@
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Catalog.API V1");
});
ConfigureEventBus(app);
@ -207,13 +207,14 @@
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>


+ 6
- 5
src/Services/Identity/Identity.API/Startup.cs View File

@ -42,7 +42,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name);
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
sqlOptions.EnableRetryOnFailure(maxRetryCount: 15, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
}));
services.AddIdentity<ApplicationUser, IdentityRole>()
@ -91,7 +91,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
sqlOptions.MigrationsAssembly(migrationsAssembly);
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
sqlOptions.EnableRetryOnFailure(maxRetryCount: 15, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
});
})
.AddOperationalStore(options =>
@ -101,7 +101,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
sqlOptions.MigrationsAssembly(migrationsAssembly);
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
sqlOptions.EnableRetryOnFailure(maxRetryCount: 15, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null);
});
})
.Services.AddTransient<IProfileService, ProfileService>();
@ -163,13 +163,14 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>


+ 79
- 0
src/Services/Location/Locations.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs View File

@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Middlewares
{
class ByPassAuthMiddleware
{
private readonly RequestDelegate _next;
private string _currentUserId;
public ByPassAuthMiddleware(RequestDelegate next)
{
_next = next;
_currentUserId = null;
}
public async Task Invoke(HttpContext context)
{
var path = context.Request.Path;
if (path == "/noauth")
{
var userid = context.Request.Query["userid"];
if (!string.IsNullOrEmpty(userid))
{
_currentUserId = userid;
}
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to {_currentUserId}");
}
else if (path == "/noauth/reset")
{
_currentUserId = null;
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints.");
}
else
{
var currentUserId = _currentUserId;
var authHeader = context.Request.Headers["Authorization"];
if (authHeader != StringValues.Empty)
{
var header = authHeader.FirstOrDefault();
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length)
{
currentUserId = header.Substring("Email ".Length);
}
}
if (!string.IsNullOrEmpty(currentUserId))
{
var user = new ClaimsIdentity(new[] {
new Claim("emails", currentUserId),
new Claim("name", "Test user"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("sub", "1234"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
, "ByPassAuth");
context.User = new ClaimsPrincipal(user);
}
await _next.Invoke(context);
}
}
}
}

+ 10
- 3
src/Services/Location/Locations.API/Startup.cs View File

@ -13,6 +13,7 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Middlewares;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories;
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services;
using Microsoft.Extensions.Configuration;
@ -170,7 +171,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "My API V1");
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Locations.API V1");
c.ConfigureOAuth2("locationsswaggerui", "", "", "Locations Swagger UI");
});
@ -181,13 +182,14 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
@ -215,6 +217,11 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
if (Configuration.GetValue<bool>("UseLoadTest"))
{
app.UseMiddleware<ByPassAuthMiddleware>();
}
app.UseAuthentication();
}


+ 79
- 0
src/Services/Marketing/Marketing.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs View File

@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares
{
class ByPassAuthMiddleware
{
private readonly RequestDelegate _next;
private string _currentUserId;
public ByPassAuthMiddleware(RequestDelegate next)
{
_next = next;
_currentUserId = null;
}
public async Task Invoke(HttpContext context)
{
var path = context.Request.Path;
if (path == "/noauth")
{
var userid = context.Request.Query["userid"];
if (!string.IsNullOrEmpty(userid))
{
_currentUserId = userid;
}
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to {_currentUserId}");
}
else if (path == "/noauth/reset")
{
_currentUserId = null;
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints.");
}
else
{
var currentUserId = _currentUserId;
var authHeader = context.Request.Headers["Authorization"];
if (authHeader != StringValues.Empty)
{
var header = authHeader.FirstOrDefault();
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length)
{
currentUserId = header.Substring("Email ".Length);
}
}
if (!string.IsNullOrEmpty(currentUserId))
{
var user = new ClaimsIdentity(new[] {
new Claim("emails", currentUserId),
new Claim("name", "Test user"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("sub", "1234"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
, "ByPassAuth");
context.User = new ClaimsPrincipal(user);
}
await _next.Invoke(context);
}
}
}
}

+ 10
- 3
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -25,6 +25,7 @@
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares;
using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Swagger;
using System;
@ -202,7 +203,7 @@
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "My API V1");
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Marketing.API V1");
c.ConfigureOAuth2("marketingswaggerui", "", "", "Marketing Swagger UI");
});
@ -212,13 +213,14 @@
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
@ -291,6 +293,11 @@
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
if (Configuration.GetValue<bool>("UseLoadTest"))
{
app.UseMiddleware<ByPassAuthMiddleware>();
}
app.UseAuthentication();
}
}


+ 79
- 0
src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/ByPassAuthMiddleware.cs View File

@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Ordering.API.Infrastructure.Middlewares
{
class ByPassAuthMiddleware
{
private readonly RequestDelegate _next;
private string _currentUserId;
public ByPassAuthMiddleware(RequestDelegate next)
{
_next = next;
_currentUserId = null;
}
public async Task Invoke(HttpContext context)
{
var path = context.Request.Path;
if (path == "/noauth")
{
var userid = context.Request.Query["userid"];
if (!string.IsNullOrEmpty(userid))
{
_currentUserId = userid;
}
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to {_currentUserId}");
}
else if (path == "/noauth/reset")
{
_currentUserId = null;
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints.");
}
else
{
var currentUserId = _currentUserId;
var authHeader = context.Request.Headers["Authorization"];
if (authHeader != StringValues.Empty)
{
var header = authHeader.FirstOrDefault();
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length)
{
currentUserId = header.Substring("Email ".Length);
}
}
if (!string.IsNullOrEmpty(currentUserId))
{
var user = new ClaimsIdentity(new[] {
new Claim("emails", currentUserId),
new Claim("name", "Test user"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("sub", "1234"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
, "ByPassAuth");
context.User = new ClaimsPrincipal(user);
}
await _next.Invoke(context);
}
}
}
}

+ 10
- 3
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -7,6 +7,7 @@
using global::Ordering.API.Application.IntegrationEvents.Events;
using global::Ordering.API.Infrastructure.Filters;
using global::Ordering.API.Infrastructure.HostedServices;
using global::Ordering.API.Infrastructure.Middlewares;
using Infrastructure.AutofacModules;
using Infrastructure.Filters;
using Infrastructure.Services;
@ -224,7 +225,7 @@
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "My API V1");
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Ordering.API V1");
c.ConfigureOAuth2("orderingswaggerui", "", "", "Ordering Swagger UI");
});
@ -234,13 +235,14 @@
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
@ -282,6 +284,11 @@
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
if (Configuration.GetValue<bool>("UseLoadTest"))
{
app.UseMiddleware<ByPassAuthMiddleware>();
}
app.UseAuthentication();
}


+ 3
- 2
src/Services/Payment/Payment.API/Startup.cs View File

@ -110,13 +110,14 @@ namespace Payment.API
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>


+ 80
- 0
src/Web/WebMVC/Infrastructure/Middlewares/ByPassAuthMiddleware.cs View File

@ -0,0 +1,80 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace WebMVC.Infrastructure.Middlewares
{
class ByPassAuthMiddleware
{
private readonly RequestDelegate _next;
private string _currentUserId;
public ByPassAuthMiddleware(RequestDelegate next)
{
_next = next;
_currentUserId = null;
}
public async Task Invoke(HttpContext context)
{
var path = context.Request.Path;
if (path == "/noauth")
{
var userid = context.Request.Query["userid"];
if (!string.IsNullOrEmpty(userid))
{
_currentUserId = userid;
}
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to {_currentUserId}");
}
else if (path == "/noauth/reset")
{
_currentUserId = null;
context.Response.StatusCode = 200;
context.Response.ContentType = "text/string";
await context.Response.WriteAsync($"User set to none. Token required for protected endpoints.");
}
else
{
var currentUserId = _currentUserId;
var authHeader = context.Request.Headers["Authorization"];
if (authHeader != StringValues.Empty)
{
var header = authHeader.FirstOrDefault();
if (!string.IsNullOrEmpty(header) && header.StartsWith("Email ") && header.Length > "Email ".Length)
{
currentUserId = header.Substring("Email ".Length);
}
}
if (!string.IsNullOrEmpty(currentUserId))
{
var user = new ClaimsIdentity(new[] {
new Claim("emails", currentUserId),
new Claim("name", "Test user"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("ttp://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"),
new Claim("nonce", Guid.NewGuid().ToString()),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"),
new Claim("sub", "1234"),
new Claim("card_expiration", "12/20"),
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname","Microsoft")}
, "ByPassAuth");
context.User = new ClaimsPrincipal(user);
}
await _next.Invoke(context);
}
}
}
}

+ 6
- 3
src/Web/WebMVC/Infrastructure/ResilientHttpClientFactory.cs View File

@ -1,4 +1,5 @@
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Polly;
using System;
@ -11,17 +12,19 @@ namespace Microsoft.eShopOnContainers.WebMVC.Infrastructure
private readonly ILogger<ResilientHttpClient> _logger;
private readonly int _retryCount;
private readonly int _exceptionsAllowedBeforeBreaking;
private readonly IHttpContextAccessor _httpContextAccessor;
public ResilientHttpClientFactory(ILogger<ResilientHttpClient> logger, int exceptionsAllowedBeforeBreaking = 5, int retryCount = 6)
public ResilientHttpClientFactory(ILogger<ResilientHttpClient> logger, IHttpContextAccessor httpContextAccessor, int exceptionsAllowedBeforeBreaking = 5, int retryCount = 6)
{
_logger = logger;
_exceptionsAllowedBeforeBreaking = exceptionsAllowedBeforeBreaking;
_retryCount = retryCount;
_httpContextAccessor = httpContextAccessor;
}
public ResilientHttpClient CreateResilientHttpClient()
=> new ResilientHttpClient((origin) => CreatePolicies(), _logger);
=> new ResilientHttpClient((origin) => CreatePolicies(), _logger, _httpContextAccessor);
private Policy[] CreatePolicies()
=> new Policy[]


+ 11
- 3
src/Web/WebMVC/Startup.cs View File

@ -17,6 +17,7 @@ using Microsoft.Extensions.Logging;
using System;
using System.IdentityModel.Tokens.Jwt;
using WebMVC.Infrastructure;
using WebMVC.Infrastructure.Middlewares;
using WebMVC.Services;
namespace Microsoft.eShopOnContainers.WebMVC
@ -78,6 +79,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
services.AddSingleton<IResilientHttpClientFactory, ResilientHttpClientFactory>(sp =>
{
var logger = sp.GetRequiredService<ILogger<ResilientHttpClient>>();
var httpContextAccessor = sp.GetRequiredService<IHttpContextAccessor>();
var retryCount = 6;
if (!string.IsNullOrEmpty(Configuration["HttpClientRetryCount"]))
@ -91,7 +93,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
exceptionsAllowedBeforeBreaking = int.Parse(Configuration["HttpClientExceptionsAllowedBeforeBreaking"]);
}
return new ResilientHttpClientFactory(logger, exceptionsAllowedBeforeBreaking, retryCount);
return new ResilientHttpClientFactory(logger, httpContextAccessor, exceptionsAllowedBeforeBreaking, retryCount);
});
services.AddSingleton<IHttpClient, ResilientHttpClient>(sp => sp.GetService<IResilientHttpClientFactory>().CreateResilientHttpClient());
}
@ -159,6 +161,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
app.UseSession();
app.UseStaticFiles();
if (Configuration.GetValue<bool>("UseLoadTest"))
{
app.UseMiddleware<ByPassAuthMiddleware>();
}
app.UseAuthentication();
var log = loggerFactory.CreateLogger("identity");
@ -180,13 +187,14 @@ namespace Microsoft.eShopOnContainers.WebMVC
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>


+ 3
- 2
src/Web/WebSPA/Startup.cs View File

@ -134,13 +134,14 @@ namespace eShopConContainers.WebSPA
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>


+ 3
- 2
src/Web/WebStatus/Startup.cs View File

@ -87,13 +87,14 @@ namespace WebStatus
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
var orchestratorType = Configuration.GetValue<string>("OrchestratorType");
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
if (orchestratorType?.ToUpper() == "K8S")
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
if (orchestratorType?.ToUpper() == "SF")
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>


+ 0
- 1
src/Web/WebStatus/Views/Shared/_Layout.cshtml View File

@ -53,7 +53,6 @@
<environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"


+ 4
- 5
test/Services/FunctionalTests/FunctionalTests.csproj View File

@ -18,10 +18,6 @@
<None Remove="Services\Marketing\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Services\Catalog\settings.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="Services\Location\LocationsScenariosBase.cs" />
<Compile Include="Services\Location\LocationsTestsStartup.cs" />
@ -33,7 +29,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="Services\Catalog\settings.json">
<Content Include="Services\Basket\appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Services\Catalog\appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Services\Location\appsettings.json">


+ 5
- 3
test/Services/FunctionalTests/Services/Basket/BasketScenariosBase.cs View File

@ -1,7 +1,9 @@
namespace FunctionalTests.Services.Basket
{
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using System.IO;
public class BasketScenariosBase
@ -10,10 +12,10 @@
public TestServer CreateServer()
{
var webHostBuilder = new WebHostBuilder();
webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory());
var webHostBuilder = WebHost.CreateDefaultBuilder();
webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Basket");
webHostBuilder.UseStartup<BasketTestsStartup>();
return new TestServer(webHostBuilder);
}


+ 16
- 0
test/Services/FunctionalTests/Services/Basket/appsettings.json View File

@ -0,0 +1,16 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"IdentityUrl": "http://localhost:5105",
"ConnectionString": "127.0.0.1",
"isTest": "true",
"EventBusConnection": "localhost"
}

+ 4
- 2
test/Services/FunctionalTests/Services/Catalog/CatalogScenariosBase.cs View File

@ -1,7 +1,9 @@
using FunctionalTests.Middleware;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.eShopOnContainers.Services.Catalog.API;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
@ -13,10 +15,10 @@ namespace FunctionalTests.Services.Catalog
{
public TestServer CreateServer()
{
var webHostBuilder = new WebHostBuilder();
var webHostBuilder = WebHost.CreateDefaultBuilder();
webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Catalog");
webHostBuilder.UseStartup<Startup>();
return new TestServer(webHostBuilder);
}


test/Services/FunctionalTests/Services/Catalog/settings.json → test/Services/FunctionalTests/Services/Catalog/appsettings.json View File

@ -3,5 +3,6 @@
"ExternalCatalogBaseUrl": "http://localhost:5101",
"IdentityUrl": "http://localhost:5105",
"isTest": "true",
"EventBusConnection": "localhost"
"EventBusConnection": "localhost",
"PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/"
}

+ 4
- 2
test/Services/FunctionalTests/Services/Location/LocationsScenariosBase.cs View File

@ -1,7 +1,9 @@
namespace FunctionalTests.Services.Locations
{
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
@ -9,10 +11,10 @@
{
public TestServer CreateServer()
{
var webHostBuilder = new WebHostBuilder();
var webHostBuilder = WebHost.CreateDefaultBuilder();
webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Location");
webHostBuilder.UseStartup<LocationsTestsStartup>();
return new TestServer(webHostBuilder);
}


+ 7
- 7
test/Services/FunctionalTests/Services/Marketing/MarketingScenarios.cs View File

@ -24,7 +24,7 @@
var location = new LocationRequest
{
Longitude = -122.315752,
Latitude = 47.604610
Latitude = 47.60461
};
var content = new StringContent(JsonConvert.SerializeObject(location),
Encoding.UTF8, "application/json");
@ -35,14 +35,14 @@
await Task.Delay(300);
//Get campaing from Marketing.API given a userId
var userLocationCampaignResponse = await marketingServer.CreateClient()
.GetAsync(CampaignScenariosBase.Get.UserCampaignsByUserId());
//Get campaing from Marketing.API
var campaignsResponse = await marketingServer.CreateClient()
.GetAsync(CampaignScenariosBase.Get.Campaigns);
var responseBody = await userLocationCampaignResponse.Content.ReadAsStringAsync();
var userLocationCampaigns = JsonConvert.DeserializeObject<PaginatedItemsViewModel<CampaignDTO>>(responseBody);
var responseBody = await campaignsResponse.Content.ReadAsStringAsync();
var campaigns = JsonConvert.DeserializeObject<List<CampaignDTO>>(responseBody);
Assert.True(userLocationCampaigns.Count > 0);
Assert.True(campaigns.Count > 0);
}
}
}


+ 4
- 2
test/Services/FunctionalTests/Services/Marketing/MarketingScenariosBase.cs View File

@ -1,7 +1,9 @@
namespace FunctionalTests.Services.Marketing
{
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using System.IO;
public class MarketingScenariosBase
@ -10,9 +12,9 @@
public TestServer CreateServer()
{
var webHostBuilder = new WebHostBuilder();
var webHostBuilder = WebHost.CreateDefaultBuilder();
webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Marketing");
webHostBuilder.UseStartup<MarketingTestsStartup>();
webHostBuilder.UseStartup<MarketingTestsStartup>();
return new TestServer(webHostBuilder);
}


+ 2
- 1
test/Services/FunctionalTests/Services/Marketing/appsettings.json View File

@ -6,5 +6,6 @@
"isTest": "true",
"EventBusConnection": "localhost",
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Marketing"
"SubscriptionClientName": "Marketing",
"PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/"
}

+ 3
- 2
test/Services/FunctionalTests/Services/Ordering/OrderingScenarios.cs View File

@ -121,10 +121,10 @@ namespace FunctionalTests.Services.Ordering
State = "state",
Country = "coutry",
ZipCode = "zipcode",
CardNumber = "CardNumber",
CardNumber = "1111111111111",
CardHolderName = "CardHolderName",
CardExpiration = DateTime.Now.AddYears(1),
CardSecurityNumber = "1234",
CardSecurityNumber = "123",
CardTypeId = 1,
Buyer = "Buyer",
RequestId = Guid.NewGuid()
@ -134,3 +134,4 @@ namespace FunctionalTests.Services.Ordering
}
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save