Browse Source

Merge pull request #1 from dotnet-architecture/dev

UPDATE
pull/936/head
GongYunhao 6 years ago
committed by GitHub
parent
commit
5c9ae2bfe3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
251 changed files with 3718 additions and 3401 deletions
  1. +3
    -0
      .gitignore
  2. +3
    -0
      NuGet.config
  3. +4
    -4
      README.md
  4. +247
    -0
      docker-compose-tests.override.yml
  5. +130
    -0
      docker-compose-tests.yml
  6. +87
    -22
      docker-compose.override.yml
  7. BIN
      docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)-v2.1.02.pdf
  8. BIN
      docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)-v2.1.03.pdf
  9. BIN
      docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook).pdf
  10. +0
    -207
      eShopOnContainers-ServicesAndWebApps.sln
  11. +1
    -1
      global.json
  12. +1
    -3
      k8s/deploy-ingress-azure.ps1
  13. +2
    -0
      k8s/deploy-ingress-dockerlocal.ps1
  14. +1
    -8
      k8s/deploy-ingress.ps1
  15. +4
    -0
      k8s/deploy.ps1
  16. +18
    -0
      k8s/helm-rbac.yaml
  17. +7
    -0
      k8s/helm/apigwmm/templates/configmap.yaml
  18. +14
    -0
      k8s/helm/apigwmm/values.yaml
  19. +7
    -0
      k8s/helm/apigwms/templates/configmap.yaml
  20. +14
    -0
      k8s/helm/apigwms/values.yaml
  21. +7
    -0
      k8s/helm/apigwwm/templates/configmap.yaml
  22. +14
    -0
      k8s/helm/apigwwm/values.yaml
  23. +7
    -0
      k8s/helm/apigwws/templates/configmap.yaml
  24. +14
    -0
      k8s/helm/apigwws/values.yaml
  25. +13
    -5
      k8s/helm/deploy-all.ps1
  26. +2
    -0
      k8s/helm/inf.yaml
  27. +5
    -0
      k8s/helm/ingress_values_dockerk8s.yaml
  28. +4
    -2
      k8s/helm/marketing-api/templates/configmap.yaml
  29. +4
    -2
      k8s/helm/marketing-api/values.yaml
  30. +7
    -0
      k8s/helm/mobileshoppingagg/templates/configmap.yaml
  31. +14
    -0
      k8s/helm/mobileshoppingagg/values.yaml
  32. +2
    -5
      k8s/helm/webmvc/templates/configmap.yaml
  33. +3
    -9
      k8s/helm/webmvc/values.yaml
  34. +7
    -0
      k8s/helm/webshoppingagg/templates/configmap.yaml
  35. +14
    -0
      k8s/helm/webshoppingagg/values.yaml
  36. +2
    -5
      k8s/helm/webspa/templates/configmap.yaml
  37. +3
    -9
      k8s/helm/webspa/values.yaml
  38. +29
    -10
      k8s/helm/webstatus/templates/configmap.yaml
  39. +66
    -18
      k8s/helm/webstatus/values.yaml
  40. +0
    -19
      k8s/nginx-ingress/azure/service.yaml
  41. +21
    -0
      k8s/nginx-ingress/cloud-generic.yaml
  42. BIN
      k8s/nginx-ingress/cm.yaml
  43. +0
    -11
      k8s/nginx-ingress/configmap.yaml
  44. +0
    -52
      k8s/nginx-ingress/default-backend.yaml
  45. +3
    -0
      k8s/nginx-ingress/local-dockerk8s/identityapi-cm-fix.yaml
  46. +3
    -0
      k8s/nginx-ingress/local-dockerk8s/mvc-cm-fix.yaml
  47. +39
    -0
      k8s/nginx-ingress/local-dockerk8s/mvc-fix.yaml
  48. +238
    -0
      k8s/nginx-ingress/mandatory.yaml
  49. +0
    -4
      k8s/nginx-ingress/namespace.yaml
  50. +0
    -40
      k8s/nginx-ingress/patch-service-without-rbac.yaml
  51. +0
    -7
      k8s/nginx-ingress/publish-service-patch.yaml
  52. +22
    -0
      k8s/nginx-ingress/service-nodeport.yaml
  53. +0
    -5
      k8s/nginx-ingress/tcp-services-configmap.yaml
  54. +0
    -5
      k8s/nginx-ingress/udp-services-configmap.yaml
  55. +0
    -61
      k8s/nginx-ingress/without-rbac.yaml
  56. +3
    -4
      src/ApiGateways/ApiGw-Base/Dockerfile
  57. +9
    -3
      src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj
  58. +9
    -1
      src/ApiGateways/ApiGw-Base/Program.cs
  59. +29
    -9
      src/ApiGateways/ApiGw-Base/Startup.cs
  60. +28
    -16
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/BasketController.cs
  61. +11
    -8
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/OrderController.cs
  62. +2
    -2
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile
  63. +8
    -2
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj
  64. +8
    -0
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs
  65. +2
    -2
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs
  66. +2
    -2
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs
  67. +3
    -5
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IBasketService.cs
  68. +3
    -4
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/ICatalogService.cs
  69. +1
    -4
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IOrderApiClient.cs
  70. +1
    -1
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderApiClient.cs
  71. +39
    -7
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs
  72. +25
    -16
      src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs
  73. +10
    -5
      src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs
  74. +2
    -2
      src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile
  75. +8
    -0
      src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs
  76. +4
    -4
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs
  77. +4
    -7
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs
  78. +2
    -5
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IBasketService.cs
  79. +3
    -4
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/ICatalogService.cs
  80. +1
    -4
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IOrderApiClient.cs
  81. +1
    -2
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs
  82. +43
    -10
      src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs
  83. +8
    -3
      src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj
  84. +13
    -2
      src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs
  85. +9
    -6
      src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs
  86. +3
    -1
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
  87. +1
    -1
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
  88. +4
    -2
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
  89. +1
    -1
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
  90. +3
    -2
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/EventStateEnum.cs
  91. +4
    -4
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj
  92. +14
    -1
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEntry.cs
  93. +4
    -1
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IIntegrationEventLogService.cs
  94. +41
    -4
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs
  95. +0
    -76
      src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckMiddleware.cs
  96. +0
    -45
      src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckStartupFilter.cs
  97. +0
    -47
      src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckWebHostBuilderExtension.cs
  98. +0
    -38
      src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckWebHostExtensions.cs
  99. +0
    -19
      src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj
  100. +0
    -175
      src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/AzureHealthCheckBuilderExtensions.cs

+ 3
- 0
.gitignore View File

