Browse Source

Merge pull request #566 from dotnet-architecture/revert-565-xamarin-settings

Revert "Simplified the SettingsService in the mobile client."
pull/569/head
David Britch 6 years ago
committed by GitHub
parent
commit
0742f941fb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
156 changed files with 2379 additions and 5859 deletions
  1. +0
    -2
      .dockerignore
  2. +0
    -1
      .gitignore
  3. +0
    -1
      docker-compose.dcproj
  4. +28
    -61
      docker-compose.override.yml
  5. +6
    -7
      docker-compose.prod.yml
  6. +10
    -38
      docker-compose.yml
  7. +51
    -183
      eShopOnContainers-ServicesAndWebApps.sln
  8. +7
    -7
      k8s/conf_cloud.yml
  9. +21
    -16
      k8s/conf_local.yml
  10. +37
    -37
      k8s/deploy.ps1
  11. +282
    -228
      k8s/deployments.yaml
  12. +47
    -0
      k8s/frontend.yaml
  13. +7
    -5
      k8s/gen-k8s-env-aks.ps1
  14. +19
    -23
      k8s/ingress.yaml
  15. +0
    -31
      k8s/internalurls.yaml
  16. +0
    -34
      k8s/ocelot/configuration-mobile-marketing.json
  17. +0
    -142
      k8s/ocelot/configuration-mobile-shopping.json
  18. +0
    -34
      k8s/ocelot/configuration-web-marketing.json
  19. +0
    -142
      k8s/ocelot/configuration-web-shopping.json
  20. +0
    -155
      k8s/ocelot/deployment.yaml
  21. +0
    -55
      k8s/ocelot/service.yaml
  22. +0
    -28
      k8s/services.yaml
  23. +0
    -20
      src/ApiGateways/ApiGw-Base/Dockerfile
  24. +0
    -20
      src/ApiGateways/ApiGw-Base/Dockerfile2
  25. +0
    -20
      src/ApiGateways/ApiGw-Base/Dockerfile3
  26. +0
    -20
      src/ApiGateways/ApiGw-Base/Dockerfile4
  27. +0
    -16
      src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj
  28. +0
    -31
      src/ApiGateways/ApiGw-Base/Program.cs
  29. +0
    -27
      src/ApiGateways/ApiGw-Base/Properties/launchSettings.json
  30. +0
    -91
      src/ApiGateways/ApiGw-Base/Startup.cs
  31. +0
    -10
      src/ApiGateways/ApiGw-Base/appsettings.json
  32. +0
    -34
      src/ApiGateways/Mobile.Bff.Marketing/apigw/configuration.json
  33. +0
    -31
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs
  34. +0
    -133
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/BasketController.cs
  35. +0
    -18
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/HomeController.cs
  36. +0
    -42
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/OrderController.cs
  37. +0
    -19
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile
  38. +0
    -33
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs
  39. +0
    -27
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj
  40. +0
    -20
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs
  41. +0
    -31
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs
  42. +0
    -20
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/CatalogItem.cs
  43. +0
    -33
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs
  44. +0
    -17
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs
  45. +0
    -31
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs
  46. +0
    -21
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs
  47. +0
    -36
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs
  48. +0
    -29
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Properties/launchSettings.json
  49. +0
    -53
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs
  50. +0
    -43
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs
  51. +0
    -15
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IBasketService.cs
  52. +0
    -14
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/ICatalogService.cs
  53. +0
    -13
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IOrderApiClient.cs
  54. +0
    -37
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderApiClient.cs
  55. +0
    -138
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs
  56. +0
    -15
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/appsettings.json
  57. +0
    -8
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/appsettings.localhost.json
  58. +0
    -142
      src/ApiGateways/Mobile.Bff.Shopping/apigw/configuration.json
  59. +0
    -34
      src/ApiGateways/Web.Bff.Marketing/apigw/configuration.json
  60. +0
    -31
      src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs
  61. +0
    -133
      src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs
  62. +0
    -18
      src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/HomeController.cs
  63. +0
    -42
      src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs
  64. +0
    -18
      src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile
  65. +0
    -33
      src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs
  66. +0
    -20
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs
  67. +0
    -31
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs
  68. +0
    -20
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs
  69. +0
    -33
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderData.cs
  70. +0
    -17
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderItemData.cs
  71. +0
    -31
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs
  72. +0
    -21
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs
  73. +0
    -36
      src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs
  74. +0
    -29
      src/ApiGateways/Web.Bff.Shopping/aggregator/Properties/launchSettings.json
  75. +0
    -53
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs
  76. +0
    -43
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs
  77. +0
    -15
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IBasketService.cs
  78. +0
    -14
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/ICatalogService.cs
  79. +0
    -13
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IOrderApiClient.cs
  80. +0
    -37
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs
  81. +0
    -138
      src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs
  82. +0
    -27
      src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj
  83. +0
    -15
      src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.json
  84. +0
    -8
      src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.localhost.json
  85. +0
    -142
      src/ApiGateways/Web.Bff.Shopping/apigw/configuration.json
  86. +0
    -5
      src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs
  87. +0
    -5
      src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs
  88. +1
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Extensions/ObservableExtension.cs
  89. +23
    -12
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/GlobalSettings.cs
  90. +7
    -15
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs
  91. +8
    -10
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs
  92. +2
    -2
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs
  93. +4
    -6
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Marketing/CampaignService.cs
  94. +6
    -8
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs
  95. +1
    -8
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Settings/ISettingsService.cs
  96. +13
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Settings/ISettingsServiceImplementation.cs
  97. +29
    -80
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Settings/SettingsService.cs
  98. +21
    -7
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml
  99. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Extensions/LocationExtensions.cs
  100. +149
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Services/SettingsServiceImplementation.cs

+ 0
- 2
.dockerignore View File

@ -13,7 +13,6 @@ hosts
LICENSE LICENSE
*.testsettings *.testsettings
vsts-docs vsts-docs
test
ServiceFabric ServiceFabric
readme readme
k8s k8s
@ -30,5 +29,4 @@ cli-linux
**/bower_components/ **/bower_components/
**/wwwroot/lib/ **/wwwroot/lib/
global.json global.json
**/appsettings.localhost.json
src/Web/WebSPA/wwwroot/ src/Web/WebSPA/wwwroot/

+ 0
- 1
.gitignore View File