@ -263,3 +263,6 @@ pub/
/src/Web/WebMVC/wwwroot/css/site.min.css
**/.kube/**
.mfractor
# Ignore HealthCheckdb
*healthchecksdb*

+ 3
- 0
NuGet.config View File

@ -4,6 +4,9 @@
<add key="repositoryPath" value="packages" />
</config>
<packageSources>
<add key="Preview-aspnetcore-tools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json"/>
<add key="Preview-aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json"/>
<add key="Preview-aspnetcore" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"/>
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>

+ 4
- 4
README.md View File

@ -2,15 +2,15 @@
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers.
## IMPORTANT NOTES!
**The current supported Visual Studio version for eShopOnContainers is Visual Studio 2017 15.7** ([GA/RTM since May 8th 2018](https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes)) or later version.
**You can use either the latest version of Visual Studio or simply Docker CLI and .NET CLI for Windows, Mac and Linux**.
**Note for Pull Requests (PRs)**: We accept pull request from the community. When doing it, please do it onto the **DEV branch** which is the consolidated work-in-progress branch. Do not request it onto Master branch, if possible.
**NEWS / ANNOUNCEMENTS**
Do you want to be up-to-date on .NET Architecture guidance and reference apps like eShopOnContainers? --> Subscribe by "WATCHING" this new GitHub repo: https://github.com/dotnet-architecture/News
## Updated for .NET Core 2.0 and 2.1 "wave" of technologies
eShopOnContainers is updated to .NET Core 2.0 and 2.1 "wave". Not just compilation but also new recommended code in EF Core, ASP.NET Core, and other new related versions.
## Updated for .NET Core 2.2 "wave" of technologies
eShopOnContainers is updated to .NET Core 2.x (currently updated to 2.2) "wave" of technologies. Not just compilation but also new recommended code in EF Core, ASP.NET Core, and other new related versions.
The **dockerfiles** in the solution have also been updated and now support [**Docker Multi-Stage**](https://blogs.msdn.microsoft.com/stevelasker/2017/09/11/net-and-multistage-dockerfiles/) since mid-December 2017.
@ -70,7 +70,7 @@ You can download them and start reviewing these Guides/eBooks here:
| Architecting & Developing | Containers Lifecycle & CI/CD | App patterns with Xamarin.Forms |
| ------------ | ------------| ------------|
| <a href='https://aka.ms/microservicesebook'><img src="img/ebook_arch_dev_microservices_containers_cover.png"> </a> | <a href='https://aka.ms/dockerlifecycleebook'> <img src="img/ebook_containers_lifecycle.png"> </a> | <a href='https://aka.ms/xamarinpatternsebook'> <img src="img/xamarin-enterprise-patterns-ebook-cover-small.png"> </a> |
| <sup> <a href='https://aka.ms/microservicesebook'>**Download .PDF** (v2.1 Edition)</a> </sup> | <sup> <a href='https://aka.ms/dockerlifecycleebook'>**Download** </a> </sup> | <sup> <a href='https://aka.ms/xamarinpatternsebook'>**Download** </a> </sup> |
| <sup> <a href='https://aka.ms/microservicesebook'>**Download .PDF** (v2.2 Edition)</a> </sup> | <sup> <a href='https://aka.ms/dockerlifecycleebook'>**Download** </a> </sup> | <sup> <a href='https://aka.ms/xamarinpatternsebook'>**Download** </a> </sup> |
Download in other formats (**eReaders** like **MOBI**, **EPUB**) and other eBooks at the [.NET Architecture center](http://dot.net/architecture).


+ 247
- 0
docker-compose-tests.override.yml View File

@ -0,0 +1,247 @@
version: '3.4'
services:
rabbitmq-test:
ports:
- "15672:15672"
- "5672:5672"
sql-data-test:
environment:
- SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
ports:
- "5433:1433"
nosql-data-test:
ports:
- "27017:27017"
basket-data-test:
ports:
- "6379:6379"
identity-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104
- XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback
- ConnectionString=${ESHOP_AZURE_IDENTITY_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word}
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100
- LocationApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5109
- MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
- 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
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5105:80"
basket-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket-data-test}
- identityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5103:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/basket-test-results.xml
basket-api-unit-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket-data-test}
- identityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5113:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/basket-unit-test-results.xml
catalog-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/api/v1/c/catalog/items/[0]/pic/}
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5101:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/catalog-test-results.xml
catalog-api-unit-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/api/v1/c/catalog/items/[0]/pic/}
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5191:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/catalog-unit-test-results.xml
ordering-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word}
- identityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- CheckUpdateTime=30000
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5102:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/ordering-test-results.xml
ordering-api-unit-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word}
- identityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- CheckUpdateTime=30000
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5112:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/ordering-unit-test-results.xml
marketing-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word}
- MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql-data-test}
- MongoDatabase=MarketingDb
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- identityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING_URL:-http://localhost:5110/api/v1/campaigns/[0]/pic/}
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME}
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5110:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/marketing-test-results.xml
payment-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
- "5108:80"
locations-api-test:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql-data-test}
- Database=LocationsDb
- identityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
ports:
- "5109:80"
entrypoint:
- dotnet
- test
- --logger
- trx;LogFileName=/tests/locations-test-results.xml

+ 130
- 0
docker-compose-tests.yml View File

@ -0,0 +1,130 @@
version: '3.4'
services:
rabbitmq-test:
image: rabbitmq:3-management-alpine
basket-data-test:
image: redis:alpine
sql-data-test:
image: microsoft/mssql-server-linux:2017-latest
nosql-data-test:
image: mongo
identity-api-test:
image: eshop/identity-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Identity/Identity.API/Dockerfile
depends_on:
- sql-data-test
basket-api-test:
image: eshop/basket-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Basket/Basket.API/Dockerfile
target: functionaltest
depends_on:
- basket-data-test
- identity-api-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
basket-api-unit-test:
image: eshop/basket-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Basket/Basket.API/Dockerfile
target: unittest
depends_on:
- basket-data-test
- identity-api-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
catalog-api-test:
image: eshop/catalog-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Catalog/Catalog.API/Dockerfile
target: functionaltest
depends_on:
- sql-data-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
catalog-api-unit-test:
image: eshop/catalog-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Catalog/Catalog.API/Dockerfile
target: unittest
depends_on:
- sql-data-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
ordering-api-test:
image: eshop/ordering-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Ordering/Ordering.API/Dockerfile
target: functionaltest
depends_on:
- sql-data-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
ordering-api-unit-test:
image: eshop/ordering-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Ordering/Ordering.API/Dockerfile
target: unittest
depends_on:
- sql-data-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
marketing-api-test:
image: eshop/marketing-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Marketing/Marketing.API/Dockerfile
target: functionaltest
depends_on:
- sql-data-test
- nosql-data-test
- identity-api-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests
payment-api-test:
image: eshop/payment-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Payment/Payment.API/Dockerfile
depends_on:
- rabbitmq-test
locations-api-test:
image: eshop/locations-api-test:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Location/Locations.API/Dockerfile
target: functionaltest
depends_on:
- nosql-data-test
- rabbitmq-test
volumes:
- ${BUILD_ARTIFACTSTAGINGDIRECTORY:-./tests-results/}:/tests

+ 87
- 22
docker-compose.override.yml View File

@ -187,6 +187,17 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- urls__basket=http://basket.api
- urls__catalog=http://catalog.api
- urls__orders=http://ordering.api
- urls__identity=http://identity.api
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- LocationUrlHC=http://locations.api/hc
ports:
- "5200:80"
volumes:
@ -196,6 +207,13 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- LocationUrlHC=http://locations.api/hc
ports:
- "5201:80"
volumes:
@ -205,6 +223,13 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- LocationUrlHC=http://locations.api/hc
ports:
- "5202:80"
volumes:
@ -214,6 +239,13 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- LocationUrlHC=http://locations.api/hc
ports:
- "5203:80"
volumes:
@ -226,6 +258,13 @@ services:
- 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.
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- LocationUrlHC=http://locations.api/hc
ports:
- "5120:80" # Important: In a production environment your should remove the external port (5120) kept here for microservice debugging purposes.
# The API Gateway redirects and access through the internal port (80).
@ -237,6 +276,13 @@ services:
- 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.
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- LocationUrlHC=http://locations.api/hc
ports:
- "5121:80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes.
# The API Gateway redirects and access through the internal port (80).
@ -259,16 +305,41 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- CatalogUrl=http://catalog.api/hc
- OrderingUrl=http://ordering.api/hc
- HealthChecks-UI__HealthChecks__1__Name=WebMVC HTTP Check
- HealthChecks-UI__HealthChecks__1__Uri=http://webmvc/hc
- HealthChecks-UI__HealthChecks__2__Name=WebSPA HTTP Check
- HealthChecks-UI__HealthChecks__2__Uri=http://webspa/hc
- HealthChecks-UI__HealthChecks__3__Name=Web Shopping Aggregator GW HTTP Check
- HealthChecks-UI__HealthChecks__3__Uri=http://webshoppingagg/hc
- HealthChecks-UI__HealthChecks__4__Name=Mobile Shopping Aggregator HTTP Check
- HealthChecks-UI__HealthChecks__4__Uri=http://mobileshoppingagg/hc
- HealthChecks-UI__HealthChecks__5__Name=Mobile Shopping API GW HTTP Check
- HealthChecks-UI__HealthChecks__5__Uri=http://mobileshoppingapigw/hc
- HealthChecks-UI__HealthChecks__6__Name=Mobile Marketing API GW HTTP Check
- HealthChecks-UI__HealthChecks__6__Uri=http://mobilemarketingapigw/hc
- HealthChecks-UI__HealthChecks__7__Name=Web Shopping API GW HTTP Check
- HealthChecks-UI__HealthChecks__7__Uri=http://webshoppingapigw/hc
- HealthChecks-UI__HealthChecks__8__Name=Web Marketing API GW HTTP Check
- HealthChecks-UI__HealthChecks__8__Uri=http://webmarketingapigw/hc
- HealthChecks-UI__HealthChecks__9__Name=Ordering HTTP Check
- HealthChecks-UI__HealthChecks__9__Uri=http://ordering.api/hc
- HealthChecks-UI__HealthChecks__10__Name=Ordering HTTP Background Check
- HealthChecks-UI__HealthChecks__10__Uri=http://ordering.backgroundtasks/hc
- HealthChecks-UI__HealthChecks__11__Name=Basket HTTP Check
- HealthChecks-UI__HealthChecks__11__Uri=http://basket.api/hc
- HealthChecks-UI__HealthChecks__12__Name=Catalog HTTP Check
- HealthChecks-UI__HealthChecks__12__Uri=http://catalog.api/hc
- HealthChecks-UI__HealthChecks__13__Name=Identity HTTP Check
- HealthChecks-UI__HealthChecks__13__Uri=http://identity.api/hc
- HealthChecks-UI__HealthChecks__14__Name=Marketing HTTP Check
- HealthChecks-UI__HealthChecks__14__Uri=http://marketing.api/hc
- HealthChecks-UI__HealthChecks__15__Name=Locations HTTP Check
- HealthChecks-UI__HealthChecks__15__Uri=http://locations.api/hc
- HealthChecks-UI__HealthChecks__16__Name=Payments HTTP Check
- HealthChecks-UI__HealthChecks__16__Uri=http://payment.api/hc
- HealthChecks-UI__HealthChecks__17__Name=Ordering SignalRHub HTTP Check
- HealthChecks-UI__HealthChecks__17__Uri=http://ordering.signalrhub/hc
- OrderingBackgroundTasksUrl=http://ordering.backgroundtasks/hc
- BasketUrl=http://basket.api/hc
- IdentityUrl=http://identity.api/hc
- LocationsUrl=http://locations.api/hc
- MarketingUrl=http://marketing.api/hc
- PaymentUrl=http://payment.api/hc
- mvc=http://webmvc/hc
- spa=http://webspa/hc
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
ports:
@ -281,12 +352,9 @@ services:
- 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
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- PurchaseUrlHC=http://webshoppingapigw/hc
- MarketingUrlHC=http://webmarketingapigw/hc
- IdentityUrlHC=http://identity.api/hc
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
@ -300,14 +368,11 @@ services:
- ASPNETCORE_URLS=http://0.0.0.0:80
- PurchaseUrl=http://webshoppingapigw
- 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
- CatalogUrlHC=http://catalog.api/hc
- OrderingUrlHC=http://ordering.api/hc
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- BasketUrlHC=http://basket.api/hc
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- MarketingUrl=http://webmarketingapigw
- SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202
- IdentityUrlHC=http://identity.api/hc
- PurchaseUrlHC=http://webshoppingapigw/hc
- MarketingUrlHC=http://webmarketingapigw/hc
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}


BIN
docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)-v2.1.02.pdf View File


BIN
docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)-v2.1.03.pdf View File


BIN
docs/NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook).pdf View File


+ 0
- 207
eShopOnContainers-ServicesAndWebApps.sln View File

@ -56,16 +56,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBusRabbitMQ", "src\Bui
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationEventLogEF", "src\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj", "{9EE28E45-1533-472B-8267-56C48855BA0E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthChecks", "HealthChecks", "{A81ECBC2-6B00-4DCD-8388-469174033379}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj", "{942ED6E8-0050-495F-A0EA-01E97F63760C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebStatus", "src\Web\WebStatus\WebStatus.csproj", "{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.HealthChecks", "src\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj", "{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.SqlServer", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj", "{4BD76717-3102-4969-8C2C-BAAA3F0263B6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Location", "Location", "{41139F64-4046-4F16-96B7-D941D96FA9C6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Locations.API", "src\Services\Location\Locations.API\Locations.API.csproj", "{E7581357-FC34-474C-B8F5-307EE3CE05EF}"
@ -76,8 +68,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marketing.API", "src\Servic
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBusServiceBus", "src\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj", "{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{768C887F-C229-4B94-ACD8-0C7F65686524}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{1815B651-941C-466B-AE33-D1D7EEB8F77F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{15F4B3AA-89B6-4A0D-9051-414305974781}"
@ -644,54 +634,6 @@ Global
{9EE28E45-1533-472B-8267-56C48855BA0E}.Release|x64.Build.0 = Release|Any CPU
{9EE28E45-1533-472B-8267-56C48855BA0E}.Release|x86.ActiveCfg = Release|Any CPU
{9EE28E45-1533-472B-8267-56C48855BA0E}.Release|x86.Build.0 = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|ARM.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|iPhone.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|x64.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|x64.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|x86.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.AppStore|x86.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|ARM.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|iPhone.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|x64.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|x64.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|x86.ActiveCfg = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Debug|x86.Build.0 = Debug|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|Any CPU.Build.0 = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|ARM.ActiveCfg = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|ARM.Build.0 = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|iPhone.ActiveCfg = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|iPhone.Build.0 = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|x64.ActiveCfg = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|x64.Build.0 = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|x86.ActiveCfg = Release|Any CPU
{942ED6E8-0050-495F-A0EA-01E97F63760C}.Release|x86.Build.0 = Release|Any CPU
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@ -740,102 +682,6 @@ Global
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}.Release|x64.Build.0 = Release|Any CPU
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}.Release|x86.ActiveCfg = Release|Any CPU
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}.Release|x86.Build.0 = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|ARM.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|iPhone.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|x64.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|x64.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|x86.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.AppStore|x86.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|ARM.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|ARM.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|iPhone.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|x64.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|x64.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|x86.ActiveCfg = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Debug|x86.Build.0 = Debug|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|Any CPU.Build.0 = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|ARM.ActiveCfg = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|ARM.Build.0 = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|iPhone.ActiveCfg = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|iPhone.Build.0 = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|x64.ActiveCfg = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|x64.Build.0 = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|x86.ActiveCfg = Release|Any CPU
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}.Release|x86.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|ARM.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|iPhone.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|x64.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|x64.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|x86.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.AppStore|x86.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|ARM.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|ARM.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|iPhone.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|x64.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|x64.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|x86.ActiveCfg = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Debug|x86.Build.0 = Debug|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|Any CPU.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|ARM.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|ARM.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|iPhone.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|iPhone.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x64.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x64.Build.0 = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x86.ActiveCfg = Release|Any CPU
{4BD76717-3102-4969-8C2C-BAAA3F0263B6}.Release|x86.Build.0 = Release|Any CPU
{E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@ -980,54 +826,6 @@ Global
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x64.Build.0 = Release|Any CPU
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.ActiveCfg = Release|Any CPU
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.Build.0 = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|ARM.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhone.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x64.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x64.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x86.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x86.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|Any CPU.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|ARM.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|ARM.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhone.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x64.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x64.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x86.ActiveCfg = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x86.Build.0 = Debug|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|Any CPU.ActiveCfg = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|Any CPU.Build.0 = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|ARM.ActiveCfg = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|ARM.Build.0 = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhone.ActiveCfg = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhone.Build.0 = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x64.ActiveCfg = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x64.Build.0 = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x86.ActiveCfg = Release|Any CPU
{768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x86.Build.0 = Release|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{15F4B3AA-89B6-4A0D-9051-414305974781}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@ -1869,17 +1667,12 @@ Global
{0044B293-1DCC-4224-B948-00CF6DC7F510} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{8088F3FC-6787-45FA-A924-816EC81CBFAC} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{9EE28E45-1533-472B-8267-56C48855BA0E} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{A81ECBC2-6B00-4DCD-8388-469174033379} = {DB0EFB20-B024-4E5E-A75C-52143C131D25}
{942ED6E8-0050-495F-A0EA-01E97F63760C} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F} = {E279BF0F-7F66-4F3A-A3AB-2CDA66C1CD04}
{22A0F9C1-2D4A-4107-95B7-8459E6688BC5} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{4BD76717-3102-4969-8C2C-BAAA3F0263B6} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{41139F64-4046-4F16-96B7-D941D96FA9C6} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
{E7581357-FC34-474C-B8F5-307EE3CE05EF} = {41139F64-4046-4F16-96B7-D941D96FA9C6}
{A5260DE0-1FDD-467E-9CC1-A028AB081CEE} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
{DF395F85-B010-465D-857A-7EBCC512C0C2} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE}
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
{768C887F-C229-4B94-ACD8-0C7F65686524} = {A81ECBC2-6B00-4DCD-8388-469174033379}
{1815B651-941C-466B-AE33-D1D7EEB8F77F} = {DB0EFB20-B024-4E5E-A75C-52143C131D25}
{15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F}
{77849D35-37D4-4802-81DC-9477B2775A40} = {932D8224-11F6-4D07-B109-DA28AD288A63}


+ 1
- 1
global.json View File

@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.1.401"
"version": "2.2.100"
}
}

+ 1
- 3
k8s/deploy-ingress-azure.ps1 View File

@ -1,3 +1 @@
kubectl patch deployment -n ingress-nginx nginx-ingress-controller --type=json --patch="$(cat nginx-ingress\publish-service-patch.yaml)"
kubectl apply -f nginx-ingress\azure\service.yaml
kubectl apply -f nginx-ingress\patch-service-without-rbac.yaml
kubectl apply -f nginx-ingress\cloud-generic.yaml

+ 2
- 0
k8s/deploy-ingress-dockerlocal.ps1 View File

@ -0,0 +1,2 @@
kubectl apply -f nginx-ingress\cm.yaml
kubectl apply -f nginx-ingress\cloud-generic.yaml

+ 1
- 8
k8s/deploy-ingress.ps1 View File

@ -1,12 +1,5 @@
kubectl apply -f ingress.yaml
# Deploy nginx-ingress core files
kubectl apply -f nginx-ingress\namespace.yaml
kubectl apply -f nginx-ingress\default-backend.yaml
kubectl apply -f nginx-ingress\configmap.yaml
kubectl apply -f nginx-ingress\tcp-services-configmap.yaml
kubectl apply -f nginx-ingress\udp-services-configmap.yaml
kubectl apply -f nginx-ingress\without-rbac.yaml
kubectl apply -f nginx-ingress\mandatory.yaml

+ 4
- 0
k8s/deploy.ps1 View File

@ -113,6 +113,7 @@ ExecKube -cmd 'delete configmap internalurls'
ExecKube -cmd 'delete configmap urls'
ExecKube -cmd 'delete configmap externalcfg'
ExecKube -cmd 'delete configmap ocelot'
ExecKube -cmd 'delete -f ingress.yaml'
# start sql, rabbitmq, frontend deployments
if ($deployInfrastructure) {
@ -204,5 +205,8 @@ ExecKube -cmd 'rollout resume deployments/apigwwm'
ExecKube -cmd 'rollout resume deployments/apigwws'
ExecKube -cmd 'rollout resume deployments/ordering-signalrhub'
Write-Host "Adding/Updating ingress resource..." -ForegroundColor Yellow
ExecKube -cmd 'apply -f ingress.yaml'
Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow

+ 18
- 0
k8s/helm-rbac.yaml View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system

+ 7
- 0
k8s/helm/apigwmm/templates/configmap.yaml View File

@ -11,4 +11,11 @@ metadata:
heritage: {{ .Release.Service }}
data:
internalurls__identity: http://{{ .Values.app.svc.identity }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc

+ 14
- 0
k8s/helm/apigwmm/values.yaml View File

@ -32,6 +32,20 @@ env:
configmap:
- name: IdentityUrl
key: internalurls__identity
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: BasketUrlHC
key: internalurls__basket__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
- name: LocationUrlHC
key: internalurls__location__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:
- name: ASPNETCORE_ENVIRONMENT


+ 7
- 0
k8s/helm/apigwms/templates/configmap.yaml View File

@ -11,4 +11,11 @@ metadata:
heritage: {{ .Release.Service }}
data:
internalurls__identity: http://{{ .Values.app.svc.identity }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc

+ 14
- 0
k8s/helm/apigwms/values.yaml View File

@ -32,6 +32,20 @@ env:
configmap:
- name: IdentityUrl
key: internalurls__identity
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: BasketUrlHC
key: internalurls__basket__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
- name: LocationUrlHC
key: internalurls__location__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:
- name: ASPNETCORE_ENVIRONMENT


+ 7
- 0
k8s/helm/apigwwm/templates/configmap.yaml View File

@ -11,4 +11,11 @@ metadata:
heritage: {{ .Release.Service }}
data:
internalurls__identity: http://{{ .Values.app.svc.identity }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc

+ 14
- 0
k8s/helm/apigwwm/values.yaml View File

@ -32,6 +32,20 @@ env:
configmap:
- name: IdentityUrl
key: internalurls__identity
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: BasketUrlHC
key: internalurls__basket__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
- name: LocationUrlHC
key: internalurls__location__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:
- name: ASPNETCORE_ENVIRONMENT


+ 7
- 0
k8s/helm/apigwws/templates/configmap.yaml View File

@ -11,4 +11,11 @@ metadata:
heritage: {{ .Release.Service }}
data:
internalurls__identity: http://{{ .Values.app.svc.identity }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc

+ 14
- 0
k8s/helm/apigwws/values.yaml View File

@ -32,6 +32,20 @@ env:
configmap:
- name: IdentityUrl
key: internalurls__identity
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: BasketUrlHC
key: internalurls__basket__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
- name: LocationUrlHC
key: internalurls__location__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:
- name: ASPNETCORE_ENVIRONMENT


+ 13
- 5
k8s/helm/deploy-all.ps1 View File

@ -8,11 +8,19 @@ Param(
[parameter(Mandatory=$false)][bool]$clean=$true,
[parameter(Mandatory=$false)][string]$aksName="",
[parameter(Mandatory=$false)][string]$aksRg="",
[parameter(Mandatory=$false)][string]$imageTag="latest"
)
[parameter(Mandatory=$false)][string]$imageTag="latest",
[parameter(Mandatory=$false)][bool]$useLocalk8s=$false
)
$dns = $externalDns
$ingressValuesFile="ingress_values.yaml"
if ($useLocalk8s -eq $true) {
$ingressValuesFile="ingress_values_dockerk8s.yaml"
$dns="localhost"
}
if ($externalDns -eq "aks") {
if ([string]::IsNullOrEmpty($aksName) -or [string]::IsNullOrEmpty($aksRg)) {
Write-Host "Error: When using -dns aks, MUST set -aksName and -aksRg too." -ForegroundColor Red
@ -58,18 +66,18 @@ $charts = ("eshop-common", "apigwmm", "apigwms", "apigwwm", "apigwws", "basket-a
if ($deployInfrastructure) {
foreach ($infra in $infras) {
Write-Host "Installing infrastructure: $infra" -ForegroundColor Green
helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --name="$appName-$infra" $infra
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --name="$appName-$infra" $infra
}
}
foreach ($chart in $charts) {
Write-Host "Installing: $chart" -ForegroundColor Green
if ($useCustomRegistry) {
helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
}
else {
if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed
helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
}
}
}


+ 2
- 0
k8s/helm/inf.yaml View File

@ -14,6 +14,8 @@ inf:
db: OrderingDb # Ordering API SQL db name
identity:
db: IdentityDb # Ordering API SQL db name
marketing:
db: MarketingDb # Marketing API SQL db name
mongo:
# host: my-nosql-data # Uncomment to use specify custom mongo host. By default nosql-data is used
locations:


+ 5
- 0
k8s/helm/ingress_values_dockerk8s.yaml View File

@ -0,0 +1,5 @@
ingress:
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/ssl-redirect: "false"

+ 4
- 2
k8s/helm/marketing-api/templates/configmap.yaml View File

@ -2,6 +2,7 @@
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
{{- $mongo := include "mongo-name" . -}}
{{- $sqlsrv := include "sql-name" . -}}
apiVersion: v1
kind: ConfigMap
@ -19,6 +20,7 @@ data:
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
internalurls__IdentityUrl: http://{{ .Values.app.svc.identity }}
urls__IdentityUrl: {{ $identity }}
marketing__ConnectionString: mongodb://{{ $mongo }}
marketing__Database: {{ .Values.inf.mongo.marketing.database }}
marketing__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.marketing.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
marketing__MongoConnectionString: mongodb://{{ $mongo }}
marketing__MongoDatabase: {{ .Values.inf.mongo.marketing.database }}
marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/

+ 4
- 2
k8s/helm/marketing-api/values.yaml View File

@ -44,8 +44,10 @@ env:
key: urls__IdentityUrl
- name: ConnectionString
key: marketing__ConnectionString
- name: Database
key: marketing__Database
- name: MongoConnectionString
key: marketing__MongoConnectionString
- name: MongoDatabase
key: marketing__MongoDatabase
- name: PicBaseUrl
key: marketing__PicBaseUrl
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)


+ 7
- 0
k8s/helm/mobileshoppingagg/templates/configmap.yaml View File

@ -17,3 +17,10 @@ data:
internalurls__catalog: http://{{ .Values.app.svc.catalog }}
internalurls__identity: http://{{ .Values.app.svc.identity }}
internalurls__ordering: http://{{ .Values.app.svc.ordering }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc

+ 14
- 0
k8s/helm/mobileshoppingagg/values.yaml View File

@ -40,6 +40,20 @@ env:
key: internalurls__ordering
- name: urls__identity
key: internalurls__identity
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: BasketUrlHC
key: internalurls__basket__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
- name: LocationUrlHC
key: internalurls__location__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:
- name: ASPNETCORE_ENVIRONMENT


+ 2
- 5
k8s/helm/webmvc/templates/configmap.yaml View File

@ -21,12 +21,9 @@ data:
webmvc__keystore: {{ .Values.inf.redis.keystore.constr }}
internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
internalurls__apigwwm: http://{{ .Values.app.svc.webmarketingapigw }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__apigwws__hc: http://{{ .Values.app.svc.webshoppingapigw }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__apigwwm__hc: http://{{ .Values.app.svc.webmarketingapigw }}/hc
urls__apigwws: http://{{ $webshoppingapigw }}
urls__mvc: http://{{ $mvc }}
urls__IdentityUrl: http://{{ $identity }}

+ 3
- 9
k8s/helm/webmvc/values.yaml View File

@ -46,18 +46,12 @@ env:
key: urls__IdentityUrl
- name: MarketingUrl
key: internalurls__apigwwm
- name: BasketUrlHC
key: internalurls__basket__hc
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: PurchaseUrlHC
key: internalurls__apigwws__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
key: internalurls__apigwwm__hc
- name: SignalrHubUrl
key: urls__apigwws
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)


+ 7
- 0
k8s/helm/webshoppingagg/templates/configmap.yaml View File

@ -17,3 +17,10 @@ data:
internalurls__catalog: http://{{ .Values.app.svc.catalog }}
internalurls__identity: http://{{ .Values.app.svc.identity }}
internalurls__ordering: http://{{ .Values.app.svc.ordering }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc

+ 14
- 0
k8s/helm/webshoppingagg/values.yaml View File

@ -40,6 +40,20 @@ env:
key: internalurls__ordering
- name: urls__identity
key: internalurls__identity
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: BasketUrlHC
key: internalurls__basket__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
- name: LocationUrlHC
key: internalurls__location__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:
- name: ASPNETCORE_ENVIRONMENT


+ 2
- 5
k8s/helm/webspa/templates/configmap.yaml View File

@ -20,12 +20,9 @@ data:
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
webspa__keystore: {{ .Values.inf.redis.keystore.constr }}
internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
internalurls__apigwws__hc: http://{{ .Values.app.svc.webshoppingapigw }}/hc
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
internalurls__apigwwm__hc: http://{{ .Values.app.svc.webmarketingapigw }}/hc
urls__apigwws: http://{{ $webshoppingapigw }}
urls__spa: http://{{ $spa }}
urls__IdentityUrl: http://{{ $identity }}

+ 3
- 9
k8s/helm/webspa/values.yaml View File

@ -44,18 +44,12 @@ env:
key: urls__IdentityUrl
- name: MarketingUrl
key: urls__apigwwm
- name: BasketUrlHC
key: internalurls__basket__hc
- name: CatalogUrlHC
key: internalurls__catalog__hc
- name: PurchaseUrlHC
key: internalurls__apigwws__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: OrderingUrlHC
key: internalurls__ordering__hc
- name: MarketingUrlHC
key: internalurls__marketing__hc
- name: PaymentUrlHC
key: internalurls__payment__hc
key: internalurls__apigwwm__hc
- name: SignalrHubUrl
key: urls__apigwws
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)


+ 29
- 10
k8s/helm/webstatus/templates/configmap.yaml View File

@ -19,18 +19,37 @@ data:
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
webstatus__keystore: {{ .Values.inf.redis.keystore.constr }}
internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
internalurls__apigwwm: http://{{ .Values.app.svc.webmarketingapigw }}
name__mvc__hc: WebMVC HTTP Check
internalurls__mvc__hc: http://{{ .Values.app.svc.mvc }}/hc
name__spa__hc: WebSPA HTTP Check
internalurls__spa__hc: http://{{ .Values.app.svc.spa }}/hc
name__apigwws__hc: Web Shopping API GW HTTP Check
internalurls__apigwws__hc: http://{{ .Values.app.svc.webshoppingapigw }}/hc
name__apigwwm__hc: Web Marketing API GW HTTP Check
internalurls__apigwwm__hc: http://{{ .Values.app.svc.webmarketingapigw }}/hc
name__apigwms__hc: Mobile Shopping API GW HTTP Check
internalurls__apigwms__hc: http://{{ .Values.app.svc.mobileshoppingapigw }}/hc
name__apigwmm__hc: Mobile Marketing API GW HTTP Check
internalurls__apigwmm__hc: http://{{ .Values.app.svc.mobilemarketingapigw }}/hc
name__apigwwsagg__hc: Web Shopping Aggregator GW HTTP Check
internalurls__apigwwsagg__hc: http://{{ .Values.app.svc.webshoppingagg }}/hc
name__apigwmsagg__hc: Mobile Shopping Aggregator HTTP Check
internalurls__apigwmsagg__hc: http://{{ .Values.app.svc.mobileshoppingagg }}/hc
name__ordering__hc: Ordering HTTP Check
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
name__orderingbackground__hc: Ordering HTTP Background Check
internalurls__orderingbackground__hc: http://{{ .Values.app.svc.orderingbackgroundtasks }}/hc
name__basket__hc: Basket HTTP Check
internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
name__catalog__hc: Catalog HTTP Check
internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
name__identity__hc: Identity HTTP Check
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
name__marketing__hc: Marketing HTTP Check
internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
name__locations__hc: Locations HTTP Check
internalurls__locations__hc: http://{{ .Values.app.svc.locations }}/hc
internalurls__orderingbackground__hc: http://{{ .Values.app.svc.orderingbackgroundtasks }}/hc
internalurls__mvc__hc: http://{{ .Values.app.svc.mvc }}/hc
internalurls__spa__hc: http://{{ .Values.app.svc.spa }}/hc
urls__apigwws: http://{{ $webshoppingapigw }}
urls__mvc: http://{{ $mvc }}
urls__IdentityUrl: http://{{ $identity }}
name__payment__hc: Payment HTTP Check
internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
name__signalrhub__hc: Ordering SignalR Hub HTTP Check
internalurls__signalrhub__hc: http://{{ .Values.app.svc.orderingsignalrhub }}/hc

+ 66
- 18
k8s/helm/webstatus/values.yaml View File

@ -13,7 +13,9 @@ service:
ingress:
enabled: true
annotations: {}
annotations: {
}
tls: []
resources: {}
@ -32,27 +34,73 @@ env:
configmap:
- name: ApplicationInsights__InstrumentationKey
key: all__InstrumentationKey
- name: BasketUrl
- name: HealthChecks-UI__HealthChecks__0__Name
key: name__mvc__hc
- name: HealthChecks-UI__HealthChecks__0__Uri
key: internalurls__mvc__hc
- name: HealthChecks-UI__HealthChecks__1__Name
key: name__spa__hc
- name: HealthChecks-UI__HealthChecks__1__Uri
key: internalurls__spa__hc
- name: HealthChecks-UI__HealthChecks__2__Name
key: name__apigwws__hc
- name: HealthChecks-UI__HealthChecks__2__Uri
key: internalurls__apigwws__hc
- name: HealthChecks-UI__HealthChecks__3__Name
key: name__apigwwm__hc
- name: HealthChecks-UI__HealthChecks__3__Uri
key: internalurls__apigwwm__hc
- name: HealthChecks-UI__HealthChecks__4__Name
key: name__apigwms__hc
- name: HealthChecks-UI__HealthChecks__4__Uri
key: internalurls__apigwms__hc
- name: HealthChecks-UI__HealthChecks__5__Name
key: name__apigwmm__hc
- name: HealthChecks-UI__HealthChecks__5__Uri
key: internalurls__apigwmm__hc
- name: HealthChecks-UI__HealthChecks__6__Name
key: name__apigwwsagg__hc
- name: HealthChecks-UI__HealthChecks__6__Uri
key: internalurls__apigwwsagg__hc
- name: HealthChecks-UI__HealthChecks__7__Name
key: name__apigwmsagg__hc
- name: HealthChecks-UI__HealthChecks__7__Uri
key: internalurls__apigwmsagg__hc
- name: HealthChecks-UI__HealthChecks__8__Name
key: name__ordering__hc
- name: HealthChecks-UI__HealthChecks__8__Uri
key: internalurls__ordering__hc
- name: HealthChecks-UI__HealthChecks__9__Name
key: name__orderingbackground__hc
- name: HealthChecks-UI__HealthChecks__9__Uri
key: internalurls__orderingbackground__hc
- name: HealthChecks-UI__HealthChecks__10__Name
key: name__signalrhub__hc
- name: HealthChecks-UI__HealthChecks__10__Uri
key: internalurls__signalrhub__hc
- name: HealthChecks-UI__HealthChecks__11__Name
key: name__basket__hc
- name: HealthChecks-UI__HealthChecks__11__Uri
key: internalurls__basket__hc
- name: CatalogUrl
- name: HealthChecks-UI__HealthChecks__12__Name
key: name__catalog__hc
- name: HealthChecks-UI__HealthChecks__12__Uri
key: internalurls__catalog__hc
- name: IdentityUrl
- name: HealthChecks-UI__HealthChecks__13__Name
key: name__identity__hc
- name: HealthChecks-UI__HealthChecks__13__Uri
key: internalurls__identity__hc
- name: OrderingUrl
key: internalurls__ordering__hc
- name: OrderingBackgroundTasksUrl
key: internalurls__orderingbackground__hc
- name: LocationsUrl
key: internalurls__locations__hc
- name: MarketingUrl
- name: HealthChecks-UI__HealthChecks__14__Name
key: name__marketing__hc
- name: HealthChecks-UI__HealthChecks__14__Uri
key: internalurls__marketing__hc
- name: IdentityUrlHC
key: internalurls__identity__hc
- name: mvc
key: internalurls__mvc__hc
- name: spa
key: internalurls__spa__hc
- name: PaymentUrl
- name: HealthChecks-UI__HealthChecks__15__Name
key: name__locations__hc
- name: HealthChecks-UI__HealthChecks__15__Uri
key: internalurls__locations__hc
- name: HealthChecks-UI__HealthChecks__16__Name
key: name__payment__hc
- name: HealthChecks-UI__HealthChecks__16__Uri
key: internalurls__payment__hc
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values:


+ 0
- 19
k8s/nginx-ingress/azure/service.yaml View File

@ -1,19 +0,0 @@
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app: ingress-nginx
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https

+ 21
- 0
k8s/nginx-ingress/cloud-generic.yaml View File

@ -0,0 +1,21 @@
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https

BIN
k8s/nginx-ingress/cm.yaml View File


+ 0
- 11
k8s/nginx-ingress/configmap.yaml View File

@ -1,11 +0,0 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app: ingress-nginx
data:
ssl-redirect: "false"
proxy-buffer-size: "128k"
proxy-buffers: "4 256k"

+ 0
- 52
k8s/nginx-ingress/default-backend.yaml View File

@ -1,52 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: default-http-backend
labels:
app: default-http-backend
namespace: ingress-nginx
spec:
replicas: 1
template:
metadata:
labels:
app: default-http-backend
spec:
terminationGracePeriodSeconds: 60
containers:
- name: default-http-backend
# Any image is permissable as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: gcr.io/google_containers/defaultbackend:1.4
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- containerPort: 8080
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi
---
apiVersion: v1
kind: Service
metadata:
name: default-http-backend
namespace: ingress-nginx
labels:
app: default-http-backend
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: default-http-backend

+ 3
- 0
k8s/nginx-ingress/local-dockerk8s/identityapi-cm-fix.yaml View File

@ -0,0 +1,3 @@
data:
mvc_e: http://10.0.75.1/webmvc

+ 3
- 0
k8s/nginx-ingress/local-dockerk8s/mvc-cm-fix.yaml View File

@ -0,0 +1,3 @@
data:
urls__IdentityUrl: http://10.0.75.1/identity
urls__mvc: http://10.0.75.1/webmvc

+ 39
- 0
k8s/nginx-ingress/local-dockerk8s/mvc-fix.yaml View File

@ -0,0 +1,39 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
labels:
app: webmvc
name: eshop-webmvc-loopback
namespace: default
spec:
rules:
- http:
paths:
- backend:
serviceName: webmvc
servicePort: http
path: /webmvc
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
labels:
app: identity-api
name: eshop-identity-api-loopback
namespace: default
spec:
rules:
- http:
paths:
- backend:
serviceName: identity
servicePort: http
path: /identity

+ 238
- 0
k8s/nginx-ingress/mandatory.yaml View File

@ -0,0 +1,238 @@
apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: nginx-ingress-serviceaccount
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: nginx-ingress-clusterrole
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
rules:
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- nodes
- pods
- secrets
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- ""
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- "extensions"
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- "extensions"
resources:
- ingresses/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: nginx-ingress-role
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
rules:
- apiGroups:
- ""
resources:
- configmaps
- pods
- secrets
- namespaces
verbs:
- get
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
# Defaults to "<election-id>-<ingress-class>"
# Here: "<ingress-controller-leader>-<nginx>"
# This has to be adapted if you change either parameter
# when launching the nginx-ingress-controller.
- "ingress-controller-leader-nginx"
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- ""
resources:
- endpoints
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: nginx-ingress-role-nisa-binding
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: nginx-ingress-role
subjects:
- kind: ServiceAccount
name: nginx-ingress-serviceaccount
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: nginx-ingress-clusterrole-nisa-binding
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: nginx-ingress-clusterrole
subjects:
- kind: ServiceAccount
name: nginx-ingress-serviceaccount
namespace: ingress-nginx
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-ingress-controller
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
template:
metadata:
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
annotations:
prometheus.io/port: "10254"
prometheus.io/scrape: "true"
spec:
serviceAccountName: nginx-ingress-serviceaccount
containers:
- name: nginx-ingress-controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.20.0
args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/nginx-configuration
- --publish-service=$(POD_NAMESPACE)/ingress-nginx
- --annotations-prefix=nginx.ingress.kubernetes.io
securityContext:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
# www-data -> 33
runAsUser: 33
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1

+ 0
- 4
k8s/nginx-ingress/namespace.yaml View File

@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx

+ 0
- 40
k8s/nginx-ingress/patch-service-without-rbac.yaml View File

@ -1,40 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-ingress-controller
namespace: ingress-nginx
spec:
replicas: 1
selector:
matchLabels:
app: ingress-nginx
template:
metadata:
labels:
app: ingress-nginx
spec:
containers:
- name: nginx-ingress-controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --configmap=$(POD_NAMESPACE)/nginx-configuration
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
- --publish-service=$(POD_NAMESPACE)/ingress-nginx
- --annotations-prefix=nginx.ingress.kubernetes.io
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443

+ 0
- 7
k8s/nginx-ingress/publish-service-patch.yaml View File

@ -1,7 +0,0 @@
[
{
'op': 'add',
'path': '/spec/template/spec/containers/0/args/-',
'value': '--publish-service=$(POD_NAMESPACE)/ingress-nginx'
}
]

+ 22
- 0
k8s/nginx-ingress/service-nodeport.yaml View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
- name: https
port: 443
targetPort: 443
protocol: TCP
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx

+ 0
- 5
k8s/nginx-ingress/tcp-services-configmap.yaml View File

@ -1,5 +0,0 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: tcp-services
namespace: ingress-nginx

+ 0
- 5
k8s/nginx-ingress/udp-services-configmap.yaml View File

@ -1,5 +0,0 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: udp-services
namespace: ingress-nginx

+ 0
- 61
k8s/nginx-ingress/without-rbac.yaml View File

@ -1,61 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-ingress-controller
namespace: ingress-nginx
spec:
replicas: 1
selector:
matchLabels:
app: ingress-nginx
template:
metadata:
labels:
app: ingress-nginx
annotations:
prometheus.io/port: '10254'
prometheus.io/scrape: 'true'
spec:
containers:
- name: nginx-ingress-controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --configmap=$(POD_NAMESPACE)/nginx-configuration
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
- --annotations-prefix=nginx.ingress.kubernetes.io
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1

+ 3
- 4
src/ApiGateways/ApiGw-Base/Dockerfile View File

@ -1,13 +1,12 @@
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
FROM microsoft/dotnet:2.2.100-sdk 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 restore -nowarn:msb3202,nu1503
RUN dotnet build -c Release -o /app
FROM build AS publish


+ 9
- 3
src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -9,7 +9,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Ocelot" Version="3.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.0" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Ocelot" Version="12.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>
</Project>

+ 9
- 1
src/ApiGateways/ApiGw-Base/Program.cs View File

@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
namespace OcelotApiGw
{
@ -23,7 +24,14 @@ namespace OcelotApiGw
IWebHostBuilder builder = WebHost.CreateDefaultBuilder(args);
builder.ConfigureServices(s => s.AddSingleton(builder))
.ConfigureAppConfiguration(ic => ic.AddJsonFile(Path.Combine("configuration", "configuration.json")))
.UseStartup<Startup>();
.UseStartup<Startup>()
.UseSerilog((builderContext, config) =>
{
config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console();
});
IWebHost host = builder.Build();
return host;
}


+ 29
- 9
src/ApiGateways/ApiGw-Base/Startup.cs View File

@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CacheManager.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
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;
using System;
using HealthChecks.UI.Client;
using Microsoft.Extensions.Diagnostics.HealthChecks;
namespace OcelotApiGw
{
public class Startup
{
private readonly IConfiguration _cfg;
public Startup(IConfiguration configuration)
@ -29,12 +26,23 @@ namespace OcelotApiGw
var identityUrl = _cfg.GetValue<string>("IdentityUrl");
var authenticationProviderKey = "IdentityApiKey";
services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy())
.AddUrlGroup(new Uri(_cfg["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
.AddUrlGroup(new Uri(_cfg["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
.AddUrlGroup(new Uri(_cfg["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
.AddUrlGroup(new Uri(_cfg["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
.AddUrlGroup(new Uri(_cfg["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
.AddUrlGroup(new Uri(_cfg["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
.AddUrlGroup(new Uri(_cfg["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
builder => builder
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed((host) => true)
.AllowCredentials());
});
@ -71,6 +79,7 @@ namespace OcelotApiGw
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var pathBase = _cfg["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
@ -81,6 +90,17 @@ namespace OcelotApiGw
app.UseDeveloperExceptionPage();
}
app.UseHealthChecks("/hc", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.UseHealthChecks("/liveness", new HealthCheckOptions
{
Predicate = r => r.Name.Contains("self")
});
loggerFactory.AddConsole(_cfg.GetSection("Logging"));
app.UseCors("CorsPolicy");


+ 28
- 16
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/BasketController.cs View File

@ -5,16 +5,19 @@ using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class BasketController : Controller
[ApiController]
public class BasketController : ControllerBase
{
private readonly ICatalogService _catalog;
private readonly IBasketService _basket;
public BasketController(ICatalogService catalogService, IBasketService basketService)
{
_catalog = catalogService;
@ -23,22 +26,24 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
[HttpPost]
[HttpPut]
public async Task<IActionResult> UpdateAllBasket([FromBody] UpdateBasketRequest data)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType(typeof(BasketData), (int)HttpStatusCode.OK)]
public async Task<ActionResult<BasketData>> UpdateAllBasketAsync([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);
var currentBasket = await _basket.GetByIdAsync(data.BuyerId);
if (currentBasket == null)
{
currentBasket = new BasketData(data.BuyerId);
}
var catalogItems = await _catalog.GetCatalogItems(data.Items.Select(x => x.ProductId));
var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId));
var newBasket = new BasketData(data.BuyerId);
foreach (var bitem in data.Items)
@ -60,13 +65,16 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
});
}
await _basket.Update(newBasket);
return Ok(newBasket);
await _basket.UpdateAsync(newBasket);
return newBasket;
}
[HttpPut]
[Route("items")]
public async Task<IActionResult> UpdateQuantities([FromBody] UpdateBasketItemsRequest data)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType(typeof(BasketData), (int)HttpStatusCode.OK)]
public async Task<ActionResult<BasketData>> UpdateQuantitiesAsync([FromBody] UpdateBasketItemsRequest data)
{
if (!data.Updates.Any())
{
@ -74,7 +82,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
}
// Retrieve the current basket
var currentBasket = await _basket.GetById(data.BasketId);
var currentBasket = await _basket.GetByIdAsync(data.BasketId);
if (currentBasket == null)
{
return BadRequest($"Basket with id {data.BasketId} not found.");
@ -84,21 +92,26 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
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);
await _basket.UpdateAsync(currentBasket);
return currentBasket;
}
[HttpPost]
[Route("items")]
public async Task<IActionResult> AddBasketItem([FromBody] AddBasketItemRequest data)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType((int)HttpStatusCode.OK)]
public async Task<ActionResult> AddBasketItemAsync([FromBody] AddBasketItemRequest data)
{
if (data == null || data.Quantity == 0)
{
@ -106,12 +119,12 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
}
// Step 1: Get the item from catalog
var item = await _catalog.GetCatalogItem(data.CatalogItemId);
var item = await _catalog.GetCatalogItemAsync(data.CatalogItemId);
//item.PictureUri =
// Step 2: Get current basket status
var currentBasket = (await _basket.GetById(data.BasketId)) ?? new BasketData(data.BasketId);
var currentBasket = (await _basket.GetByIdAsync(data.BasketId)) ?? new BasketData(data.BasketId);
// Step 3: Merge current status with new product
currentBasket.Items.Add(new BasketDataItem()
{
@ -124,8 +137,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
});
// Step 4: Update basket
await _basket.Update(currentBasket);
await _basket.UpdateAsync(currentBasket);
return Ok();
}


+ 11
- 8
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/OrderController.cs View File

@ -1,19 +1,20 @@
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.Net;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class OrderController : Controller
[ApiController]
public class OrderController : ControllerBase
{
private readonly IBasketService _basketService;
private readonly IOrderApiClient _orderClient;
public OrderController(IBasketService basketService, IOrderApiClient orderClient)
{
_basketService = basketService;
@ -22,21 +23,23 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
[Route("draft/{basketId}")]
[HttpGet]
public async Task<IActionResult> GetOrderDraft(string basketId)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType(typeof(OrderData), (int)HttpStatusCode.OK)]
public async Task<ActionResult<OrderData>> GetOrderDraftAsync(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);
var basket = await _basketService.GetByIdAsync(basketId);
if (basket == null)
{
return BadRequest($"No basket found for id {basketId}");
}
var orderDraft = await _orderClient.GetOrderDraftFromBasket(basket);
return Ok(orderDraft);
return await _orderClient.GetOrderDraftFromBasketAsync(basket);
}
}
}

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

@ -1,8 +1,8 @@
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
FROM microsoft/dotnet:2.2.100-sdk AS build
WORKDIR /src
COPY . .
WORKDIR /src/src/ApiGateways/Mobile.Bff.Shopping/aggregator


+ 8
- 2
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Mobile.Shopping.HttpAggregator</AssemblyName>
<RootNamespace>Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator</RootNamespace>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
@ -12,9 +12,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.2.0-preview3-35497" />
</ItemGroup>
</Project>

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

@ -7,6 +7,7 @@ using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
@ -31,6 +32,13 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
});
})
.UseStartup<Startup>()
.UseSerilog((builderContext, config) =>
{
config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console();
})
.Build();
}
}

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

@ -22,7 +22,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
_urls = config.Value;
}
public async Task<BasketData> GetById(string id)
public async Task<BasketData> GetByIdAsync(string id)
{
var data = await _httpClient.GetStringAsync(_urls.Basket + UrlsConfig.BasketOperations.GetItemById(id));
@ -31,7 +31,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
return basket;
}
public async Task Update(BasketData currentBasket)
public async Task UpdateAsync(BasketData currentBasket)
{
var basketContent = new StringContent(JsonConvert.SerializeObject(currentBasket), System.Text.Encoding.UTF8, "application/json");


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

@ -22,7 +22,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
_urls = config.Value;
}
public async Task<CatalogItem> GetCatalogItem(int id)
public async Task<CatalogItem> GetCatalogItemAsync(int id)
{
var stringContent = await _httpClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemById(id));
var catalogItem = JsonConvert.DeserializeObject<CatalogItem>(stringContent);
@ -30,7 +30,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
return catalogItem;
}
public async Task<IEnumerable<CatalogItem>> GetCatalogItems(IEnumerable<int> ids)
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids)
{
var stringContent = await _httpClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemsById(ids));
var catalogItems = JsonConvert.DeserializeObject<CatalogItem[]>(stringContent);


+ 3
- 5
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IBasketService.cs View File

@ -1,15 +1,13 @@
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);
Task<BasketData> GetByIdAsync(string id);
Task UpdateAsync(BasketData currentBasket);
}
}

+ 3
- 4
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/ICatalogService.cs View File

@ -1,14 +1,13 @@
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);
Task<CatalogItem> GetCatalogItemAsync(int id);
Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids);
}
}

+ 1
- 4
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/IOrderApiClient.cs View File

@ -1,13 +1,10 @@
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);
Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket);
}
}

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

@ -21,7 +21,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
_urls = config.Value;
}
public async Task<OrderData> GetOrderDraftFromBasket(BasketData basket)
public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket)
{
var uri = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var content = new StringContent(JsonConvert.SerializeObject(basket), System.Text.Encoding.UTF8, "application/json");


+ 39
- 7
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs View File

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure;
@ -16,6 +17,9 @@ using Microsoft.Extensions.Logging;
using Polly;
using Polly.Extensions.Http;
using Swashbuckle.AspNetCore.Swagger;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
@ -31,6 +35,16 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy())
.AddUrlGroup(new Uri(Configuration["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
.AddUrlGroup(new Uri(Configuration["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
.AddUrlGroup(new Uri(Configuration["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
.AddUrlGroup(new Uri(Configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
.AddUrlGroup(new Uri(Configuration["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
.AddUrlGroup(new Uri(Configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
.AddUrlGroup(new Uri(Configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
services.AddCustomMvc(Configuration)
.AddCustomAuthentication(Configuration)
.AddHttpServices();
@ -47,15 +61,31 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
app.UsePathBase(pathBase);
}
app.UseHealthChecks("/hc", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.UseHealthChecks("/liveness", new HealthCheckOptions
{
Predicate = r => r.Name.Contains("self")
});
app.UseCors("CorsPolicy");
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
app.UseSwagger().UseSwaggerUI(c =>
@ -77,7 +107,8 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
services.AddOptions();
services.Configure<UrlsConfig>(configuration.GetSection("urls"));
services.AddMvc();
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddSwaggerGen(options =>
{
@ -108,9 +139,10 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
builder => builder
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed((host) => true)
.AllowCredentials());
});
@ -120,12 +152,14 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var identityUrl = configuration.GetValue<string>("urls:identity");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
})
.AddJwtBearer(options =>
{
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
@ -143,6 +177,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
return services;
}
public static IServiceCollection AddHttpServices(this IServiceCollection services)
{
//register delegating handlers
@ -163,8 +198,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
.AddPolicyHandler(GetRetryPolicy())
.AddPolicyHandler(GetCircuitBreakerPolicy());
return services;
}
@ -174,7 +207,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
.HandleTransientHttpError()
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
.WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
}
private static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy()


+ 25
- 16
src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs View File

@ -5,16 +5,19 @@ using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class BasketController : Controller
[ApiController]
public class BasketController : ControllerBase
{
private readonly ICatalogService _catalog;
private readonly IBasketService _basket;
public BasketController(ICatalogService catalogService, IBasketService basketService)
{
_catalog = catalogService;
@ -23,22 +26,23 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
[HttpPost]
[HttpPut]
public async Task<IActionResult> UpdateAllBasket([FromBody] UpdateBasketRequest data)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType(typeof(BasketData), (int)HttpStatusCode.OK)]
public async Task<ActionResult<BasketData>> UpdateAllBasketAsync([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);
var currentBasket = await _basket.GetByIdAsync(data.BuyerId);
if (currentBasket == null)
{
currentBasket = new BasketData(data.BuyerId);
}
var catalogItems = await _catalog.GetCatalogItems(data.Items.Select(x => x.ProductId));
var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId));
var newBasket = new BasketData(data.BuyerId);
foreach (var bitem in data.Items)
@ -60,13 +64,16 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
});
}
await _basket.Update(newBasket);
return Ok(newBasket);
await _basket.UpdateAsync(newBasket);
return newBasket;
}
[HttpPut]
[Route("items")]
public async Task<IActionResult> UpdateQuantities([FromBody] UpdateBasketItemsRequest data)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType(typeof(BasketData), (int)HttpStatusCode.OK)]
public async Task<ActionResult<BasketData>> UpdateQuantitiesAsync([FromBody] UpdateBasketItemsRequest data)
{
if (!data.Updates.Any())
{
@ -74,7 +81,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
}
// Retrieve the current basket
var currentBasket = await _basket.GetById(data.BasketId);
var currentBasket = await _basket.GetByIdAsync(data.BasketId);
if (currentBasket == null)
{
return BadRequest($"Basket with id {data.BasketId} not found.");
@ -92,13 +99,16 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
}
// Save the updated basket
await _basket.Update(currentBasket);
return Ok(currentBasket);
await _basket.UpdateAsync(currentBasket);
return currentBasket;
}
[HttpPost]
[Route("items")]
public async Task<IActionResult> AddBasketItem([FromBody] AddBasketItemRequest data)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType((int)HttpStatusCode.OK)]
public async Task<ActionResult> AddBasketItemAsync([FromBody] AddBasketItemRequest data)
{
if (data == null || data.Quantity == 0)
{
@ -106,12 +116,12 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
}
// Step 1: Get the item from catalog
var item = await _catalog.GetCatalogItem(data.CatalogItemId);
var item = await _catalog.GetCatalogItemAsync(data.CatalogItemId);
//item.PictureUri =
// Step 2: Get current basket status
var currentBasket = (await _basket.GetById(data.BasketId)) ?? new BasketData(data.BasketId);
var currentBasket = (await _basket.GetByIdAsync(data.BasketId)) ?? new BasketData(data.BasketId);
// Step 3: Merge current status with new product
currentBasket.Items.Add(new BasketDataItem()
{
@ -124,8 +134,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
});
// Step 4: Update basket
await _basket.Update(currentBasket);
await _basket.UpdateAsync(currentBasket);
return Ok();
}


+ 10
- 5
src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs View File

@ -1,16 +1,19 @@
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.Net;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
{
[Route("api/v1/[controller]")]
[Authorize]
public class OrderController : Controller
[ApiController]
public class OrderController : ControllerBase
{
private readonly IBasketService _basketService;
private readonly IOrderApiClient _orderClient;
@ -22,21 +25,23 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
[Route("draft/{basketId}")]
[HttpGet]
public async Task<IActionResult> GetOrderDraft(string basketId)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType(typeof(OrderData), (int)HttpStatusCode.OK)]
public async Task<ActionResult<OrderData>> GetOrderDraftAsync(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);
var basket = await _basketService.GetByIdAsync(basketId);
if (basket == null)
{
return BadRequest($"No basket found for id {basketId}");
}
var orderDraft = await _orderClient.GetOrderDraftFromBasket(basket);
return Ok(orderDraft);
return await _orderClient.GetOrderDraftFromBasketAsync(basket);
}
}
}

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

@ -1,8 +1,8 @@
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
FROM microsoft/dotnet:2.2.100-sdk AS build
WORKDIR /src
COPY . .
WORKDIR /src/src/ApiGateways/Web.Bff.Shopping/aggregator


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

@ -7,6 +7,7 @@ using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{
@ -31,6 +32,13 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
});
})
.UseStartup<Startup>()
.UseSerilog((builderContext, config) =>
{
config
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Console();
})
.Build();
}
}

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

@ -10,7 +10,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public class BasketService : IBasketService
{
private readonly HttpClient _apiClient;
private readonly ILogger<BasketService> _logger;
private readonly UrlsConfig _urls;
@ -22,18 +21,19 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
_urls = config.Value;
}
public async Task<BasketData> GetById(string id)
public async Task<BasketData> GetByIdAsync(string id)
{
var data = await _apiClient.GetStringAsync(_urls.Basket + UrlsConfig.BasketOperations.GetItemById(id));
var basket = !string.IsNullOrEmpty(data) ? JsonConvert.DeserializeObject<BasketData>(data) : null;
return basket;
}
public async Task Update(BasketData currentBasket)
public async Task UpdateAsync(BasketData currentBasket)
{
var basketContent = new StringContent(JsonConvert.SerializeObject(currentBasket), System.Text.Encoding.UTF8, "application/json");
var data = await _apiClient.PostAsync(_urls.Basket + UrlsConfig.BasketOperations.UpdateBasket(), basketContent);
await _apiClient.PostAsync(_urls.Basket + UrlsConfig.BasketOperations.UpdateBasket(), basketContent);
}
}
}

+ 4
- 7
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs View File

@ -11,7 +11,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public class CatalogService : ICatalogService
{
private readonly HttpClient _httpClient;
private readonly ILogger<CatalogService> _logger;
private readonly UrlsConfig _urls;
@ -23,20 +22,18 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
_urls = config.Value;
}
public async Task<CatalogItem> GetCatalogItem(int id)
public async Task<CatalogItem> GetCatalogItemAsync(int id)
{
var stringContent = await _httpClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemById(id));
var catalogItem = JsonConvert.DeserializeObject<CatalogItem>(stringContent);
return catalogItem;
return JsonConvert.DeserializeObject<CatalogItem>(stringContent);
}
public async Task<IEnumerable<CatalogItem>> GetCatalogItems(IEnumerable<int> ids)
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids)
{
var stringContent = await _httpClient.GetStringAsync(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemsById(ids));
var catalogItems = JsonConvert.DeserializeObject<CatalogItem[]>(stringContent);
return catalogItems;
return JsonConvert.DeserializeObject<CatalogItem[]>(stringContent);
}
}
}

+ 2
- 5
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IBasketService.cs View File

@ -1,15 +1,12 @@
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);
Task<BasketData> GetByIdAsync(string id);
Task UpdateAsync(BasketData currentBasket);
}
}

+ 3
- 4
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/ICatalogService.cs View File

@ -1,14 +1,13 @@
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);
Task<CatalogItem> GetCatalogItemAsync(int id);
Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids);
}
}

+ 1
- 4
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/IOrderApiClient.cs View File

@ -1,13 +1,10 @@
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);
Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket);
}
}

+ 1
- 2
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs View File

@ -10,7 +10,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{
public class OrderApiClient : IOrderApiClient
{
private readonly HttpClient _apiClient;
private readonly ILogger<OrderApiClient> _logger;
private readonly UrlsConfig _urls;
@ -22,7 +21,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
_urls = config.Value;
}
public async Task<OrderData> GetOrderDraftFromBasket(BasketData basket)
public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket)
{
var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var content = new StringContent(JsonConvert.SerializeObject(basket), System.Text.Encoding.UTF8, "application/json");


+ 43
- 10
src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure;
@ -17,6 +18,9 @@ using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{
@ -32,6 +36,16 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy())
.AddUrlGroup(new Uri(Configuration["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
.AddUrlGroup(new Uri(Configuration["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
.AddUrlGroup(new Uri(Configuration["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
.AddUrlGroup(new Uri(Configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
.AddUrlGroup(new Uri(Configuration["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
.AddUrlGroup(new Uri(Configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
.AddUrlGroup(new Uri(Configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
services.AddCustomMvc(Configuration)
.AddCustomAuthentication(Configuration)
.AddApplicationServices();
@ -47,24 +61,39 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
app.UsePathBase(pathBase);
}
app.UseHealthChecks("/hc", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.UseHealthChecks("/liveness", new HealthCheckOptions
{
Predicate = r => r.Name.Contains("self")
});
app.UseCors("CorsPolicy");
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseAuthentication();
app.UseHttpsRedirection();
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");
});
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");
});
}
}
@ -99,12 +128,14 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
return services;
}
public static IServiceCollection AddCustomMvc(this IServiceCollection services, IConfiguration configuration)
{
services.AddOptions();
services.Configure<UrlsConfig>(configuration.GetSection("urls"));
services.AddMvc();
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddSwaggerGen(options =>
{
@ -135,7 +166,8 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
builder => builder
.SetIsOriginAllowed((host) => true)
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
@ -177,6 +209,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
.WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
}
static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy()
{
return HttpPolicyExtensions


+ 8
- 3
src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Web.Shopping.HttpAggregator</AssemblyName>
<RootNamespace>Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator</RootNamespace>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
@ -12,9 +12,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.2.0-preview3-35497" />
</ItemGroup>
</Project>

+ 13
- 2
src/BuildingBlocks/EventBus/EventBus/Events/IntegrationEvent.cs View File

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
{
@ -10,7 +11,17 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
CreationDate = DateTime.UtcNow;
}
public Guid Id { get; }
public DateTime CreationDate { get; }
[JsonConstructor]
public IntegrationEvent(Guid id, DateTime createDate)
{
Id = id;
CreationDate = createDate;
}
[JsonProperty]
public Guid Id { get; private set; }
[JsonProperty]
public DateTime CreationDate { get; private set; }
}
}

+ 9
- 6
src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs View File

@ -1,10 +1,8 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
{
@ -37,8 +35,13 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
where TH : IIntegrationEventHandler<T>
{
var eventName = GetEventKey<T>();
DoAddSubscription(typeof(TH), eventName, isDynamic: false);
_eventTypes.Add(typeof(T));
if (!_eventTypes.Contains(typeof(T)))
{
_eventTypes.Add(typeof(T));
}
}
private void DoAddSubscription(Type handlerType, string eventName, bool isDynamic)


+ 3
- 1
src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs View File

@ -217,14 +217,16 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
if (subscription.IsDynamic)
{
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
if (handler == null) continue;
dynamic eventData = JObject.Parse(message);
await handler.Handle(eventData);
}
else
{
var handler = scope.ResolveOptional(subscription.HandlerType);
if (handler == null) continue;
var eventType = _subsManager.GetEventTypeByName(eventName);
var integrationEvent = JsonConvert.DeserializeObject(message, eventType);
var handler = scope.ResolveOptional(subscription.HandlerType);
var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType);
await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent });
}


+ 1
- 1
src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj View File

@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="Autofac" Version="4.6.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0-preview3-35497" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Polly" Version="6.0.1" />
<PackageReference Include="RabbitMQ.Client" Version="5.0.1" />


+ 4
- 2
src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs View File

@ -163,14 +163,16 @@
if (subscription.IsDynamic)
{
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
if (handler == null) continue;
dynamic eventData = JObject.Parse(message);
await handler.Handle(eventData);
}
else
{
var eventType = _subsManager.GetEventTypeByName(eventName);
var integrationEvent = JsonConvert.DeserializeObject(message, eventType);
var handler = scope.ResolveOptional(subscription.HandlerType);
if (handler == null) continue;
var eventType = _subsManager.GetEventTypeByName(eventName);
var integrationEvent = JsonConvert.DeserializeObject(message, eventType);
var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType);
await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent });
}


+ 1
- 1
src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj View File

@ -9,7 +9,7 @@
<PackageReference Include="Autofac" Version="4.6.2" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0-preview3-35497" />
</ItemGroup>
<ItemGroup>


+ 3
- 2
src/BuildingBlocks/EventBus/IntegrationEventLogEF/EventStateEnum.cs View File

@ -7,7 +7,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
public enum EventStateEnum
{
NotPublished = 0,
Published = 1,
PublishedFailed = 2
InProgress = 1,
Published = 2,
PublishedFailed = 3
}
}

+ 4
- 4
src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj View File

@ -6,10 +6,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0-preview3-35497" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.0-preview3-35497" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0-preview3-35497" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0-preview3-35497" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>
<ItemGroup>


+ 14
- 1
src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEntry.cs View File

@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Linq;
using System.ComponentModel.DataAnnotations.Schema;
using System.Reflection;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
{
@ -11,7 +14,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
private IntegrationEventLogEntry() { }
public IntegrationEventLogEntry(IntegrationEvent @event)
{
EventId = @event.Id;
EventId = @event.Id;
CreationTime = @event.CreationDate;
EventTypeName = @event.GetType().FullName;
Content = JsonConvert.SerializeObject(@event);
@ -20,9 +23,19 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
}
public Guid EventId { get; private set; }
public string EventTypeName { get; private set; }
[NotMapped]
public string EventTypeShortName => EventTypeName.Split('.')?.Last();
[NotMapped]
public IntegrationEvent IntegrationEvent { get; private set; }
public EventStateEnum State { get; set; }
public int TimesSent { get; set; }
public DateTime CreationTime { get; private set; }
public string Content { get; private set; }
public IntegrationEventLogEntry DeserializeJsonContent(Type type)
{
IntegrationEvent = JsonConvert.DeserializeObject(Content, type) as IntegrationEvent;
return this;
}
}
}

+ 4
- 1
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IIntegrationEventLogService.cs View File

@ -9,7 +9,10 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
{
public interface IIntegrationEventLogService
{
Task<IEnumerable<IntegrationEventLogEntry>> RetrieveEventLogsPendingToPublishAsync();
Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction);
Task MarkEventAsPublishedAsync(IntegrationEvent @event);
Task MarkEventAsPublishedAsync(Guid eventId);
Task MarkEventAsInProgressAsync(Guid eventId);
Task MarkEventAsFailedAsync(Guid eventId);
}
}

+ 41
- 4
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs View File

@ -1,9 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
@ -12,6 +17,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
{
private readonly IntegrationEventLogContext _integrationEventLogContext;
private readonly DbConnection _dbConnection;
private readonly List<Type> _eventTypes;
public IntegrationEventLogService(DbConnection dbConnection)
{
@ -21,6 +27,20 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
.UseSqlServer(_dbConnection)
.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning))
.Options);
_eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName)
.GetTypes()
.Where(t => t.Name.EndsWith(nameof(IntegrationEvent)))
.ToList();
}
public async Task<IEnumerable<IntegrationEventLogEntry>> RetrieveEventLogsPendingToPublishAsync()
{
return await _integrationEventLogContext.IntegrationEventLogs
.Where(e => e.State == EventStateEnum.NotPublished)
.OrderBy(o => o.CreationTime)
.Select(e => e.DeserializeJsonContent(_eventTypes.Find(t=> t.Name == e.EventTypeShortName)))
.ToListAsync();
}
public Task SaveEventAsync(IntegrationEvent @event, DbTransaction transaction)
@ -38,11 +58,28 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
return _integrationEventLogContext.SaveChangesAsync();
}
public Task MarkEventAsPublishedAsync(IntegrationEvent @event)
public Task MarkEventAsPublishedAsync(Guid eventId)
{
return UpdateEventStatus(eventId, EventStateEnum.Published);
}
public Task MarkEventAsInProgressAsync(Guid eventId)
{
var eventLogEntry = _integrationEventLogContext.IntegrationEventLogs.Single(ie => ie.EventId == @event.Id);
eventLogEntry.TimesSent++;
eventLogEntry.State = EventStateEnum.Published;
return UpdateEventStatus(eventId, EventStateEnum.InProgress);
}
public Task MarkEventAsFailedAsync(Guid eventId)
{
return UpdateEventStatus(eventId, EventStateEnum.PublishedFailed);
}
private Task UpdateEventStatus(Guid eventId, EventStateEnum status)
{
var eventLogEntry = _integrationEventLogContext.IntegrationEventLogs.Single(ie => ie.EventId == eventId);
eventLogEntry.State = status;
if(status == EventStateEnum.InProgress)
eventLogEntry.TimesSent++;
_integrationEventLogContext.IntegrationEventLogs.Update(eventLogEntry);


+ 0
- 76
src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckMiddleware.cs View File

@ -1,76 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.HealthChecks;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.HealthChecks
{
public class HealthCheckMiddleware
{
private readonly RequestDelegate _next;
private readonly string _path;
private readonly int? _port;
private readonly IHealthCheckService _service;
private readonly TimeSpan _timeout;
public HealthCheckMiddleware(RequestDelegate next, IHealthCheckService service, int port, TimeSpan timeout)
{
_port = port;
_service = service;
_next = next;
_timeout = timeout;
}
public HealthCheckMiddleware(RequestDelegate next, IHealthCheckService service, string path, TimeSpan timeout)
{
_path = path;
_service = service;
_next = next;
_timeout = timeout;
}
public async Task Invoke(HttpContext context)
{
if (IsHealthCheckRequest(context))
{
var timeoutTokenSource = new CancellationTokenSource(_timeout);
var result = await _service.CheckHealthAsync(timeoutTokenSource.Token);
var status = result.CheckStatus;
if (status != CheckStatus.Healthy)
context.Response.StatusCode = 503;
context.Response.Headers.Add("content-type", "application/json");
await context.Response.WriteAsync(JsonConvert.SerializeObject(new { status = status.ToString() }));
return;
}
else
{
await _next.Invoke(context);
}
}
private bool IsHealthCheckRequest(HttpContext context)
{
if (_port.HasValue)
{
var connInfo = context.Features.Get<IHttpConnectionFeature>();
if (connInfo.LocalPort == _port)
return true;
}
if (context.Request.Path == _path)
{
return true;
}
return false;
}
}
}

+ 0
- 45
src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckStartupFilter.cs View File

@ -1,45 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace Microsoft.AspNetCore.HealthChecks
{
public class HealthCheckStartupFilter : IStartupFilter
{
private string _path;
private int? _port;
private TimeSpan _timeout;
public HealthCheckStartupFilter(int port, TimeSpan timeout)
{
_port = port;
_timeout = timeout;
}
public HealthCheckStartupFilter(string path, TimeSpan timeout)
{
_path = path;
_timeout = timeout;
}
public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
{
return app =>
{
if (_port.HasValue)
{
app.UseMiddleware<HealthCheckMiddleware>(_port, _timeout);
}
else
{
app.UseMiddleware<HealthCheckMiddleware>(_path, _timeout);
}
next(app);
};
}
}
}

+ 0
- 47
src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckWebHostBuilderExtension.cs View File

@ -1,47 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Hosting
{
public static class HealthCheckWebHostBuilderExtension
{
public static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(10);
public static IWebHostBuilder UseHealthChecks(this IWebHostBuilder builder, int port)
=> UseHealthChecks(builder, port, DefaultTimeout);
public static IWebHostBuilder UseHealthChecks(this IWebHostBuilder builder, int port, TimeSpan timeout)
{
Guard.ArgumentValid(port > 0 && port < 65536, nameof(port), "Port must be a value between 1 and 65535.");
Guard.ArgumentValid(timeout > TimeSpan.Zero, nameof(timeout), "Health check timeout must be a positive time span.");
builder.ConfigureServices(services =>
{
var existingUrl = builder.GetSetting(WebHostDefaults.ServerUrlsKey);
builder.UseSetting(WebHostDefaults.ServerUrlsKey, $"{existingUrl};http://localhost:{port}");
services.AddSingleton<IStartupFilter>(new HealthCheckStartupFilter(port, timeout));
});
return builder;
}
public static IWebHostBuilder UseHealthChecks(this IWebHostBuilder builder, string path)
=> UseHealthChecks(builder, path, DefaultTimeout);
public static IWebHostBuilder UseHealthChecks(this IWebHostBuilder builder, string path, TimeSpan timeout)
{
Guard.ArgumentNotNull(nameof(path), path);
// REVIEW: Is there a better URL path validator somewhere?
Guard.ArgumentValid(!path.Contains("?"), nameof(path), "Path cannot contain query string values.");
Guard.ArgumentValid(path.StartsWith("/"), nameof(path), "Path should start with '/'.");
Guard.ArgumentValid(timeout > TimeSpan.Zero, nameof(timeout), "Health check timeout must be a positive time span.");
builder.ConfigureServices(services => services.AddSingleton<IStartupFilter>(new HealthCheckStartupFilter(path, timeout)));
return builder;
}
}
}

+ 0
- 38
src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/HealthCheckWebHostExtensions.cs View File

@ -1,38 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Extensions.HealthChecks;
namespace Microsoft.AspNetCore.Hosting
{
public static class HealthCheckWebHostExtensions
{
private const int DEFAULT_TIMEOUT_SECONDS = 300;
public static void RunWhenHealthy(this IWebHost webHost)
{
webHost.RunWhenHealthy(TimeSpan.FromSeconds(DEFAULT_TIMEOUT_SECONDS));
}
public static void RunWhenHealthy(this IWebHost webHost, TimeSpan timeout)
{
var healthChecks = webHost.Services.GetService(typeof(IHealthCheckService)) as IHealthCheckService;
var loops = 0;
do
{
var checkResult = healthChecks.CheckHealthAsync().Result;
if (checkResult.CheckStatus == CheckStatus.Healthy)
{
webHost.Run();
break;
}
System.Threading.Thread.Sleep(1000);
loops++;
} while (loops < timeout.TotalSeconds);
}
}
}

+ 0
- 19
src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj View File

@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\common\Guard.cs" Link="Internal\Guard.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0" />
</ItemGroup>
</Project>

+ 0
- 175
src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/AzureHealthCheckBuilderExtensions.cs View File

@ -1,175 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
namespace Microsoft.Extensions.HealthChecks
{
// REVIEW: Do we want these to continue to use default parameters?
// REVIEW: What are the appropriate guards for these functions?
public static class AzureHealthCheckBuilderExtensions
{
public static HealthCheckBuilder AddAzureBlobStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string containerName = null, TimeSpan? cacheDuration = null)
{
var credentials = new StorageCredentials(accountName, accountKey);
var storageAccount = new CloudStorageAccount(credentials, true);
return AddAzureBlobStorageCheck(builder, storageAccount, containerName, cacheDuration);
}
public static HealthCheckBuilder AddAzureBlobStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string containerName = null, TimeSpan? cacheDuration = null)
{
builder.AddCheck($"AzureBlobStorageCheck {storageAccount.BlobStorageUri} {containerName}", async () =>
{
bool result;
try
{
var blobClient = storageAccount.CreateCloudBlobClient();
var properties = await blobClient.GetServicePropertiesAsync().ConfigureAwait(false);
if (!String.IsNullOrWhiteSpace(containerName))
{
var container = blobClient.GetContainerReference(containerName);
result = await container.ExistsAsync();
}
result = true;
}
catch (Exception)
{
result = false;
}
return result
? HealthCheckResult.Healthy($"AzureBlobStorage {storageAccount.BlobStorageUri} is available")
: HealthCheckResult.Unhealthy($"AzureBlobStorage {storageAccount.BlobStorageUri} is unavailable");
}, cacheDuration ?? builder.DefaultCacheDuration);
return builder;
}
public static HealthCheckBuilder AddAzureTableStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string tableName = null, TimeSpan? cacheDuration = null)
{
var credentials = new StorageCredentials(accountName, accountKey);
var storageAccount = new CloudStorageAccount(credentials, true);
return AddAzureTableStorageCheck(builder, storageAccount, tableName, cacheDuration);
}
public static HealthCheckBuilder AddAzureTableStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string tableName = null, TimeSpan? cacheDuration = null)
{
builder.AddCheck($"AzureTableStorageCheck {storageAccount.TableStorageUri} {tableName}", async () =>
{
bool result;
try
{
var tableClient = storageAccount.CreateCloudTableClient();
var properties = await tableClient.GetServicePropertiesAsync().ConfigureAwait(false);
if (!String.IsNullOrWhiteSpace(tableName))
{
var table = tableClient.GetTableReference(tableName);
result = await table.ExistsAsync();
}
result = true;
}
catch (Exception)
{
result = false;
}
return result
? HealthCheckResult.Healthy($"AzureTableStorage {storageAccount.BlobStorageUri} is available")
: HealthCheckResult.Unhealthy($"AzureTableStorage {storageAccount.BlobStorageUri} is unavailable");
}, cacheDuration ?? builder.DefaultCacheDuration);
return builder;
}
public static HealthCheckBuilder AddAzureFileStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string shareName = null, TimeSpan? cacheDuration = null)
{
var credentials = new StorageCredentials(accountName, accountKey);
var storageAccount = new CloudStorageAccount(credentials, true);
return AddAzureFileStorageCheck(builder, storageAccount, shareName, cacheDuration);
}
public static HealthCheckBuilder AddAzureFileStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string shareName = null, TimeSpan? cacheDuration = null)
{
builder.AddCheck($"AzureFileStorageCheck {storageAccount.FileStorageUri} {shareName}", async () =>
{
bool result;
try
{
var fileClient = storageAccount.CreateCloudFileClient();
var properties = await fileClient.GetServicePropertiesAsync().ConfigureAwait(false);
if (!String.IsNullOrWhiteSpace(shareName))
{
var share = fileClient.GetShareReference(shareName);
result = await share.ExistsAsync();
}
result = true;
}
catch (Exception)
{
result = false;
}
return result
? HealthCheckResult.Healthy($"AzureFileStorage {storageAccount.BlobStorageUri} is available")
: HealthCheckResult.Unhealthy($"AzureFileStorage {storageAccount.BlobStorageUri} is unavailable");
}, cacheDuration ?? builder.DefaultCacheDuration);
return builder;
}
public static HealthCheckBuilder AddAzureQueueStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string queueName = null, TimeSpan? cacheDuration = null)
{
var credentials = new StorageCredentials(accountName, accountKey);
var storageAccount = new CloudStorageAccount(credentials, true);
return AddAzureQueueStorageCheck(builder, storageAccount, queueName, cacheDuration);
}
public static HealthCheckBuilder AddAzureQueueStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string queueName = null, TimeSpan? cacheDuration = null)
{
builder.AddCheck($"AzureQueueStorageCheck {storageAccount.QueueStorageUri} {queueName}", async () =>
{
bool result;
try
{
var queueClient = storageAccount.CreateCloudQueueClient();
var properties = await queueClient.GetServicePropertiesAsync().ConfigureAwait(false);
if (!String.IsNullOrWhiteSpace(queueName))
{
var queue = queueClient.GetQueueReference(queueName);
result = await queue.ExistsAsync();
}
result = true;
}
catch (Exception)
{
result = false;
}
return result
? HealthCheckResult.Healthy($"AzureFileStorage {storageAccount.BlobStorageUri} is available")
: HealthCheckResult.Unhealthy($"AzureFileStorage {storageAccount.BlobStorageUri} is unavailable");
}, cacheDuration ?? builder.DefaultCacheDuration);
return builder;
}
}
}

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

Loading…
Cancel
Save