@ -260,4 +260,3 @@ pub/
/src/Web/WebMVC/wwwroot/lib /src/Web/WebMVC/wwwroot/lib
/src/Web/WebMVC/wwwroot/css/site.min.css /src/Web/WebMVC/wwwroot/css/site.min.css
**/.kube/** **/.kube/**
.mfractor

+ 0
- 1
docker-compose.dcproj View File

@ -7,7 +7,6 @@
<DockerServiceName>webmvc</DockerServiceName> <DockerServiceName>webmvc</DockerServiceName>
<DockerTargetOS>Linux</DockerTargetOS> <DockerTargetOS>Linux</DockerTargetOS>
<ProjectVersion>2.1</ProjectVersion> <ProjectVersion>2.1</ProjectVersion>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include=".dockerignore" /> <None Include=".dockerignore" />


+ 28
- 61
docker-compose.override.yml View File

@ -57,8 +57,6 @@ services:
- MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 - MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
- OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
- MobileShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
- WebShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5121
- UseCustomizationData=True - UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE} - OrchestratorType=${ORCHESTRATOR_TYPE}
@ -85,6 +83,24 @@ services:
ports: ports:
- "5102:80" - "5102:80"
ordering.backgroundtasks:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word}
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- CheckUpdateTime=30000
- GracePeriodTime=1
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5111:80"
marketing.api: marketing.api:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
@ -113,9 +129,12 @@ services:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- CatalogUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101
- OrderingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
- IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- PurchaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202
- MarketingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5203
- BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
- MarketingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
- LocationsUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5109
- CatalogUrlHC=http://catalog.api/hc - CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.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. - IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
@ -132,9 +151,12 @@ services:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- PurchaseUrl=http://webshoppingapigw
- CatalogUrl=http://catalog.api
- OrderingUrl=http://ordering.api
- BasketUrl=http://basket.api
- LocationsUrl=http://locations.api
- IdentityUrl=http://10.0.75.1:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. - IdentityUrl=http://10.0.75.1:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- MarketingUrl=http://webmarketingapigw
- MarketingUrl=http://marketing.api
- CatalogUrlHC=http://catalog.api/hc - CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.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. - IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
@ -217,58 +239,3 @@ services:
- "15672:15672" - "15672:15672"
- "5672:5672" - "5672:5672"
mobileshoppingapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5200:80"
volumes:
- ./src/ApiGateways/Mobile.Bff.Shopping/apigw:/app/configuration
mobilemarketingapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5201:80"
volumes:
- ./src/ApiGateways/Mobile.Bff.Marketing/apigw:/app/configuration
webshoppingapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5202:80"
volumes:
- ./src/ApiGateways/Web.Bff.Shopping/apigw:/app/configuration
webmarketingapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5203:80"
volumes:
- ./src/ApiGateways/Web.Bff.Marketing/apigw:/app/configuration
mobileshoppingagg:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- urls__basket=http://basket.api
- urls__catalog=http://catalog.api
- urls__orders=http://ordering.api
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5120:80"
webshoppingagg:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- urls__basket=http://basket.api
- urls__catalog=http://catalog.api
- urls__orders=http://ordering.api
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5121:80"

+ 6
- 7
docker-compose.prod.yml View File

@ -64,8 +64,6 @@ services:
- MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110 - MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 - BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
- OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 - OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
- MobileShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
- WebShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
- UseCustomizationData=True - UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE} - OrchestratorType=${ORCHESTRATOR_TYPE}
@ -158,16 +156,17 @@ services:
webmvc: webmvc:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- PurchaseUrl=http://webshoppingapigw/shopping
- CatalogUrl=http://catalog.api
- OrderingUrl=http://ordering.api
- BasketUrl=http://basket.api
- LocationsUrl=http://locations.api - LocationsUrl=http://locations.api
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- MarketingUrl=http://marketing.api
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #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.
- MarketingUrl=http://marketing.api
- CatalogUrlHC=http://catalog.api/hc - CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.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.
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc - BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc - MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc - PaymentUrlHC=http://payment.api/hc


+ 10
- 38
docker-compose.yml View File

@ -38,6 +38,15 @@ services:
- sql.data - sql.data
- rabbitmq - rabbitmq
ordering.backgroundtasks:
image: eshop/ordering.backgroundtasks:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile
depends_on:
- sql.data
- rabbitmq
marketing.api: marketing.api:
image: eshop/marketing.api:${TAG:-latest} image: eshop/marketing.api:${TAG:-latest}
build: build:
@ -106,41 +115,4 @@ services:
image: redis:alpine image: redis:alpine
rabbitmq: rabbitmq:
image: rabbitmq:3-management-alpine
mobileshoppingapigw:
image: eshop/ocelotapigw-ms:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
mobilemarketingapigw:
image: eshop/ocelotapigw-mm:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile2
webshoppingapigw:
image: eshop/ocelotapigw-ws:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile3
webmarketingapigw:
image: eshop/ocelotapigw-wm:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
mobileshoppingagg:
image: eshop/mobileshoppingagg:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile
webshoppingagg:
image: eshop/webshoppingagg:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile
image: rabbitmq:3-management-alpine

+ 51
- 183
eShopOnContainers-ServicesAndWebApps.sln View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}"
EndProject EndProject
@ -97,35 +97,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{1815
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{15F4B3AA-89B6-4A0D-9051-414305974781}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{15F4B3AA-89B6-4A0D-9051-414305974781}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiGateways", "ApiGateways", "{77849D35-37D4-4802-81DC-9477B2775A40}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiGw-Base", "ApiGw-Base", "{EC91ADE9-3D66-4AB2-9FB4-2B585E1F3531}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mobile.Bff.Marketing", "Mobile.Bff.Marketing", "{DB813A36-11BA-41FE-B258-CA9A7152247B}"
ProjectSection(SolutionItems) = preProject
src\ApiGateways\Mobile.Bff.Marketing\apigw\configuration.json = src\ApiGateways\Mobile.Bff.Marketing\apigw\configuration.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mobile.Bff.Shopping", "Mobile.Bff.Shopping", "{0189E4FB-6E2B-4F2E-9B1D-5473D23FC6DB}"
ProjectSection(SolutionItems) = preProject
src\ApiGateways\Mobile.Bff.Shopping\apigw\configuration.json = src\ApiGateways\Mobile.Bff.Shopping\apigw\configuration.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web.Bff.Marketing", "Web.Bff.Marketing", "{F8F0921C-EE5D-4AED-A4D6-5BF5FAE02CB5}"
ProjectSection(SolutionItems) = preProject
src\ApiGateways\Web.Bff.Marketing\apigw\configuration.json = src\ApiGateways\Web.Bff.Marketing\apigw\configuration.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web.Bff.Shopping", "Web.Bff.Shopping", "{28C0F5C8-4849-4035-80AB-45639424E73F}"
ProjectSection(SolutionItems) = preProject
src\ApiGateways\Web.Bff.Shopping\apigw\configuration.json = src\ApiGateways\Web.Bff.Shopping\apigw\configuration.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotApiGw", "src\ApiGateways\ApiGw-Base\OcelotApiGw.csproj", "{3F79558C-485D-49E1-BD3E-E12538D3D308}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mobile.Shopping.HttpAggregator", "src\ApiGateways\Mobile.Bff.Shopping\aggregator\Mobile.Shopping.HttpAggregator.csproj", "{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web.Shopping.HttpAggregator", "src\ApiGateways\Web.Bff.Shopping\aggregator\Web.Shopping.HttpAggregator.csproj", "{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.BackgroundTasks", "src\Services\Ordering\Ordering.BackgroundTasks\Ordering.BackgroundTasks.csproj", "{2FF56999-0266-48B2-ACC1-FEBC482A5105}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -1341,150 +1313,54 @@ Global
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x64.Build.0 = Release|Any CPU {15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x64.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.ActiveCfg = Release|Any CPU {15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.ActiveCfg = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.Build.0 = Release|Any CPU {15F4B3AA-89B6-4A0D-9051-414305974781}.Release|x86.Build.0 = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|ARM.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|iPhone.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|x64.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|x64.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|x86.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.AppStore|x86.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|ARM.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|iPhone.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|x64.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|x64.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|x86.ActiveCfg = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Debug|x86.Build.0 = Debug|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|Any CPU.Build.0 = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|ARM.ActiveCfg = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|ARM.Build.0 = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|iPhone.ActiveCfg = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|iPhone.Build.0 = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|x64.ActiveCfg = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|x64.Build.0 = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|x86.ActiveCfg = Release|Any CPU
{3F79558C-485D-49E1-BD3E-E12538D3D308}.Release|x86.Build.0 = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|ARM.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|iPhone.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|x64.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|x64.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|x86.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.AppStore|x86.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|ARM.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|ARM.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|iPhone.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|x64.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|x64.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|x86.ActiveCfg = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Debug|x86.Build.0 = Debug|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|Any CPU.Build.0 = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|ARM.ActiveCfg = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|ARM.Build.0 = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|iPhone.ActiveCfg = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|iPhone.Build.0 = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|x64.ActiveCfg = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|x64.Build.0 = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|x86.ActiveCfg = Release|Any CPU
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0}.Release|x86.Build.0 = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|ARM.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|iPhone.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|x64.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|x64.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|x86.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.AppStore|x86.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|ARM.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|iPhone.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|x64.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|x64.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|x86.ActiveCfg = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Debug|x86.Build.0 = Debug|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|Any CPU.Build.0 = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|ARM.ActiveCfg = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|ARM.Build.0 = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|iPhone.ActiveCfg = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|iPhone.Build.0 = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x64.ActiveCfg = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x64.Build.0 = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x86.ActiveCfg = Release|Any CPU
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1}.Release|x86.Build.0 = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|ARM.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|iPhone.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|x64.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|x64.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|x86.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.AppStore|x86.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|ARM.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|ARM.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|iPhone.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|x64.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|x64.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|x86.ActiveCfg = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Debug|x86.Build.0 = Debug|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|Any CPU.Build.0 = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|ARM.ActiveCfg = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|ARM.Build.0 = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|iPhone.ActiveCfg = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|iPhone.Build.0 = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|x64.ActiveCfg = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|x64.Build.0 = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|x86.ActiveCfg = Release|Any CPU
{2FF56999-0266-48B2-ACC1-FEBC482A5105}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1531,15 +1407,7 @@ Global
{969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870} {969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870}
{1815B651-941C-466B-AE33-D1D7EEB8F77F} = {DB0EFB20-B024-4E5E-A75C-52143C131D25} {1815B651-941C-466B-AE33-D1D7EEB8F77F} = {DB0EFB20-B024-4E5E-A75C-52143C131D25}
{15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F} {15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F}
{77849D35-37D4-4802-81DC-9477B2775A40} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{EC91ADE9-3D66-4AB2-9FB4-2B585E1F3531} = {77849D35-37D4-4802-81DC-9477B2775A40}
{DB813A36-11BA-41FE-B258-CA9A7152247B} = {77849D35-37D4-4802-81DC-9477B2775A40}
{0189E4FB-6E2B-4F2E-9B1D-5473D23FC6DB} = {77849D35-37D4-4802-81DC-9477B2775A40}
{F8F0921C-EE5D-4AED-A4D6-5BF5FAE02CB5} = {77849D35-37D4-4802-81DC-9477B2775A40}
{28C0F5C8-4849-4035-80AB-45639424E73F} = {77849D35-37D4-4802-81DC-9477B2775A40}
{3F79558C-485D-49E1-BD3E-E12538D3D308} = {EC91ADE9-3D66-4AB2-9FB4-2B585E1F3531}
{BEA37D6D-4CF2-4AE8-9575-72388E54FBD0} = {0189E4FB-6E2B-4F2E-9B1D-5473D23FC6DB}
{AF0828DB-8BDD-411A-AEEF-B780FBB8D8C1} = {28C0F5C8-4849-4035-80AB-45639424E73F}
{2FF56999-0266-48B2-ACC1-FEBC482A5105} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9}


+ 7
- 7
k8s/conf_cloud.yml View File

@ -3,12 +3,14 @@ kind: ConfigMap
metadata: metadata:
name: externalcfg name: externalcfg
labels: labels:
app: eshop
app: eshop
data: data:
# Basket.API entries # Basket.API entries
basket__ConnectionString: REDIS CONNECTION STRING FOR BASKET
BasketBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX for topic in case of using Azure)
BasketRedisConStr: REDIS CONNECTION STRING FOR BASKET
# Catalog.API entries # Catalog.API entries
catalog__ConnectionString: Catalog SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....)
CatalogBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX for topic in case of using Azure)
CatalogSqlDb: Catalog SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....)
# Identity.API entries # Identity.API entries
IdentitySqlDb: Identity SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) IdentitySqlDb: Identity SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....)
# Locations.API entries # Locations.API entries
@ -28,7 +30,5 @@ data:
# Payment.API entries # Payment.API entries
PaymentBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX for topic in case of using Azure) PaymentBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX for topic in case of using Azure)
# Global entries # Global entries
all_UseAzureServiceBus: "TRUE" IF USE AZURE SB ("FALSE" FOR USING RABBITMQ)
keystore: REDIS CONNECTION STRING FOR KEYSTORE
all_EventBusConnection: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure)
all_InstrumentationKey: APPINSIGHTS KEY
UseAzureServiceBus: "TRUE" IF USE AZURE SB ("FALSE" FOR USING RABBITMQ)
keystore: REDIS CONNECTION STRING FOR KEYSTORE

+ 21
- 16
k8s/conf_local.yml View File

@ -5,23 +5,28 @@ metadata:
labels: labels:
app: eshop app: eshop
data: data:
basket__ConnectionString: basket-data
catalog__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;
catalog__AzureStorageEnabled: "False"
identity__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word;
locations__ConnectionString: mongodb://nosql-data
locations__Database: LocationsDb
marketing__MongoConnectionString: mongodb://nosql-data
marketing__MongoDatabase: MarketingDb
marketing__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word;
ordering__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;
BasketBus: rabbitmq
BasketRedisConStr: basket-data
CatalogBus: rabbitmq
CatalogSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;
CatalogAzureStorageEnabled: "False"
IdentitySqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word;
LocationsBus: rabbitmq
LocationsNoSqlDb: mongodb://nosql-data
LocationsNoSqlDbName: LocationsDb
MarketingBus: rabbitmq
MarketingNoSqlDb: mongodb://nosql-data
MarketingNoSqlDbName: MarketingDb
MarketingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word;
OrderingBus: rabbitmq
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 keystore: keystore-data
GracePeriodManager__GracePeriodTime: "1"
GracePeriodManager__CheckUpdateTime: "15000"
all__EventBusConnection: rabbitmq
all__InstrumentationKey: ""
all__EnableLoadTest: "False"
all__UseAzureServiceBus: "False"
GracePeriodManager_GracePeriodTime: "1"
GracePeriodManager_CheckUpdateTime: "15000"
Instrumentation_Key: ""

+ 37
- 37
k8s/deploy.ps1 View File

@ -65,7 +65,7 @@ if ($buildImages) {
docker-compose -p .. -f ../docker-compose.yml build docker-compose -p .. -f ../docker-compose.yml build
Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "ocelotapigw-mm", "ocelotapigw-ms", "ocelotapigw-wm", "ocelotapigw-ws", "mobileshoppingagg", "webshoppingagg")
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "ordering.backgroundtasks", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus")
foreach ($service in $services) { foreach ($service in $services) {
$imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"} $imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"}
@ -103,10 +103,8 @@ if (-not [string]::IsNullOrEmpty($dockerUser)) {
Write-Host "Removing existing services & deployments.." -ForegroundColor Yellow Write-Host "Removing existing services & deployments.." -ForegroundColor Yellow
ExecKube -cmd 'delete deployments --all' ExecKube -cmd 'delete deployments --all'
ExecKube -cmd 'delete services --all' ExecKube -cmd 'delete services --all'
ExecKube -cmd 'delete configmap internalurls'
ExecKube -cmd 'delete configmap urls' ExecKube -cmd 'delete configmap urls'
ExecKube -cmd 'delete configmap externalcfg' ExecKube -cmd 'delete configmap externalcfg'
ExecKube -cmd 'delete configmap ocelot'
# start sql, rabbitmq, frontend deployments # start sql, rabbitmq, frontend deployments
if ($deployInfrastructure) { if ($deployInfrastructure) {
@ -115,35 +113,48 @@ if ($deployInfrastructure) {
} }
Write-Host 'Deploying ocelot APIGW' -ForegroundColor Yellow
ExecKube "create configmap ocelot --from-file=mm=ocelot/configuration-mobile-marketing.json --from-file=ms=ocelot/configuration-mobile-shopping.json --from-file=wm=ocelot/configuration-web-marketing.json --from-file=ws=ocelot/configuration-web-shopping.json "
ExecKube -cmd "apply -f ocelot/deployment.yaml"
ExecKube -cmd "apply -f ocelot/service.yaml"
Write-Host 'Deploying code deployments (Web APIs, Web apps, ...)' -ForegroundColor Yellow Write-Host 'Deploying code deployments (Web APIs, Web apps, ...)' -ForegroundColor Yellow
ExecKube -cmd 'create -f services.yaml' ExecKube -cmd 'create -f services.yaml'
ExecKube -cmd 'create -f internalurls.yaml'
ExecKube -cmd 'create configmap urls ` ExecKube -cmd 'create configmap urls `
--from-literal=PicBaseUrl=http://$($externalDns)/webshoppingapigw/api/v1/c/catalog/items/[0]/pic/ `
--from-literal=Marketing_PicBaseUrl=http://$($externalDns)/webmarketingapigw/api/v1/m/campaigns/[0]/pic/ `
--from-literal=mvc_e=http://$($externalDns)/webmvc `
--from-literal=marketingapigw_e=http://$($externalDns)/webmarketingapigw `
--from-literal=webshoppingapigw_e=http://$($externalDns)/webshoppingapigw `
--from-literal=mobileshoppingagg_e=http://$($externalDns)/mobileshoppingagg `
--from-literal=webshoppingagg_e=http://$($externalDns)/webshoppingagg `
--from-literal=identity_e=http://$($externalDns)/identity `
--from-literal=spa_e=http://$($externalDns) `
--from-literal=locations_e=http://$($externalDns)/locations-api `
--from-literal=marketing_e=http://$($externalDns)/marketing-api `
--from-literal=basket_e=http://$($externalDns)/basket-api `
--from-literal=ordering_e=http://$($externalDns)/ordering-api `
--from-literal=xamarin_callback_e=http://$($externalDns)/xamarincallback'
--from-literal=BasketUrl=http://basket `
--from-literal=BasketHealthCheckUrl=http://basket/hc `
--from-literal=CatalogUrl=http://$($externalDns)/catalog-api `
--from-literal=CatalogHealthCheckUrl=http://catalog/hc `
--from-literal=PicBaseUrl=http://$($externalDns)/catalog-api/api/v1/catalog/items/[0]/pic/ `
--from-literal=Marketing_PicBaseUrl=http://$($externalDns)/marketing-api/api/v1/campaigns/[0]/pic/ `
--from-literal=IdentityUrl=http://$($externalDns)/identity `
--from-literal=IdentityHealthCheckUrl=http://identity/hc `
--from-literal=OrderingUrl=http://ordering `
--from-literal=OrderingHealthCheckUrl=http://ordering/hc `
--from-literal=MvcClientExternalUrl=http://$($externalDns)/webmvc `
--from-literal=WebMvcHealthCheckUrl=http://webmvc/hc `
--from-literal=MvcClientOrderingUrl=http://ordering `
--from-literal=MvcClientCatalogUrl=http://catalog `
--from-literal=MvcClientBasketUrl=http://basket `
--from-literal=MvcClientMarketingUrl=http://marketing `
--from-literal=MvcClientLocationsUrl=http://locations `
--from-literal=MarketingHealthCheckUrl=http://marketing/hc `
--from-literal=WebSpaHealthCheckUrl=http://webspa/hc `
--from-literal=SpaClientMarketingExternalUrl=http://$($externalDns)/marketing-api `
--from-literal=SpaClientOrderingExternalUrl=http://$($externalDns)/ordering-api `
--from-literal=SpaClientCatalogExternalUrl=http://$($externalDns)/catalog-api `
--from-literal=SpaClientBasketExternalUrl=http://$($externalDns)/basket-api `
--from-literal=SpaClientIdentityExternalUrl=http://$($externalDns)/identity `
--from-literal=SpaClientLocationsUrl=http://$($externalDns)/locations-api `
--from-literal=LocationsHealthCheckUrl=http://locations/hc `
--from-literal=SpaClientExternalUrl=http://$($externalDns) `
--from-literal=LocationApiClient=http://$($externalDns)/locations-api `
--from-literal=MarketingApiClient=http://$($externalDns)/marketing-api `
--from-literal=BasketApiClient=http://$($externalDns)/basket-api `
--from-literal=OrderingApiClient=http://$($externalDns)/ordering-api `
--from-literal=PaymentHealthCheckUrl=http://payment/hc'
ExecKube -cmd 'label configmap urls app=eshop' ExecKube -cmd 'label configmap urls app=eshop'
Write-Host "Deploying configuration from $configFile" -ForegroundColor Yellow Write-Host "Deploying configuration from $configFile" -ForegroundColor Yellow
ExecKube -cmd "create -f $configFile" ExecKube -cmd "create -f $configFile"
Write-Host "Creating deployments..." -ForegroundColor Yellow Write-Host "Creating deployments..." -ForegroundColor Yellow
@ -167,14 +178,8 @@ ExecKube -cmd 'set image deployments/payment payment=${registryPath}${dockerOrg}
ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag' ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag'
ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag' ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag'
ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag' ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag'
ExecKube -cmd 'set image deployments/orderingbackground orderingbackground=${registryPath}${dockerOrg}/ordering.backgroundtasks:$imageTag'
ExecKube -cmd 'set image deployments/mobileshoppingagg mobileshoppingagg=${registryPath}${dockerOrg}/mobileshoppingagg:$imageTag'
ExecKube -cmd 'set image deployments/webshoppingagg webshoppingagg=${registryPath}${dockerOrg}/webshoppingagg:$imageTag'
ExecKube -cmd 'set image deployments/apigwmm apigwmm=${registryPath}${dockerOrg}/ocelotapigw-mm:$imageTag'
ExecKube -cmd 'set image deployments/apigwms apigwms=${registryPath}${dockerOrg}/ocelotapigw-ms:$imageTag'
ExecKube -cmd 'set image deployments/apigwwm apigwwm=${registryPath}${dockerOrg}/ocelotapigw-wm:$imageTag'
ExecKube -cmd 'set image deployments/apigwws apigwws=${registryPath}${dockerOrg}/ocelotapigw-ws:$imageTag'
Write-Host "Execute rollout..." -ForegroundColor Yellow Write-Host "Execute rollout..." -ForegroundColor Yellow
ExecKube -cmd 'rollout resume deployments/basket' ExecKube -cmd 'rollout resume deployments/basket'
@ -187,12 +192,7 @@ ExecKube -cmd 'rollout resume deployments/payment'
ExecKube -cmd 'rollout resume deployments/webmvc' ExecKube -cmd 'rollout resume deployments/webmvc'
ExecKube -cmd 'rollout resume deployments/webstatus' ExecKube -cmd 'rollout resume deployments/webstatus'
ExecKube -cmd 'rollout resume deployments/webspa' ExecKube -cmd 'rollout resume deployments/webspa'
ExecKube -cmd 'rollout resume deployments/mobileshoppingagg'
ExecKube -cmd 'rollout resume deployments/webshoppingagg'
ExecKube -cmd 'rollout resume deployments/apigwmm'
ExecKube -cmd 'rollout resume deployments/apigwms'
ExecKube -cmd 'rollout resume deployments/apigwwm'
ExecKube -cmd 'rollout resume deployments/apigwws'
ExecKube -cmd 'rollout resume deployments/orderingbackground'
Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow

+ 282
- 228
k8s/deployments.yaml View File

@ -21,32 +21,32 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: basket__ConnectionString
key: BasketRedisConStr
- name: EventBusConnection - name: EventBusConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EventBusConnection
key: BasketBus
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__UseAzureServiceBus
key: UseAzureServiceBus
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: identity_e
key: IdentityUrl
- name: UseLoadTest - name: UseLoadTest
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EnableLoadTest
key: EnableLoadTest
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -56,8 +56,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -84,7 +91,7 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: catalog__ConnectionString
key: CatalogSqlDb
- name: PicBaseUrl - name: PicBaseUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -94,17 +101,17 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: catalog__AzureStorageEnabled
key: CatalogAzureStorageEnabled
- name: EventBusConnection - name: EventBusConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EventBusConnection
key: CatalogBus
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -114,8 +121,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -142,7 +156,7 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: identity__ConnectionString
key: IdentitySqlDb
- name: DPConnectionString - name: DPConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -154,52 +168,37 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: mvc_e
key: MvcClientExternalUrl
- name: SpaClient - name: SpaClient
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: spa_e
key: SpaClientExternalUrl
- name: LocationApiClient - name: LocationApiClient
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: locations_e
key: LocationApiClient
- name: MarketingApiClient - name: MarketingApiClient
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: marketing_e
key: MarketingApiClient
- name: BasketApiClient - name: BasketApiClient
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: basket_e
key: BasketApiClient
- name: OrderingApiClient - name: OrderingApiClient
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: ordering_e
- name: MobileShoppingAggClient
valueFrom:
configMapKeyRef:
name: urls
key: mobileshoppingagg_e
- name: WebShoppingAggClient
valueFrom:
configMapKeyRef:
name: urls
key: webshoppingagg_e
- name: XamarinCallback
valueFrom:
configMapKeyRef:
name: urls
key: xamarin_callback_e
key: OrderingApiClient
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -209,8 +208,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -237,42 +243,107 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: ordering__ConnectionString
key: OrderingSqlDb
- name: EventBusConnection - name: EventBusConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EventBusConnection
key: OrderingBus
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__UseAzureServiceBus
key: UseAzureServiceBus
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: identity_e
key: IdentityUrl
- name: ApplicationInsights__InstrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
- name: UseLoadTest
valueFrom:
configMapKeyRef:
name: externalcfg
key: EnableLoadTest
- name: OrchestratorType
value: 'K8S'
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /hc
port: 80
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: orderingbackground
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: orderingbackground
spec:
containers:
- name: orderingbackground
image: eshop/ordering.backgroundtasks
imagePullPolicy: Always
env:
- name: PATH_BASE
value: /ordering-backgroundtasks
- name: ConnectionString
valueFrom:
configMapKeyRef:
name: externalcfg
key: OrderingSqlDb
- name: EventBusConnection
valueFrom:
configMapKeyRef:
name: externalcfg
key: OrderingBus
- name: AzureServiceBusEnabled
valueFrom:
configMapKeyRef:
name: externalcfg
key: UseAzureServiceBus
- name: CheckUpdateTime - name: CheckUpdateTime
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: GracePeriodManager__CheckUpdateTime
key: GracePeriodManager_CheckUpdateTime
- name: GracePeriodTime - name: GracePeriodTime
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: GracePeriodManager__GracePeriodTime
key: GracePeriodManager_GracePeriodTime
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: UseLoadTest - name: UseLoadTest
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EnableLoadTest
key: EnableLoadTest
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -282,8 +353,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -310,42 +388,42 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: locations__ConnectionString
key: LocationsNoSqlDb
- name: Database - name: Database
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: locations__Database
key: LocationsNoSqlDbName
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__UseAzureServiceBus
key: UseAzureServiceBus
- name: EventBusConnection - name: EventBusConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EventBusConnection
key: LocationsBus
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: identity
name: urls
key: IdentityUrl
- name: IdentityUrlExternal - name: IdentityUrlExternal
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: identity_e
key: IdentityUrl
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: UseLoadTest - name: UseLoadTest
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EnableLoadTest
key: EnableLoadTest
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -355,8 +433,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 50
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -383,37 +468,37 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: marketing__ConnectionString
key: MarketingSqlDb
- name: MongoConnectionString - name: MongoConnectionString
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: marketing__MongoConnectionString
key: MarketingNoSqlDb
- name: MongoDatabase - name: MongoDatabase
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: marketing__MongoDatabase
key: MarketingNoSqlDbName
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__UseAzureServiceBus
key: UseAzureServiceBus
- name: EventBusConnection - name: EventBusConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EventBusConnection
key: MarketingBus
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: identity
name: urls
key: IdentityUrl
- name: IdentityUrlExternal - name: IdentityUrlExternal
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: identity_e
key: IdentityUrl
- name: PicBaseUrl - name: PicBaseUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -423,12 +508,12 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: UseLoadTest - name: UseLoadTest
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EnableLoadTest
key: EnableLoadTest
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -438,8 +523,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -466,17 +558,17 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__UseAzureServiceBus
key: UseAzureServiceBus
- name: EventBusConnection - name: EventBusConnection
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EventBusConnection
key: PaymentBus
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -486,8 +578,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -517,66 +616,81 @@ spec:
key: keystore key: keystore
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: PurchaseUrl
- name: BasketUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: apigwws
name: urls
key: MvcClientBasketUrl
- name: CallBackUrl - name: CallBackUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: mvc_e
key: MvcClientExternalUrl
- name: LocationsUrl
valueFrom:
configMapKeyRef:
name: urls
key: MvcClientLocationsUrl
- name: CatalogUrl
valueFrom:
configMapKeyRef:
name: urls
key: MvcClientCatalogUrl
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: identity_e
key: IdentityUrl
- name: OrderingUrl
valueFrom:
configMapKeyRef:
name: urls
key: MvcClientOrderingUrl
- name: MarketingUrl - name: MarketingUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: apigwwm
name: urls
key: MvcClientMarketingUrl
- name: BasketUrlHC - name: BasketUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: basket__hc
name: urls
key: BasketHealthCheckUrl
- name: CatalogUrlHC - name: CatalogUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: catalog__hc
name: urls
key: CatalogHealthCheckUrl
- name: IdentityUrlHC - name: IdentityUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: identity__hc
name: urls
key: IdentityHealthCheckUrl
- name: OrderingUrlHC - name: OrderingUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: ordering__hc
name: urls
key: OrderingHealthCheckUrl
- name: MarketingUrlHC - name: MarketingUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: marketing__hc
name: urls
key: MarketingHealthCheckUrl
- name: PaymentUrlHC - name: PaymentUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: payment__hc
name: urls
key: PaymentHealthCheckUrl
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: UseLoadTest - name: UseLoadTest
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__EnableLoadTest
key: EnableLoadTest
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -586,8 +700,15 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
--- ---
@ -613,53 +734,53 @@ spec:
- name: BasketUrl - name: BasketUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: basket__hc
name: urls
key: BasketHealthCheckUrl
- name: CatalogUrl - name: CatalogUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: catalog__hc
name: urls
key: CatalogHealthCheckUrl
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: identity__hc
name: urls
key: IdentityHealthCheckUrl
- name: OrderingUrl - name: OrderingUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: ordering__hc
name: urls
key: OrderingHealthCheckUrl
- name: LocationsUrl - name: LocationsUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: locations__hc
name: urls
key: LocationsHealthCheckUrl
- name: MarketingUrl - name: MarketingUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: marketing__hc
name: urls
key: MarketingHealthCheckUrl
- name: mvc - name: mvc
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: mvc__hc
name: urls
key: WebMvcHealthCheckUrl
- name: spa - name: spa
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: spa__hc
name: urls
key: WebSpaHealthCheckUrl
- name: PaymentUrl - name: PaymentUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: payment__hc
name: urls
key: PaymentHealthCheckUrl
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -693,61 +814,76 @@ spec:
key: keystore key: keystore
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: PurchaseUrl
- name: BasketUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: webshoppingapigw_e
key: SpaClientBasketExternalUrl
- name: CallBackUrl - name: CallBackUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: spa_e
key: SpaClientExternalUrl
- name: CatalogUrl
valueFrom:
configMapKeyRef:
name: urls
key: SpaClientCatalogExternalUrl
- name: IdentityUrl - name: IdentityUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: identity_e
key: SpaClientIdentityExternalUrl
- name: OrderingUrl
valueFrom:
configMapKeyRef:
name: urls
key: SpaClientOrderingExternalUrl
- name: MarketingUrl - name: MarketingUrl
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: marketingapigw_e
key: SpaClientMarketingExternalUrl
- name: LocationsUrl
valueFrom:
configMapKeyRef:
name: urls
key: SpaClientLocationsUrl
- name: BasketUrlHC - name: BasketUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: basket__hc
name: urls
key: BasketHealthCheckUrl
- name: CatalogUrlHC - name: CatalogUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: catalog__hc
name: urls
key: CatalogHealthCheckUrl
- name: IdentityUrlHC - name: IdentityUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: identity__hc
name: urls
key: IdentityHealthCheckUrl
- name: OrderingUrlHC - name: OrderingUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: ordering__hc
name: urls
key: OrderingHealthCheckUrl
- name: MarketingUrlHC - name: MarketingUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: marketing__hc
name: urls
key: MarketingHealthCheckUrl
- name: PaymentUrlHC - name: PaymentUrlHC
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: internalurls
key: payment__hc
name: urls
key: PaymentHealthCheckUrl
- name: ApplicationInsights__InstrumentationKey - name: ApplicationInsights__InstrumentationKey
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: externalcfg name: externalcfg
key: all__InstrumentationKey
key: Instrumentation_Key
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
ports: ports:
@ -757,96 +893,14 @@ spec:
path: /hc path: /hc
port: 80 port: 80
scheme: HTTP scheme: HTTP
initialDelaySeconds: 300
periodSeconds: 240
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: webshoppingagg
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: webshoppingagg
spec:
containers:
- name: webshoppingagg
image: eshop/webshoppingagg
imagePullPolicy: Always
env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: urls__basket
valueFrom:
configMapKeyRef:
name: internalurls
key: basket
- name: urls__catalog
valueFrom:
configMapKeyRef:
name: internalurls
key: catalog
- name: urls__orders
valueFrom:
configMapKeyRef:
name: internalurls
key: ordering
- name: urls__identity
valueFrom:
configMapKeyRef:
name: internalurls
key: identity
ports:
- containerPort: 80
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mobileshoppingagg
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: mobileshoppingagg
spec:
containers:
- name: mobileshoppingagg
image: eshop/mobileshoppingagg
imagePullPolicy: Always
env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: urls__basket
valueFrom:
configMapKeyRef:
name: internalurls
key: basket
- name: urls__catalog
valueFrom:
configMapKeyRef:
name: internalurls
key: catalog
- name: urls__orders
valueFrom:
configMapKeyRef:
name: internalurls
key: ordering
- name: urls__identity
valueFrom:
configMapKeyRef:
name: internalurls
key: identity
ports:
- containerPort: 80
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /liveness
port: 80
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 60
imagePullSecrets: imagePullSecrets:
- name: registry-key - name: registry-key
---

+ 47
- 0
k8s/frontend.yaml View File

@ -0,0 +1,47 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: frontend
name: frontend
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: eshop
component: frontend
type: LoadBalancer
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: frontend
spec:
template:
metadata:
labels:
app: eshop
component: frontend
spec:
containers:
- name: nginx
image: nginx:1.13.8-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
lifecycle:
preStop:
exec:
command: ["/usr/sbin/nginx","-s","quit"]
volumeMounts:
- name: config
mountPath: /etc/nginx
volumes:
- name: config
configMap:
name: config-files
items:
- key: nginx-conf
path: nginx.conf

+ 7
- 5
k8s/gen-k8s-env-aks.ps1 View File

@ -3,9 +3,11 @@
[parameter(Mandatory=$true)][string]$location, [parameter(Mandatory=$true)][string]$location,
[parameter(Mandatory=$false)][string]$registryName, [parameter(Mandatory=$false)][string]$registryName,
[parameter(Mandatory=$true)][string]$serviceName, [parameter(Mandatory=$true)][string]$serviceName,
[parameter(Mandatory=$true)][string]$dnsName,
[parameter(Mandatory=$true)][string]$createAcr=$true, [parameter(Mandatory=$true)][string]$createAcr=$true,
[parameter(Mandatory=$false)][int]$nodeCount=3,
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2"
[parameter(Mandatory=$false)][int]$nodeCount=2,
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2",
[parameter(Mandatory=$false)][string]$kubernetesVersion="1.7.7"
) )
# Create resource group # Create resource group
@ -20,12 +22,12 @@ if ($createAcr -eq $true) {
# Create kubernetes orchestrator # Create kubernetes orchestrator
Write-Host "Creating kubernetes orchestrator..." -ForegroundColor Yellow Write-Host "Creating kubernetes orchestrator..." -ForegroundColor Yellow
az aks create --resource-group=$resourceGroupName --name=$serviceName --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize
az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsName --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize --kubernetes-version $kubernetesVersion
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config
az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName
if ($createAcr -eq $true) { if ($createAcr -eq $true) {
# Show ACR credentials # Show ACR credentials
az acr credential show -n $registryName az acr credential show -n $registryName
}
}

+ 19
- 23
k8s/ingress.yaml View File

@ -11,10 +11,22 @@ spec:
rules: rules:
- http: - http:
paths: paths:
- path: /basket-api
backend:
serviceName: basket
servicePort: 80
- path: /catalog-api
backend:
serviceName: catalog
servicePort: 80
- path: /identity - path: /identity
backend: backend:
serviceName: identity serviceName: identity
servicePort: 80 servicePort: 80
- path: /ordering-api
backend:
serviceName: ordering
servicePort: 80
- path: /webmvc - path: /webmvc
backend: backend:
serviceName: webmvc serviceName: webmvc
@ -23,37 +35,21 @@ spec:
backend: backend:
serviceName: webstatus serviceName: webstatus
servicePort: 80 servicePort: 80
- path: /webshoppingapigw
backend:
serviceName: ocelotapigw-ws
servicePort: 80
- path: /webmarketingapigw
- path: /marketing-api
backend: backend:
serviceName: ocelotapigw-wm
serviceName: marketing
servicePort: 80 servicePort: 80
- path: /mobilemarketingapigw
backend:
serviceName: ocelotapigw-mm
servicePort: 80
- path: /mobileshoppingapigw
backend:
serviceName: ocelotapigw-ms
servicePort: 80
- path: /webshoppingagg
- path: /payment-api
backend: backend:
serviceName: webshoppingagg
serviceName: payment
servicePort: 80 servicePort: 80
- path: /mobileshoppingagg
- path: /locations-api
backend: backend:
serviceName: mobileshoppingagg
serviceName: locations
servicePort: 80 servicePort: 80
- path: /payment-api
backend:
serviceName: payment
servicePort: 80
- path: / - path: /
backend: backend:
serviceName: webspa serviceName: webspa
servicePort: 80 servicePort: 80

+ 0
- 31
k8s/internalurls.yaml View File

@ -1,31 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: internalurls
labels:
app: eshop
data:
# Internal Services & healthchecks
basket: http://basket
basket__hc: http://basket/hc
catalog: http://catalog
catalog__hc: http://catalog/hc
identity: http://identity
identity__hc: http://identity/hc
ordering: http://ordering
ordering__hc: http://ordering/hc
marketing: http://marketing
marketing__hc: http://marketing/hc
locations: http://locations
locations__hc: http://locations/hc
payment__hc: http://payment/hc
mvc__hc: http://webmvc/hc
spa__hc: http://webspa/hc
# Aggreggators
mobileshoppingagg: http://mobileshoppingagg
webshoppingagg: http://webshoppingagg
# API GWs
apigwmm: http://ocelotapigw-mm
apigwms: http://ocelotapigw-ms
apigwwm: http://ocelotapigw-wm
apigwws: http://ocelotapigw-ws

+ 0
- 34
k8s/ocelot/configuration-mobile-marketing.json View File

@ -1,34 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 142
k8s/ocelot/configuration-mobile-shopping.json View File

@ -1,142 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
"UpstreamHttpMethod": [ "GET" ]
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "mobileshoppingagg",
"Port": 80
}
],
"UpstreamPathTemplate": "/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering",
"Port": 80
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket",
"Port": 80
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog",
"Port": 80
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing",
"Port": 80
}
],
"UpstreamPathTemplate": "/marketing-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "payment",
"Port": 80
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/location-api/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 34
k8s/ocelot/configuration-web-marketing.json View File

@ -1,34 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 142
k8s/ocelot/configuration-web-shopping.json View File

@ -1,142 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
"UpstreamHttpMethod": [ "GET" ]
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "webshoppingagg",
"Port": 80
}
],
"UpstreamPathTemplate": "/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering",
"Port": 80
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket",
"Port": 80
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog",
"Port": 80
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing",
"Port": 80
}
],
"UpstreamPathTemplate": "/marketing-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "payment",
"Port": 80
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/location-api/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 155
k8s/ocelot/deployment.yaml View File

@ -1,155 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: apigwmm
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: apigwmm
spec:
containers:
- name: apigwmm
image: eshop/ocelotapigw-mm
imagePullPolicy: Always
env:
- name: PATH_BASE
value: /mobilemarketingapigw
- name: IdentityUrl
valueFrom:
configMapKeyRef:
name: internalurls
key: identity
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /app/configuration
volumes:
- name: config
configMap:
name: ocelot
items:
- key: mm
path: configuration.json
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: apigwms
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: apigwms
spec:
containers:
- name: apigwms
image: eshop/ocelotapigw-ms
imagePullPolicy: Always
env:
- name: PATH_BASE
value: /mobileshoppingapigw
- name: IdentityUrl
valueFrom:
configMapKeyRef:
name: internalurls
key: identity
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /app/configuration
volumes:
- name: config
configMap:
name: ocelot
items:
- key: ms
path: configuration.json
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: apigwwm
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: apigwwm
spec:
containers:
- name: apigwwm
image: eshop/ocelotapigw-wm
imagePullPolicy: Always
env:
- name: PATH_BASE
value: /webmarketingapigw
- name: IdentityUrl
valueFrom:
configMapKeyRef:
name: internalurls
key: identity
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /app/configuration
volumes:
- name: config
configMap:
name: ocelot
items:
- key: wm
path: configuration.json
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: apigwws
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: apigwws
spec:
containers:
- name: apigwws
image: eshop/ocelotapigw-ws
imagePullPolicy: Always
env:
- name: PATH_BASE
value: /webshoppingapigw
- name: IdentityUrl
valueFrom:
configMapKeyRef:
name: internalurls
key: identity
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /app/configuration
volumes:
- name: config
configMap:
name: ocelot
items:
- key: ws
path: configuration.json
imagePullSecrets:
- name: registry-key

+ 0
- 55
k8s/ocelot/service.yaml View File

@ -1,55 +0,0 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: ocelotapigw-mm
name: ocelotapigw-mm
spec:
ports:
- port: 80
selector:
app: eshop
component: apigwmm
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: ocelotapigw-ms
name: ocelotapigw-ms
spec:
ports:
- port: 80
selector:
app: eshop
component: apigwms
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: ocelotapigw-wm
name: ocelotapigw-wm
spec:
ports:
- port: 80
selector:
app: eshop
component: apigwwm
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: ocelotapigw-ws
name: ocelotapigw-ws
spec:
ports:
- port: 80
selector:
app: eshop
component: apigwws

+ 0
- 28
k8s/services.yaml View File

@ -112,34 +112,6 @@ spec:
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata:
labels:
app: eshop
component: webshoppingagg
name: webshoppingagg
spec:
ports:
- port: 80
selector:
app: eshop
component: webshoppingagg
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: mobileshoppingagg
name: mobileshoppingagg
spec:
ports:
- port: 80
selector:
app: eshop
component: mobileshoppingagg
---
apiVersion: v1
kind: Service
metadata: metadata:
labels: labels:
app: eshop app: eshop


+ 0
- 20
src/ApiGateways/ApiGw-Base/Dockerfile View File

@ -1,20 +0,0 @@
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
ENV ESHOP_API_GW Mobile_Bff_Shopping_ApiGw
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj src/ApiGateways/ApiGw-Base/
RUN dotnet restore src/ApiGateways/ApiGw-Base/
COPY . .
WORKDIR /src/src/ApiGateways/ApiGw-Base/
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

+ 0
- 20
src/ApiGateways/ApiGw-Base/Dockerfile2 View File

@ -1,20 +0,0 @@
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
ENV ESHOP_API_GW Mobile_Bff_Marketing_ApiGw
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj src/ApiGateways/ApiGw-Base/
RUN dotnet restore src/ApiGateways/ApiGw-Base/
COPY . .
WORKDIR /src/src/ApiGateways/ApiGw-Base/
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

+ 0
- 20
src/ApiGateways/ApiGw-Base/Dockerfile3 View File

@ -1,20 +0,0 @@
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
ENV ESHOP_API_GW Web_Bff_Shopping_ApiGw
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj src/ApiGateways/ApiGw-Base/
RUN dotnet restore src/ApiGateways/ApiGw-Base/
COPY . .
WORKDIR /src/src/ApiGateways/ApiGw-Base/
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

+ 0
- 20
src/ApiGateways/ApiGw-Base/Dockerfile4 View File

@ -1,20 +0,0 @@
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
ENV ESHOP_API_GW Web_Bff_Marketing_ApiGw
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj src/ApiGateways/ApiGw-Base/
RUN dotnet restore src/ApiGateways/ApiGw-Base/
COPY . .
WORKDIR /src/src/ApiGateways/ApiGw-Base/
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

+ 0
- 16
src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj View File

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
<PackageReference Include="Ocelot" Version="3.0.0" />
</ItemGroup>
</Project>

+ 0
- 31
src/ApiGateways/ApiGw-Base/Program.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
namespace OcelotApiGw
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
var builder = WebHost.CreateDefaultBuilder(args);
builder.ConfigureServices(s => s.AddSingleton(builder))
.ConfigureAppConfiguration(ic => ic.AddJsonFile(Path.Combine("configuration", "configuration.json")))
.UseStartup<Startup>();
var host = builder.Build();
return host;
}
}
}

+ 0
- 27
src/ApiGateways/ApiGw-Base/Properties/launchSettings.json View File

@ -1,27 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56755/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"OcelotApiGw": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:64021/"
}
}
}

+ 0
- 91
src/ApiGateways/ApiGw-Base/Startup.cs View File

@ -1,91 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CacheManager.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
namespace OcelotApiGw
{
public class Startup
{
private readonly IConfiguration _cfg;
public Startup(IConfiguration configuration)
{
_cfg = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
var identityUrl = _cfg.GetValue<string>("IdentityUrl");
var authenticationProviderKey = "IdentityApiKey";
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
services.AddAuthentication()
.AddJwtBearer(authenticationProviderKey, x =>
{
x.Authority = identityUrl;
x.RequireHttpsMetadata = false;
x.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
{
ValidAudiences = new[] { "orders", "basket", "locations", "marketing", "mobileshoppingagg", "webshoppingagg" }
};
x.Events = new Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents()
{
OnAuthenticationFailed = async ctx =>
{
int i = 0;
},
OnTokenValidated = async ctx =>
{
int i = 0;
},
OnMessageReceived = async ctx =>
{
int i = 0;
}
};
});
services.AddOcelot(_cfg);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var pathBase = _cfg["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
loggerFactory.AddConsole(_cfg.GetSection("Logging"));
app.UseCors("CorsPolicy");
app.UseOcelot().Wait();
}
}
}

+ 0
- 10
src/ApiGateways/ApiGw-Base/appsettings.json View File

@ -1,10 +0,0 @@
{
"Logging": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Trace",
"System": "Information",
"Microsoft": "Information"
}
}
}

+ 0
- 34
src/ApiGateways/Mobile.Bff.Marketing/apigw/configuration.json View File

@ -1,34 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 31
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config
{
public class UrlsConfig
{
public class CatalogOperations
{
public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}";
public static string GetItemsById(IEnumerable<int> ids) => $"/api/v1/catalog/items?ids={string.Join(',', ids)}";
}
public class BasketOperations
{
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
public static string UpdateBasket() => "/api/v1/basket";
}
public class OrdersOperations
{
public static string GetOrderDraft() => "/api/v1/orders/draft";
}
public string Basket { get; set; }
public string Catalog { get; set; }
public string Orders { get; set; }
}
}

+ 0
- 133
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/BasketController.cs View File

@ -1,133 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class BasketController : Controller
{
private readonly ICatalogService _catalog;
private readonly IBasketService _basket;
public BasketController(ICatalogService catalogService, IBasketService basketService)
{
_catalog = catalogService;
_basket = basketService;
}
[HttpPost]
[HttpPut]
public async Task<IActionResult> UpdateAllBasket([FromBody] UpdateBasketRequest data)
{
if (data.Items == null || !data.Items.Any())
{
return BadRequest("Need to pass at least one basket line");
}
// Retrieve the current basket
var currentBasket = await _basket.GetById(data.BuyerId);
if (currentBasket == null)
{
currentBasket = new BasketData(data.BuyerId);
}
var catalogItems = await _catalog.GetCatalogItems(data.Items.Select(x => x.ProductId));
var newBasket = new BasketData(data.BuyerId);
foreach (var bitem in data.Items)
{
var catalogItem = catalogItems.SingleOrDefault(ci => ci.Id == bitem.ProductId);
if (catalogItem == null)
{
return BadRequest($"Basket refers to a non-existing catalog item ({bitem.ProductId})");
}
newBasket.Items.Add(new BasketDataItem()
{
Id = bitem.Id,
ProductId = catalogItem.Id.ToString(),
ProductName = catalogItem.Name,
PictureUrl = catalogItem.PictureUri,
UnitPrice = catalogItem.Price,
Quantity = bitem.Quantity
});
}
await _basket.Update(newBasket);
return Ok(newBasket);
}
[HttpPut]
[Route("items")]
public async Task<IActionResult> UpdateQuantities([FromBody] UpdateBasketItemsRequest data)
{
if (!data.Updates.Any())
{
return BadRequest("No updates sent");
}
// Retrieve the current basket
var currentBasket = await _basket.GetById(data.BasketId);
if (currentBasket == null)
{
return BadRequest($"Basket with id {data.BasketId} not found.");
}
// Update with new quantities
foreach (var update in data.Updates)
{
var basketItem = currentBasket.Items.SingleOrDefault(bitem => bitem.Id == update.BasketItemId);
if (basketItem == null)
{
return BadRequest($"Basket item with id {update.BasketItemId} not found");
}
basketItem.Quantity = update.NewQty;
}
// Save the updated basket
await _basket.Update(currentBasket);
return Ok(currentBasket);
}
[HttpPost]
[Route("items")]
public async Task<IActionResult> AddBasketItem([FromBody] AddBasketItemRequest data)
{
if (data == null || data.Quantity == 0)
{
return BadRequest("Invalid payload");
}
// Step 1: Get the item from catalog
var item = await _catalog.GetCatalogItem(data.CatalogItemId);
//item.PictureUri =
// Step 2: Get current basket status
var currentBasket = (await _basket.GetById(data.BasketId)) ?? new BasketData(data.BasketId);
// Step 3: Merge current status with new product
currentBasket.Items.Add(new BasketDataItem()
{
UnitPrice = item.Price,
PictureUrl = item.PictureUri,
ProductId = item.Id.ToString(),
ProductName = item.Name,
Quantity = data.Quantity,
Id = Guid.NewGuid().ToString()
});
// Step 4: Update basket
await _basket.Update(currentBasket);
return Ok();
}
}
}

+ 0
- 18
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/HomeController.cs View File

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
{
[Route("")]
public class HomeController : Controller
{
[HttpGet()]
public IActionResult Index()
{
return new RedirectResult("~/swagger");
}
}
}

+ 0
- 42
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/OrderController.cs View File

@ -1,42 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class OrderController : Controller
{
private readonly IBasketService _basketService;
private readonly IOrderApiClient _orderClient;
public OrderController(IBasketService basketService, IOrderApiClient orderClient)
{
_basketService = basketService;
_orderClient = orderClient;
}
[Route("draft/{basketId}")]
[HttpGet]
public async Task<IActionResult> GetOrderDraft(string basketId)
{
if (string.IsNullOrEmpty(basketId))
{
return BadRequest("Need a valid basketid");
}
// Get the basket data and build a order draft based on it
var basket = await _basketService.GetById(basketId);
if (basket == null)
{
return BadRequest($"No basket found for id {basketId}");
}
var orderDraft = await _orderClient.GetOrderDraftFromBasket(basket);
return Ok(orderDraft);
}
}
}

+ 0
- 19
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile View File

@ -1,19 +0,0 @@
FROM microsoft/aspnetcore:2.0.5 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/ApiGateways/Mobile.Bff.Shopping/aggregator
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Mobile.Shopping.HttpAggregator.dll"]

+ 0
- 33
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs View File

@ -1,33 +0,0 @@
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters
{
using Microsoft.AspNetCore.Authorization;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;
namespace Basket.API.Infrastructure.Filters
{
public class AuthorizeCheckOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
// Check for authorize attribute
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
if (hasAuthorize)
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
operation.Responses.Add("403", new Response { Description = "Forbidden" });
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
{
{ "oauth2", new [] { "Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator" } }
});
}
}
}
}
}

+ 0
- 27
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj View File

@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Mobile.Shopping.HttpAggregator</AssemblyName>
<RootNamespace>Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator</RootNamespace>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\Resilience\Resilience.Http\Resilience.Http.csproj" />
</ItemGroup>
</Project>

+ 0
- 20
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class AddBasketItemRequest
{
public int CatalogItemId { get; set; }
public string BasketId { get; set; }
public int Quantity { get; set; }
public AddBasketItemRequest()
{
Quantity = 1;
}
}
}

+ 0
- 31
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class BasketData
{
public string BuyerId { get; set; }
public List<BasketDataItem> Items { get; set; }
public BasketData(string buyerId)
{
BuyerId = buyerId;
Items = new List<BasketDataItem>();
}
}
public class BasketDataItem
{
public string Id { get; set; }
public string ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; set; }
public string PictureUrl { get; set; }
}
}

+ 0
- 20
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/CatalogItem.cs View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class CatalogItem
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public string PictureUri { get; set; }
}
}

+ 0
- 33
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class OrderData
{
public string OrderNumber { get; set; }
public DateTime Date { get; set; }
public string Status { get; set; }
public decimal Total { get; set; }
public string Description { get; set; }
public string City { get; set; }
public string Street { get; set; }
public string State { get; set; }
public string Country { get; set; }
public string ZipCode { get; set; }
public string CardNumber { get; set; }
public string CardHolderName { get; set; }
public bool IsDraft { get; set; }
public DateTime CardExpiration { get; set; }
public string CardExpirationShort { get; set; }
public string CardSecurityNumber { get; set; }
public int CardTypeId { get; set; }
public string Buyer { get; set; }
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
}
}

+ 0
- 17
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class OrderItemData
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal Discount { get; set; }
public int Units { get; set; }
public string PictureUrl { get; set; }
}
}

+ 0
- 31
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class UpdateBasketItemsRequest
{
public string BasketId { get; set; }
public ICollection<UpdateBasketItemData> Updates { get; set; }
public UpdateBasketItemsRequest()
{
Updates = new List<UpdateBasketItemData>();
}
}
public class UpdateBasketItemData
{
public string BasketItemId { get; set; }
public int NewQty { get; set; }
public UpdateBasketItemData()
{
NewQty = 0;
}
}
}

+ 0
- 21
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{
public class UpdateBasketRequest
{
public string BuyerId { get; set; }
public IEnumerable<UpdateBasketRequestItemData> Items { get; set; }
}
public class UpdateBasketRequestItemData
{
public string Id { get; set; } // Basket id
public int ProductId { get; set; } // Catalog item id
public int Quantity { get; set; } // Quantity
}
}

+ 0
- 36
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs View File

@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost
.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(cb =>
{
var sources = cb.Sources;
sources.Insert(3, new Microsoft.Extensions.Configuration.Json.JsonConfigurationSource()
{
Optional = true,
Path = "appsettings.localhost.json",
ReloadOnChange = false
});
})
.UseStartup<Startup>()
.Build();
}
}

+ 0
- 29
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Properties/launchSettings.json View File

@ -1,29 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:57425/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"PurchaseForMvc": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:61632/"
}
}
}

+ 0
- 53
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs View File

@ -1,53 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public class BasketService : IBasketService
{
private readonly IHttpClient _apiClient;
private readonly ILogger<BasketService> _logger;
private readonly UrlsConfig _urls;
private readonly IHttpContextAccessor _httpContextAccessor;
public BasketService(IHttpClient httpClient, IHttpContextAccessor httpContextAccessor, ILogger<BasketService> logger, IOptionsSnapshot<UrlsConfig> config)
{
_apiClient = httpClient;
_logger = logger;
_urls = config.Value;
_httpContextAccessor = httpContextAccessor;
}
public async Task<BasketData> GetById(string id)
{
var token = await GetUserTokenAsync();
var data = await _apiClient.GetStringAsync(_urls.Basket + UrlsConfig.BasketOperations.GetItemById(id), token);
var basket = !string.IsNullOrEmpty(data) ? JsonConvert.DeserializeObject<BasketData>(data) : null;
return basket;
}
public async Task Update(BasketData currentBasket)
{
var token = await GetUserTokenAsync();
var data = await _apiClient.PostAsync<BasketData>(_urls.Basket + UrlsConfig.BasketOperations.UpdateBasket(), currentBasket, token);
int i = 0;
}
async Task<string> GetUserTokenAsync()
{
var context = _httpContextAccessor.HttpContext;
return await context.GetTokenAsync("access_token");
}
}
}

+ 0
- 43
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs View File

@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public class CatalogService : ICatalogService
{
private readonly IHttpClient _apiClient;
private readonly ILogger<CatalogService> _logger;
private readonly UrlsConfig _urls;
public CatalogService(IHttpClient httpClient, ILogger<CatalogService> logger, IOptionsSnapshot<UrlsConfig> config)
{
_apiClient = httpClient;
_logger = logger;
_urls = config.Value;
}
public async Task<CatalogItem> GetCatalogItem(int id)
{
var data = await _apiClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemById(id));
var item = JsonConvert.DeserializeObject<CatalogItem>(data);
return item;
}
public async Task<IEnumerable<CatalogItem>> GetCatalogItems(IEnumerable<int> ids)
{
var data = await _apiClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemsById(ids));
var item = JsonConvert.DeserializeObject<CatalogItem[]>(data);
return item;
}
}
}

+ 0
- 15
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IBasketService.cs View File

@ -1,15 +0,0 @@
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public interface IBasketService
{
Task<BasketData> GetById(string id);
Task Update(BasketData currentBasket);
}
}

+ 0
- 14
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/ICatalogService.cs View File

@ -1,14 +0,0 @@
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public interface ICatalogService
{
Task<CatalogItem> GetCatalogItem(int id);
Task<IEnumerable<CatalogItem>> GetCatalogItems(IEnumerable<int> ids);
}
}

+ 0
- 13
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IOrderApiClient.cs View File

@ -1,13 +0,0 @@
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public interface IOrderApiClient
{
Task<OrderData> GetOrderDraftFromBasket(BasketData basket);
}
}

+ 0
- 37
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderApiClient.cs View File

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{
public class OrderApiClient : IOrderApiClient
{
private readonly IHttpClient _apiClient;
private readonly ILogger<OrderApiClient> _logger;
private readonly UrlsConfig _urls;
public OrderApiClient(IHttpClient httpClient, ILogger<OrderApiClient> logger, IOptionsSnapshot<UrlsConfig> config)
{
_apiClient = httpClient;
_logger = logger;
_urls = config.Value;
}
public async Task<OrderData> GetOrderDraftFromBasket(BasketData basket)
{
var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var response = await _apiClient.PostAsync<BasketData>(url, basket);
response.EnsureSuccessStatusCode();
var jsonResponse = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<OrderData>(jsonResponse);
}
}
}

+ 0
- 138
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs View File

@ -1,138 +0,0 @@
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services;
using Swashbuckle.AspNetCore.Swagger;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IHttpClient, StandardHttpClient>();
services.AddTransient<ICatalogService, CatalogService>();
services.AddTransient<IBasketService, BasketService>();
services.AddTransient<IOrderApiClient, OrderApiClient>();
services.AddOptions();
services.Configure<UrlsConfig>(Configuration.GetSection("urls"));
services.AddMvc();
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
{
Title = "Shopping Aggregator for Mobile Clients",
Version = "v1",
Description = "Shopping Aggregator for Mobile Clients",
TermsOfService = "Terms Of Service"
});
options.AddSecurityDefinition("oauth2", new OAuth2Scheme
{
Type = "oauth2",
Flow = "implicit",
AuthorizationUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize",
TokenUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token",
Scopes = new Dictionary<string, string>()
{
{ "mobileshoppingagg", "Shopping Aggregator for Mobile Clients" }
}
});
options.OperationFilter<AuthorizeCheckOperationFilter>();
});
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var identityUrl = Configuration.GetValue<string>("urls:identity");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
options.Audience = "mobileshoppingagg";
options.Events = new JwtBearerEvents()
{
OnAuthenticationFailed = async ctx =>
{
int i = 0;
},
OnTokenValidated = async ctx =>
{
int i = 0;
}
};
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy");
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAuthentication();
app.UseMvc();
app.UseSwagger().UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Purchase BFF V1");
c.ConfigureOAuth2("Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregatorwaggerui", "", "", "Purchase BFF Swagger UI");
});
}
}
}

+ 0
- 15
src/ApiGateways/Mobile.Bff.Shopping/aggregator/appsettings.json View File

@ -1,15 +0,0 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}

+ 0
- 8
src/ApiGateways/Mobile.Bff.Shopping/aggregator/appsettings.localhost.json View File

@ -1,8 +0,0 @@
{
"urls": {
"basket": "http://localhost:55105",
"catalog": "http://localhost:55101",
"orders": "http://localhost:55102",
"identity": "http://localhost:55105"
}
}

+ 0
- 142
src/ApiGateways/Mobile.Bff.Shopping/apigw/configuration.json View File

@ -1,142 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
"UpstreamHttpMethod": [ "GET" ]
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "mobileshoppingagg",
"Port": 80
}
],
"UpstreamPathTemplate": "/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/marketing-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "payment.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/location-api/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 34
src/ApiGateways/Web.Bff.Marketing/apigw/configuration.json View File

@ -1,34 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 31
src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config
{
public class UrlsConfig
{
public class CatalogOperations
{
public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}";
public static string GetItemsById(IEnumerable<int> ids) => $"/api/v1/catalog/items?ids={string.Join(',', ids)}";
}
public class BasketOperations
{
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
public static string UpdateBasket() => "/api/v1/basket";
}
public class OrdersOperations
{
public static string GetOrderDraft() => "/api/v1/orders/draft";
}
public string Basket { get; set; }
public string Catalog { get; set; }
public string Orders { get; set; }
}
}

+ 0
- 133
src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs View File

@ -1,133 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class BasketController : Controller
{
private readonly ICatalogService _catalog;
private readonly IBasketService _basket;
public BasketController(ICatalogService catalogService, IBasketService basketService)
{
_catalog = catalogService;
_basket = basketService;
}
[HttpPost]
[HttpPut]
public async Task<IActionResult> UpdateAllBasket([FromBody] UpdateBasketRequest data)
{
if (data.Items == null || !data.Items.Any())
{
return BadRequest("Need to pass at least one basket line");
}
// Retrieve the current basket
var currentBasket = await _basket.GetById(data.BuyerId);
if (currentBasket == null)
{
currentBasket = new BasketData(data.BuyerId);
}
var catalogItems = await _catalog.GetCatalogItems(data.Items.Select(x => x.ProductId));
var newBasket = new BasketData(data.BuyerId);
foreach (var bitem in data.Items)
{
var catalogItem = catalogItems.SingleOrDefault(ci => ci.Id == bitem.ProductId);
if (catalogItem == null)
{
return BadRequest($"Basket refers to a non-existing catalog item ({bitem.ProductId})");
}
newBasket.Items.Add(new BasketDataItem()
{
Id = bitem.Id,
ProductId = catalogItem.Id.ToString(),
ProductName = catalogItem.Name,
PictureUrl = catalogItem.PictureUri,
UnitPrice = catalogItem.Price,
Quantity = bitem.Quantity
});
}
await _basket.Update(newBasket);
return Ok(newBasket);
}
[HttpPut]
[Route("items")]
public async Task<IActionResult> UpdateQuantities([FromBody] UpdateBasketItemsRequest data)
{
if (!data.Updates.Any())
{
return BadRequest("No updates sent");
}
// Retrieve the current basket
var currentBasket = await _basket.GetById(data.BasketId);
if (currentBasket == null)
{
return BadRequest($"Basket with id {data.BasketId} not found.");
}
// Update with new quantities
foreach (var update in data.Updates)
{
var basketItem = currentBasket.Items.SingleOrDefault(bitem => bitem.Id == update.BasketItemId);
if (basketItem == null)
{
return BadRequest($"Basket item with id {update.BasketItemId} not found");
}
basketItem.Quantity = update.NewQty;
}
// Save the updated basket
await _basket.Update(currentBasket);
return Ok(currentBasket);
}
[HttpPost]
[Route("items")]
public async Task<IActionResult> AddBasketItem([FromBody] AddBasketItemRequest data)
{
if (data == null || data.Quantity == 0)
{
return BadRequest("Invalid payload");
}
// Step 1: Get the item from catalog
var item = await _catalog.GetCatalogItem(data.CatalogItemId);
//item.PictureUri =
// Step 2: Get current basket status
var currentBasket = (await _basket.GetById(data.BasketId)) ?? new BasketData(data.BasketId);
// Step 3: Merge current status with new product
currentBasket.Items.Add(new BasketDataItem()
{
UnitPrice = item.Price,
PictureUrl = item.PictureUri,
ProductId = item.Id.ToString(),
ProductName = item.Name,
Quantity = data.Quantity,
Id = Guid.NewGuid().ToString()
});
// Step 4: Update basket
await _basket.Update(currentBasket);
return Ok();
}
}
}

+ 0
- 18
src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/HomeController.cs View File

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
{
[Route("")]
public class HomeController : Controller
{
[HttpGet()]
public IActionResult Index()
{
return new RedirectResult("~/swagger");
}
}
}

+ 0
- 42
src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs View File

@ -1,42 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class OrderController : Controller
{
private readonly IBasketService _basketService;
private readonly IOrderApiClient _orderClient;
public OrderController(IBasketService basketService, IOrderApiClient orderClient)
{
_basketService = basketService;
_orderClient = orderClient;
}
[Route("draft/{basketId}")]
[HttpGet]
public async Task<IActionResult> GetOrderDraft(string basketId)
{
if (string.IsNullOrEmpty(basketId))
{
return BadRequest("Need a valid basketid");
}
// Get the basket data and build a order draft based on it
var basket = await _basketService.GetById(basketId);
if (basket == null)
{
return BadRequest($"No basket found for id {basketId}");
}
var orderDraft = await _orderClient.GetOrderDraftFromBasket(basket);
return Ok(orderDraft);
}
}
}

+ 0
- 18
src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile View File

@ -1,18 +0,0 @@
FROM microsoft/aspnetcore:2.0.5 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/ApiGateways/Web.Bff.Shopping/aggregator
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Web.Shopping.HttpAggregator.dll"]

+ 0
- 33
src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs View File

@ -1,33 +0,0 @@
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters
{
using Microsoft.AspNetCore.Authorization;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;
namespace Basket.API.Infrastructure.Filters
{
public class AuthorizeCheckOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
// Check for authorize attribute
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
if (hasAuthorize)
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
operation.Responses.Add("403", new Response { Description = "Forbidden" });
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
{
{ "oauth2", new [] { "Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator" } }
});
}
}
}
}
}

+ 0
- 20
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class AddBasketItemRequest
{
public int CatalogItemId { get; set; }
public string BasketId { get; set; }
public int Quantity { get; set; }
public AddBasketItemRequest()
{
Quantity = 1;
}
}
}

+ 0
- 31
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class BasketData
{
public string BuyerId { get; set; }
public List<BasketDataItem> Items { get; set; }
public BasketData(string buyerId)
{
BuyerId = buyerId;
Items = new List<BasketDataItem>();
}
}
public class BasketDataItem
{
public string Id { get; set; }
public string ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal OldUnitPrice { get; set; }
public int Quantity { get; set; }
public string PictureUrl { get; set; }
}
}

+ 0
- 20
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class CatalogItem
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public string PictureUri { get; set; }
}
}

+ 0
- 33
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderData.cs View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class OrderData
{
public string OrderNumber { get; set; }
public DateTime Date { get; set; }
public string Status { get; set; }
public decimal Total { get; set; }
public string Description { get; set; }
public string City { get; set; }
public string Street { get; set; }
public string State { get; set; }
public string Country { get; set; }
public string ZipCode { get; set; }
public string CardNumber { get; set; }
public string CardHolderName { get; set; }
public bool IsDraft { get; set; }
public DateTime CardExpiration { get; set; }
public string CardExpirationShort { get; set; }
public string CardSecurityNumber { get; set; }
public int CardTypeId { get; set; }
public string Buyer { get; set; }
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
}
}

+ 0
- 17
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderItemData.cs View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class OrderItemData
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public decimal Discount { get; set; }
public int Units { get; set; }
public string PictureUrl { get; set; }
}
}

+ 0
- 31
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class UpdateBasketItemsRequest
{
public string BasketId { get; set; }
public ICollection<UpdateBasketItemData> Updates { get; set; }
public UpdateBasketItemsRequest()
{
Updates = new List<UpdateBasketItemData>();
}
}
public class UpdateBasketItemData
{
public string BasketItemId { get; set; }
public int NewQty { get; set; }
public UpdateBasketItemData()
{
NewQty = 0;
}
}
}

+ 0
- 21
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{
public class UpdateBasketRequest
{
public string BuyerId { get; set; }
public IEnumerable<UpdateBasketRequestItemData> Items { get; set; }
}
public class UpdateBasketRequestItemData
{
public string Id { get; set; } // Basket id
public int ProductId { get; set; } // Catalog item id
public int Quantity { get; set; } // Quantity
}
}

+ 0
- 36
src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs View File

@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost
.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(cb =>
{
var sources = cb.Sources;
sources.Insert(3, new Microsoft.Extensions.Configuration.Json.JsonConfigurationSource()
{
Optional = true,
Path = "appsettings.localhost.json",
ReloadOnChange = false
});
})
.UseStartup<Startup>()
.Build();
}
}

+ 0
- 29
src/ApiGateways/Web.Bff.Shopping/aggregator/Properties/launchSettings.json View File

@ -1,29 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:57425/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"PurchaseForMvc": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:61632/"
}
}
}

+ 0
- 53
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs View File

@ -1,53 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public class BasketService : IBasketService
{
private readonly IHttpClient _apiClient;
private readonly ILogger<BasketService> _logger;
private readonly UrlsConfig _urls;
private readonly IHttpContextAccessor _httpContextAccessor;
public BasketService(IHttpClient httpClient, IHttpContextAccessor httpContextAccessor, ILogger<BasketService> logger, IOptionsSnapshot<UrlsConfig> config)
{
_apiClient = httpClient;
_logger = logger;
_urls = config.Value;
_httpContextAccessor = httpContextAccessor;
}
public async Task<BasketData> GetById(string id)
{
var token = await GetUserTokenAsync();
var data = await _apiClient.GetStringAsync(_urls.Basket + UrlsConfig.BasketOperations.GetItemById(id), token);
var basket = !string.IsNullOrEmpty(data) ? JsonConvert.DeserializeObject<BasketData>(data) : null;
return basket;
}
public async Task Update(BasketData currentBasket)
{
var token = await GetUserTokenAsync();
var data = await _apiClient.PostAsync<BasketData>(_urls.Basket + UrlsConfig.BasketOperations.UpdateBasket(), currentBasket, token);
int i = 0;
}
async Task<string> GetUserTokenAsync()
{
var context = _httpContextAccessor.HttpContext;
return await context.GetTokenAsync("access_token");
}
}
}

+ 0
- 43
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs View File

@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public class CatalogService : ICatalogService
{
private readonly IHttpClient _apiClient;
private readonly ILogger<CatalogService> _logger;
private readonly UrlsConfig _urls;
public CatalogService(IHttpClient httpClient, ILogger<CatalogService> logger, IOptionsSnapshot<UrlsConfig> config)
{
_apiClient = httpClient;
_logger = logger;
_urls = config.Value;
}
public async Task<CatalogItem> GetCatalogItem(int id)
{
var data = await _apiClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemById(id));
var item = JsonConvert.DeserializeObject<CatalogItem>(data);
return item;
}
public async Task<IEnumerable<CatalogItem>> GetCatalogItems(IEnumerable<int> ids)
{
var data = await _apiClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemsById(ids));
var item = JsonConvert.DeserializeObject<CatalogItem[]>(data);
return item;
}
}
}

+ 0
- 15
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IBasketService.cs View File

@ -1,15 +0,0 @@
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public interface IBasketService
{
Task<BasketData> GetById(string id);
Task Update(BasketData currentBasket);
}
}

+ 0
- 14
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/ICatalogService.cs View File

@ -1,14 +0,0 @@
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public interface ICatalogService
{
Task<CatalogItem> GetCatalogItem(int id);
Task<IEnumerable<CatalogItem>> GetCatalogItems(IEnumerable<int> ids);
}
}

+ 0
- 13
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IOrderApiClient.cs View File

@ -1,13 +0,0 @@
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public interface IOrderApiClient
{
Task<OrderData> GetOrderDraftFromBasket(BasketData basket);
}
}

+ 0
- 37
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs View File

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public class OrderApiClient : IOrderApiClient
{
private readonly IHttpClient _apiClient;
private readonly ILogger<OrderApiClient> _logger;
private readonly UrlsConfig _urls;
public OrderApiClient(IHttpClient httpClient, ILogger<OrderApiClient> logger, IOptionsSnapshot<UrlsConfig> config)
{
_apiClient = httpClient;
_logger = logger;
_urls = config.Value;
}
public async Task<OrderData> GetOrderDraftFromBasket(BasketData basket)
{
var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var response = await _apiClient.PostAsync<BasketData>(url, basket);
response.EnsureSuccessStatusCode();
var jsonResponse = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<OrderData>(jsonResponse);
}
}
}

+ 0
- 138
src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs View File

@ -1,138 +0,0 @@
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
using Swashbuckle.AspNetCore.Swagger;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IHttpClient, StandardHttpClient>();
services.AddTransient<ICatalogService, CatalogService>();
services.AddTransient<IBasketService, BasketService>();
services.AddTransient<IOrderApiClient, OrderApiClient>();
services.AddOptions();
services.Configure<UrlsConfig>(Configuration.GetSection("urls"));
services.AddMvc();
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
{
Title = "Shopping Aggregator for Web Clients",
Version = "v1",
Description = "Shopping Aggregator for Web Clients",
TermsOfService = "Terms Of Service"
});
options.AddSecurityDefinition("oauth2", new OAuth2Scheme
{
Type = "oauth2",
Flow = "implicit",
AuthorizationUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize",
TokenUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token",
Scopes = new Dictionary<string, string>()
{
{ "webshoppingagg", "Shopping Aggregator for Web Clients" }
}
});
options.OperationFilter<AuthorizeCheckOperationFilter>();
});
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var identityUrl = Configuration.GetValue<string>("urls:identity");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
options.Audience = "webshoppingagg";
options.Events = new JwtBearerEvents()
{
OnAuthenticationFailed = async ctx =>
{
int i = 0;
},
OnTokenValidated = async ctx =>
{
int i = 0;
}
};
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy");
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAuthentication();
app.UseMvc();
app.UseSwagger().UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Purchase BFF V1");
c.ConfigureOAuth2("Microsoft.eShopOnContainers.Web.Shopping.HttpAggregatorwaggerui", "", "", "Purchase BFF Swagger UI");
});
}
}
}

+ 0
- 27
src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj View File

@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Web.Shopping.HttpAggregator</AssemblyName>
<RootNamespace>Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator</RootNamespace>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\Resilience\Resilience.Http\Resilience.Http.csproj" />
</ItemGroup>
</Project>

+ 0
- 15
src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.json View File

@ -1,15 +0,0 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}

+ 0
- 8
src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.localhost.json View File

@ -1,8 +0,0 @@
{
"urls": {
"basket": "http://localhost:55105",
"catalog": "http://localhost:55101",
"orders": "http://localhost:55102",
"identity": "http://localhost:55105"
}
}

+ 0
- 142
src/ApiGateways/Web.Bff.Shopping/apigw/configuration.json View File

@ -1,142 +0,0 @@
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
"UpstreamHttpMethod": [ "GET" ]
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
"UpstreamHttpMethod": [],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "webshoppingagg",
"Port": 80
}
],
"UpstreamPathTemplate": "/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
"AuthenticationOptions": {
"AuthenticationProviderKey": "IdentityApiKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "ordering.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/orders-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/basket-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/catalog-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "marketing.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/marketing-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "payment.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/payment-api/{everything}",
"UpstreamHttpMethod": []
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "locations.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/location-api/{everything}",
"UpstreamHttpMethod": []
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}

+ 0
- 5
src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs View File

@ -97,11 +97,6 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
throw new HttpRequestException(); throw new HttpRequestException();
} }
if (!response.IsSuccessStatusCode)
{
return null;
}
return await response.Content.ReadAsStringAsync(); return await response.Content.ReadAsStringAsync();
}); });
} }


+ 0
- 5
src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs View File

@ -36,11 +36,6 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
var response = await _client.SendAsync(requestMessage); var response = await _client.SendAsync(requestMessage);
if (!response.IsSuccessStatusCode)
{
return null;
}
return await response.Content.ReadAsStringAsync(); return await response.Content.ReadAsStringAsync();
} }


+ 1
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Extensions/ObservableExtension.cs View File

@ -15,6 +15,7 @@ namespace eShopOnContainers.Core.Extensions
} }
return collection; return collection;
} }
} }
} }

+ 23
- 12
src/Mobile/eShopOnContainers/eShopOnContainers.Core/GlobalSettings.cs View File

@ -4,7 +4,7 @@
{ {
public const string AzureTag = "Azure"; public const string AzureTag = "Azure";
public const string MockTag = "Mock"; public const string MockTag = "Mock";
public const string DefaultEndpoint = "http://YOUR_IP_OR_DNS_NAME"; // i.e.: "http://YOUR_IP" or "http://YOUR_DNS_NAME"
public const string DefaultEndpoint = "http://13.88.8.119";
private string _baseEndpoint; private string _baseEndpoint;
private static readonly GlobalSetting _instance = new GlobalSetting(); private static readonly GlobalSetting _instance = new GlobalSetting();
@ -38,8 +38,18 @@
public string RegisterWebsite { get; set; } public string RegisterWebsite { get; set; }
public string CatalogEndpoint { get; set; }
public string OrdersEndpoint { get; set; }
public string BasketEndpoint { get; set; }
public string IdentityEndpoint { get; set; } public string IdentityEndpoint { get; set; }
public string LocationEndpoint { get; set; }
public string MarketingEndpoint { get; set; }
public string UserInfoEndpoint { get; set; } public string UserInfoEndpoint { get; set; }
public string TokenEndpoint { get; set; } public string TokenEndpoint { get; set; }
@ -52,17 +62,18 @@
private void UpdateEndpoint(string baseEndpoint) private void UpdateEndpoint(string baseEndpoint)
{ {
var identityBaseEndpoint = $"{baseEndpoint}/identity";
RegisterWebsite = $"{identityBaseEndpoint}/Account/Register";
LogoutCallback = $"{identityBaseEndpoint}/Account/Redirecting";
var connectBaseEndpoint = $"{identityBaseEndpoint}/connect";
IdentityEndpoint = $"{connectBaseEndpoint}/authorize";
UserInfoEndpoint = $"{connectBaseEndpoint}/userinfo";
TokenEndpoint = $"{connectBaseEndpoint}/token";
LogoutEndpoint = $"{connectBaseEndpoint}/endsession";
IdentityCallback = $"{baseEndpoint}/xamarincallback";
RegisterWebsite = $"{baseEndpoint}:5105/Account/Register";
CatalogEndpoint = $"{baseEndpoint}:5101";
OrdersEndpoint = $"{baseEndpoint}:5102";
BasketEndpoint = $"{baseEndpoint}:5103";
IdentityEndpoint = $"{baseEndpoint}:5105/connect/authorize";
UserInfoEndpoint = $"{baseEndpoint}:5105/connect/userinfo";
TokenEndpoint = $"{baseEndpoint}:5105/connect/token";
LogoutEndpoint = $"{baseEndpoint}:5105/connect/endsession";
IdentityCallback = $"{baseEndpoint}:5105/xamarincallback";
LogoutCallback = $"{baseEndpoint}:5105/Account/Redirecting";
LocationEndpoint = $"{baseEndpoint}:5109";
MarketingEndpoint = $"{baseEndpoint}:5110";
} }
} }
} }

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

@ -11,7 +11,7 @@ namespace eShopOnContainers.Core.Services.Basket
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private readonly IFixUriService _fixUriService; private readonly IFixUriService _fixUriService;
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/b/basket";
private const string ApiUrlBase = "api/v1/basket";
public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService) public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService)
{ {
@ -21,23 +21,15 @@ namespace eShopOnContainers.Core.Services.Basket
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token) public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
{ {
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
{ {
Path = $"{ApiUrlBase}/{guidUser}" Path = $"{ApiUrlBase}/{guidUser}"
}; };
var uri = builder.ToString(); var uri = builder.ToString();
CustomerBasket basket;
try
{
basket = await _requestProvider.GetAsync<CustomerBasket>(uri, token);
}
catch (HttpRequestExceptionEx exception) when (exception.HttpCode == System.Net.HttpStatusCode.NotFound)
{
basket = null;
}
CustomerBasket basket =
await _requestProvider.GetAsync<CustomerBasket>(uri, token);
_fixUriService.FixBasketItemPictureUri(basket?.Items); _fixUriService.FixBasketItemPictureUri(basket?.Items);
return basket; return basket;
@ -45,7 +37,7 @@ namespace eShopOnContainers.Core.Services.Basket
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token) public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
{ {
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
{ {
Path = ApiUrlBase Path = ApiUrlBase
}; };
@ -57,7 +49,7 @@ namespace eShopOnContainers.Core.Services.Basket
public async Task CheckoutAsync(BasketCheckout basketCheckout, string token) public async Task CheckoutAsync(BasketCheckout basketCheckout, string token)
{ {
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
{ {
Path = $"{ApiUrlBase}/checkout" Path = $"{ApiUrlBase}/checkout"
}; };
@ -68,7 +60,7 @@ namespace eShopOnContainers.Core.Services.Basket
public async Task ClearBasketAsync(string guidUser, string token) public async Task ClearBasketAsync(string guidUser, string token)
{ {
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
var builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint)
{ {
Path = $"{ApiUrlBase}/{guidUser}" Path = $"{ApiUrlBase}/{guidUser}"
}; };


+ 8
- 10
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs View File

@ -13,8 +13,6 @@ namespace eShopOnContainers.Core.Services.Catalog
{ {
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private readonly IFixUriService _fixUriService; private readonly IFixUriService _fixUriService;
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/c/catalog";
public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService) public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService)
{ {
@ -24,8 +22,8 @@ namespace eShopOnContainers.Core.Services.Catalog
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId) public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = $"{ApiUrlBase}/items/type/{catalogTypeId}/brand/{catalogBrandId}";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
string uri = builder.ToString(); string uri = builder.ToString();
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri); CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri);
@ -38,8 +36,8 @@ namespace eShopOnContainers.Core.Services.Catalog
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync() public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = $"{ApiUrlBase}/items";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
builder.Path = "api/v1/catalog/items";
string uri = builder.ToString(); string uri = builder.ToString();
CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri); CatalogRoot catalog = await _requestProvider.GetAsync<CatalogRoot>(uri);
@ -55,8 +53,8 @@ namespace eShopOnContainers.Core.Services.Catalog
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync() public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = $"{ApiUrlBase}/catalogbrands";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
builder.Path = "api/v1/catalog/catalogbrands";
string uri = builder.ToString(); string uri = builder.ToString();
IEnumerable<CatalogBrand> brands = await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri); IEnumerable<CatalogBrand> brands = await _requestProvider.GetAsync<IEnumerable<CatalogBrand>>(uri);
@ -69,8 +67,8 @@ namespace eShopOnContainers.Core.Services.Catalog
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync() public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = $"{ApiUrlBase}/catalogtypes";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
builder.Path = "api/v1/catalog/catalogtypes";
string uri = builder.ToString(); string uri = builder.ToString();
IEnumerable<CatalogType> types = await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri); IEnumerable<CatalogType> types = await _requestProvider.GetAsync<IEnumerable<CatalogType>>(uri);


+ 2
- 2
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs View File

@ -15,8 +15,8 @@ namespace eShopOnContainers.Core.Services.Location
public async Task UpdateUserLocation(eShopOnContainers.Core.Models.Location.Location newLocReq, string token) public async Task UpdateUserLocation(eShopOnContainers.Core.Models.Location.Location newLocReq, string token)
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = "/mobilemarketingapigw/api/v1/l/locations";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.LocationEndpoint);
builder.Path = "api/v1/locations";
string uri = builder.ToString(); string uri = builder.ToString();
await _requestProvider.PostAsync(uri, newLocReq, token); await _requestProvider.PostAsync(uri, newLocReq, token);
} }


+ 4
- 6
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Marketing/CampaignService.cs View File

@ -13,8 +13,6 @@ namespace eShopOnContainers.Core.Services.Marketing
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private readonly IFixUriService _fixUriService; private readonly IFixUriService _fixUriService;
private const string ApiUrlBase = "mobilemarketingapigw/api/v1/m/campaigns";
public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService) public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService)
{ {
_requestProvider = requestProvider; _requestProvider = requestProvider;
@ -23,8 +21,8 @@ namespace eShopOnContainers.Core.Services.Marketing
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token) public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = $"{ApiUrlBase}/user";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.MarketingEndpoint);
builder.Path = "api/v1/campaigns/user";
string uri = builder.ToString(); string uri = builder.ToString();
CampaignRoot campaign = await _requestProvider.GetAsync<CampaignRoot>(uri, token); CampaignRoot campaign = await _requestProvider.GetAsync<CampaignRoot>(uri, token);
@ -40,8 +38,8 @@ namespace eShopOnContainers.Core.Services.Marketing
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token) public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
builder.Path = $"{ApiUrlBase}/{campaignId}";
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.MarketingEndpoint);
builder.Path = $"api/v1/campaigns/{campaignId}";
string uri = builder.ToString(); string uri = builder.ToString();
return await _requestProvider.GetAsync<CampaignItem>(uri, token); return await _requestProvider.GetAsync<CampaignItem>(uri, token);
} }


+ 6
- 8
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs View File

@ -11,8 +11,6 @@ namespace eShopOnContainers.Core.Services.Order
{ {
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/o/orders";
public OrderService(IRequestProvider requestProvider) public OrderService(IRequestProvider requestProvider)
{ {
_requestProvider = requestProvider; _requestProvider = requestProvider;
@ -25,9 +23,9 @@ namespace eShopOnContainers.Core.Services.Order
public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token) public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token)
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
builder.Path = ApiUrlBase;
builder.Path = "api/v1/orders";
string uri = builder.ToString(); string uri = builder.ToString();
@ -42,9 +40,9 @@ namespace eShopOnContainers.Core.Services.Order
{ {
try try
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
builder.Path = $"{ApiUrlBase}/{orderId}";
builder.Path = string.Format("api/v1/orders/{0}", orderId);
string uri = builder.ToString(); string uri = builder.ToString();
@ -78,9 +76,9 @@ namespace eShopOnContainers.Core.Services.Order
public async Task<bool> CancelOrderAsync(int orderId, string token) public async Task<bool> CancelOrderAsync(int orderId, string token)
{ {
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
builder.Path = $"{ApiUrlBase}/cancel";
builder.Path = "api/v1/orders/cancel";
var cancelOrderCommand = new CancelOrderCommand(orderId); var cancelOrderCommand = new CancelOrderCommand(orderId);


+ 1
- 8
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Settings/ISettingsService.cs View File

@ -1,6 +1,4 @@
using System.Threading.Tasks;
namespace eShopOnContainers.Core.Services.Settings
namespace eShopOnContainers.Core.Services.Settings
{ {
public interface ISettingsService public interface ISettingsService
{ {
@ -12,10 +10,5 @@ namespace eShopOnContainers.Core.Services.Settings
string Latitude { get; set; } string Latitude { get; set; }
string Longitude { get; set; } string Longitude { get; set; }
bool AllowGpsLocation { get; set; } bool AllowGpsLocation { get; set; }
bool GetValueOrDefault(string key, bool defaultValue);
string GetValueOrDefault(string key, string defaultValue);
Task AddOrUpdateValue(string key, bool value);
Task AddOrUpdateValue(string key, string value);
} }
} }

+ 13
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Settings/ISettingsServiceImplementation.cs View File

@ -0,0 +1,13 @@
namespace eShopOnContainers.Core.Services.Settings
{
public interface ISettingsServiceImplementation
{
bool GetValueOrDefault(string key, bool defaultValue);
string GetValueOrDefault(string key, string defaultValue);
bool AddOrUpdateValue(string key, bool value);
bool AddOrUpdateValue(string key, string value);
void Remove(string key);
}
}

+ 29
- 80
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Settings/SettingsService.cs View File

@ -1,11 +1,21 @@
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using eShopOnContainers.Core.Services.Dependency;
namespace eShopOnContainers.Core.Services.Settings namespace eShopOnContainers.Core.Services.Settings
{ {
public class SettingsService : ISettingsService public class SettingsService : ISettingsService
{ {
private readonly ISettingsServiceImplementation _settingsService;
ISettingsServiceImplementation AppSettings
{
get { return _settingsService; }
}
public SettingsService(IDependencyService dependencyService)
{
_settingsService = dependencyService.Get<ISettingsServiceImplementation>();
}
#region Setting Constants #region Setting Constants
private const string AccessToken = "access_token"; private const string AccessToken = "access_token";
@ -27,113 +37,52 @@ namespace eShopOnContainers.Core.Services.Settings
#endregion #endregion
#region Settings Properties
public string AuthAccessToken public string AuthAccessToken
{ {
get => GetValueOrDefault(AccessToken, AccessTokenDefault);
set => AddOrUpdateValue(AccessToken, value);
get => AppSettings.GetValueOrDefault(AccessToken, AccessTokenDefault);
set => AppSettings.AddOrUpdateValue(AccessToken, value);
} }
public string AuthIdToken public string AuthIdToken
{ {
get => GetValueOrDefault(IdToken, IdTokenDefault);
set => AddOrUpdateValue(IdToken, value);
get => AppSettings.GetValueOrDefault(IdToken, IdTokenDefault);
set => AppSettings.AddOrUpdateValue(IdToken, value);
} }
public bool UseMocks public bool UseMocks
{ {
get => GetValueOrDefault(IdUseMocks, UseMocksDefault);
set => AddOrUpdateValue(IdUseMocks, value);
get => AppSettings.GetValueOrDefault(IdUseMocks, UseMocksDefault);
set => AppSettings.AddOrUpdateValue(IdUseMocks, value);
} }
public string UrlBase public string UrlBase
{ {
get => GetValueOrDefault(IdUrlBase, UrlBaseDefault);
set => AddOrUpdateValue(IdUrlBase, value);
get => AppSettings.GetValueOrDefault(IdUrlBase, UrlBaseDefault);
set => AppSettings.AddOrUpdateValue(IdUrlBase, value);
} }
public bool UseFakeLocation public bool UseFakeLocation
{ {
get => GetValueOrDefault(IdUseFakeLocation, UseFakeLocationDefault);
set => AddOrUpdateValue(IdUseFakeLocation, value);
get => AppSettings.GetValueOrDefault(IdUseFakeLocation, UseFakeLocationDefault);
set => AppSettings.AddOrUpdateValue(IdUseFakeLocation, value);
} }
public string Latitude public string Latitude
{ {
get => GetValueOrDefault(IdLatitude, FakeLatitudeDefault.ToString());
set => AddOrUpdateValue(IdLatitude, value);
get => AppSettings.GetValueOrDefault(IdLatitude, FakeLatitudeDefault.ToString());
set => AppSettings.AddOrUpdateValue(IdLatitude, value);
} }
public string Longitude public string Longitude
{ {
get => GetValueOrDefault(IdLongitude, FakeLongitudeDefault.ToString());
set => AddOrUpdateValue(IdLongitude, value);
get => AppSettings.GetValueOrDefault(IdLongitude, FakeLongitudeDefault.ToString());
set => AppSettings.AddOrUpdateValue(IdLongitude, value);
} }
public bool AllowGpsLocation public bool AllowGpsLocation
{ {
get => GetValueOrDefault(IdAllowGpsLocation, AllowGpsLocationDefault);
set => AddOrUpdateValue(IdAllowGpsLocation, value);
get => AppSettings.GetValueOrDefault(IdAllowGpsLocation, AllowGpsLocationDefault);
set => AppSettings.AddOrUpdateValue(IdAllowGpsLocation, value);
} }
#endregion
#region Public Methods
public Task AddOrUpdateValue(string key, bool value) => AddOrUpdateValueInternal(key, value);
public Task AddOrUpdateValue(string key, string value) => AddOrUpdateValueInternal(key, value);
public bool GetValueOrDefault(string key, bool defaultValue) => GetValueOrDefaultInternal(key, defaultValue);
public string GetValueOrDefault(string key, string defaultValue) => GetValueOrDefaultInternal(key, defaultValue);
#endregion
#region Internal Implementation
async Task AddOrUpdateValueInternal<T>(string key, T value)
{
if (value == null)
{
await Remove(key);
}
Application.Current.Properties[key] = value;
try
{
await Application.Current.SavePropertiesAsync();
}
catch (Exception ex)
{
Console.WriteLine("Unable to save: " + key, " Message: " + ex.Message);
}
}
T GetValueOrDefaultInternal<T>(string key, T defaultValue = default(T))
{
object value = null;
if (Application.Current.Properties.ContainsKey(key))
{
value = Application.Current.Properties[key];
}
return null != value ? (T)value : defaultValue;
}
async Task Remove(string key)
{
try
{
if (Application.Current.Properties[key] != null)
{
Application.Current.Properties.Remove(key);
await Application.Current.SavePropertiesAsync();
}
}
catch (Exception ex)
{
Console.WriteLine("Unable to remove: " + key, " Message: " + ex.Message);
}
}
#endregion
} }
} }

+ 21
- 7
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml View File

@ -337,14 +337,28 @@
Grid.RowSpan="2" Grid.RowSpan="2"
IsVisible="{Binding IsLogin}"> IsVisible="{Binding IsLogin}">
<WebView <WebView
Source="{Binding LoginUrl}"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All">
Source="{Binding LoginUrl}"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All">
<WebView.Behaviors> <WebView.Behaviors>
<behaviors:EventToCommandBehavior
EventName="Navigating"
EventArgsConverter="{StaticResource WebNavigatingEventArgsConverter}"
Command="{Binding NavigateCommand}" />
<OnPlatform x:TypeArguments="Behavior">
<On Platform="iOS, Android">
<On.Value>
<behaviors:EventToCommandBehavior
EventName="Navigating"
EventArgsConverter="{StaticResource WebNavigatingEventArgsConverter}"
Command="{Binding NavigateCommand}" />
</On.Value>
</On>
<On Platform="UWP">
<On.Value>
<behaviors:EventToCommandBehavior
EventName="Navigated"
EventArgsConverter="{StaticResource WebNavigatedEventArgsConverter}"
Command="{Binding NavigateCommand}" />
</On.Value>
</On>
</OnPlatform>
</WebView.Behaviors> </WebView.Behaviors>
</WebView> </WebView>
</AbsoluteLayout> </AbsoluteLayout>


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Extensions/LocationExtensions.cs View File

@ -32,7 +32,7 @@ namespace eShopOnContainers.Droid.Extensions
{ {
return new DateTimeOffset(Epoch.AddMilliseconds(location.Time)); return new DateTimeOffset(Epoch.AddMilliseconds(location.Time));
} }
catch (Exception)
catch (Exception e)
{ {
return new DateTimeOffset(Epoch); return new DateTimeOffset(Epoch);
} }


+ 149
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Services/SettingsServiceImplementation.cs View File

@ -0,0 +1,149 @@
using Android.App;
using Android.Content;
using Android.Preferences;
using eShopOnContainers.Core.Services.Settings;
using eShopOnContainers.Droid.Services;
using System;
[assembly: Xamarin.Forms.Dependency(typeof(SettingsServiceImplementation))]
namespace eShopOnContainers.Droid.Services
{
public class SettingsServiceImplementation : ISettingsServiceImplementation
{
#region Internal Implementation
readonly object _locker = new object();
ISharedPreferences GetSharedPreference()
{
return PreferenceManager.GetDefaultSharedPreferences(Application.Context);
}
bool AddOrUpdateValueInternal<T>(string key, T value)
{
if (Application.Context == null)
return false;
if (value == null)
{
Remove(key);
return true;
}
var type = typeof(T);
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
{
type = Nullable.GetUnderlyingType(type);
}
var typeCode = Type.GetTypeCode(type);
lock (_locker)
{
using (var sharedPrefs = GetSharedPreference())
{
using (var editor = sharedPrefs.Edit())
{
switch (typeCode)
{
case TypeCode.Boolean:
editor.PutBoolean(key, Convert.ToBoolean(value));
break;
case TypeCode.String:
editor.PutString(key, Convert.ToString(value));
break;
default:
throw new ArgumentException($"Value of type {typeCode} is not supported.");
}
editor.Commit();
}
}
}
return true;
}
T GetValueOrDefaultInternal<T>(string key, T defaultValue = default(T))
{
if (Application.Context == null)
return defaultValue;
if (!Contains(key))
return defaultValue;
lock (_locker)
{
using (var sharedPrefs = GetSharedPreference())
{
var type = typeof(T);
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
{
type = Nullable.GetUnderlyingType(type);
}
object value = null;
var typeCode = Type.GetTypeCode(type);
switch (typeCode)
{
case TypeCode.Boolean:
value = sharedPrefs.GetBoolean(key, Convert.ToBoolean(defaultValue));
break;
case TypeCode.String:
value = sharedPrefs.GetString(key, Convert.ToString(defaultValue));
break;
default:
throw new ArgumentException($"Value of type {typeCode} is not supported.");
}
return null != value ? (T)value : defaultValue;
}
}
}
bool Contains(string key)
{
if (Application.Context == null)
return false;
lock (_locker)
{
using (var sharedPrefs = GetSharedPreference())
{
if (sharedPrefs == null)
return false;
return sharedPrefs.Contains(key);
}
}
}
#endregion
#region ISettingsServiceImplementation
public bool AddOrUpdateValue(string key, bool value) => AddOrUpdateValueInternal(key, value);
public bool AddOrUpdateValue(string key, string value) => AddOrUpdateValueInternal(key, value);
public bool GetValueOrDefault(string key, bool defaultValue) => GetValueOrDefaultInternal(key, defaultValue);
public string GetValueOrDefault(string key, string defaultValue) => GetValueOrDefaultInternal(key, defaultValue);
public void Remove(string key)
{
if (Application.Context == null)
return;
lock (_locker)
{
using (var sharedPrefs = GetSharedPreference())
{
using (var editor = sharedPrefs.Edit())
{
editor.Remove(key);
editor.Commit();
}
}
}
}
#endregion
}
}

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

Loading…
Cancel
Save