Compare commits

...

11 Commits

Author SHA1 Message Date
  Sumit Ghosh 1d8ad96839 Merge branch 'feature/enable-tye' of https://github.com/dotnet-architecture/eShopOnContainers into feature/enable-tye 4 years ago
  Sumit Ghosh 5b4adb7235 Refactored tye yamls for all services 4 years ago
  Nish Anil 19a3735c09
Merge dev to feature branch (#1476) 4 years ago
  Sumit Ghosh 576ce3165d Enabled Zipkin tracing for all the projects. 4 years ago
  Sumit Ghosh c5298158ef Introduced polly retry policy for Ordering.API 4 years ago
  Sumit Ghosh 49aac0ce77 Introducted Retry logic in Marketing.API with polly policy. 4 years ago
  Sumit Ghosh 5bf33b26fb Updated polly policy in WebHostExtensions 4 years ago
  Sumit Ghosh c10b4ac934 Updated tye yaml 4 years ago
  Sumit Ghosh 0a66edc61b Updated envoy yaml for tye specific configuration. 4 years ago
  Sumit Ghosh d93f6c2f89 Updated tye yaml with all service configuration. 4 years ago
  Sumit Ghosh 0972643c5f First version of tye.yaml has been included in the solution. 4 years ago
70 changed files with 1823 additions and 101 deletions
Split View
  1. +1
    -1
      README.md
  2. +1
    -1
      build/azure-devops/multiarch.yaml
  3. +45
    -18
      deploy/windows/add-firewall-rules-for-sts-auth-thru-docker.ps1
  4. +3
    -3
      src/.env
  5. +13
    -0
      src/ApiGateways/Envoy/config/webmarketing/envoy.yaml
  6. +3
    -0
      src/ApiGateways/Envoy/config/webshopping/envoy.yaml
  7. +76
    -0
      src/ApiGateways/Envoy/tye-config/mobilemarketing/envoy.yaml
  8. +139
    -0
      src/ApiGateways/Envoy/tye-config/mobileshopping/envoy.yaml
  9. +76
    -0
      src/ApiGateways/Envoy/tye-config/webmarketing/envoy.yaml
  10. +139
    -0
      src/ApiGateways/Envoy/tye-config/webshopping/envoy.yaml
  11. +43
    -0
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/tye.yaml
  12. +43
    -0
      src/ApiGateways/Web.Bff.Shopping/aggregator/tye.yaml
  13. +1
    -2
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
  14. +22
    -1
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs
  15. +2
    -0
      src/Services/Basket/Basket.API/Startup.cs
  16. +41
    -0
      src/Services/Basket/Basket.API/tye.yaml
  17. +1
    -1
      src/Services/Catalog/Catalog.API/Controllers/PicController.cs
  18. +9
    -6
      src/Services/Catalog/Catalog.API/Extensions/WebHostExtensions.cs
  19. +5
    -6
      src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs
  20. +21
    -1
      src/Services/Catalog/Catalog.API/IntegrationEvents/CatalogIntegrationEventService.cs
  21. +3
    -0
      src/Services/Catalog/Catalog.API/Program.cs
  22. +43
    -0
      src/Services/Catalog/Catalog.API/tye.yaml
  23. +2
    -0
      src/Services/Identity/Identity.API/Startup.cs
  24. +44
    -0
      src/Services/Identity/Identity.API/tye.yaml
  25. +2
    -0
      src/Services/Location/Locations.API/Program.cs
  26. +2
    -2
      src/Services/Location/Locations.API/appsettings.json
  27. +39
    -0
      src/Services/Location/Locations.API/tye.yaml
  28. +1
    -1
      src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs
  29. +75
    -0
      src/Services/Marketing/Marketing.API/Extensions/WebHostExtensions.cs
  30. +3
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  31. +5
    -3
      src/Services/Marketing/Marketing.API/Startup.cs
  32. +51
    -0
      src/Services/Marketing/Marketing.API/tye.yaml
  33. +76
    -0
      src/Services/Ordering/Ordering.API/Extensions/WebHostExtensions.cs
  34. +2
    -0
      src/Services/Ordering/Ordering.API/Program.cs
  35. +49
    -0
      src/Services/Ordering/Ordering.API/tye.yaml
  36. +2
    -0
      src/Services/Ordering/Ordering.BackgroundTasks/Program.cs
  37. +41
    -0
      src/Services/Ordering/Ordering.BackgroundTasks/tye.yaml
  38. +1
    -1
      src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Address.cs
  39. +6
    -17
      src/Services/Ordering/Ordering.Domain/SeedWork/ValueObject.cs
  40. +2
    -0
      src/Services/Ordering/Ordering.SignalrHub/Program.cs
  41. +18
    -3
      src/Services/Ordering/Ordering.SignalrHub/Startup.cs
  42. +29
    -0
      src/Services/Ordering/Ordering.SignalrHub/tye.yaml
  43. +190
    -0
      src/Services/Ordering/Ordering.UnitTests/Domain/SeedWork/ValueObjectTests.cs
  44. +2
    -0
      src/Services/Payment/Payment.API/Program.cs
  45. +31
    -0
      src/Services/Payment/Payment.API/tye.yaml
  46. +2
    -0
      src/Services/Webhooks/Webhooks.API/Program.cs
  47. +2
    -0
      src/Services/Webhooks/Webhooks.API/Startup.cs
  48. +27
    -0
      src/Services/Webhooks/Webhooks.API/tye.yaml
  49. +1
    -0
      src/Tests/Services/Application.FunctionalTests/Services/Basket/BasketTestsStartup.cs
  50. +1
    -0
      src/Tests/Services/Application.FunctionalTests/Services/Location/LocationsTestsStartup.cs
  51. +1
    -0
      src/Tests/Services/Application.FunctionalTests/Services/Marketing/MarketingTestsStartup.cs
  52. +4
    -5
      src/Tests/Services/Application.FunctionalTests/Services/Marketing/appsettings.json
  53. +3
    -2
      src/Web/WebMVC/Controllers/AccountController.cs
  54. +2
    -1
      src/Web/WebMVC/Controllers/CampaignsController.cs
  55. +2
    -1
      src/Web/WebMVC/Controllers/CartController.cs
  56. +2
    -1
      src/Web/WebMVC/Controllers/OrderController.cs
  57. +2
    -1
      src/Web/WebMVC/Controllers/OrderManagementController.cs
  58. +2
    -0
      src/Web/WebMVC/Program.cs
  59. +1
    -1
      src/Web/WebMVC/Services/LocationService.cs
  60. +1
    -1
      src/Web/WebMVC/libman.json
  61. +55
    -0
      src/Web/WebMVC/tye.yaml
  62. +2
    -0
      src/Web/WebSPA/Program.cs
  63. +27
    -21
      src/Web/WebSPA/package-lock.json
  64. +31
    -0
      src/Web/WebSPA/tye.yaml
  65. +2
    -0
      src/Web/WebStatus/Program.cs
  66. +71
    -0
      src/Web/WebStatus/tye.yaml
  67. +2
    -0
      src/Web/WebhookClient/Program.cs
  68. +25
    -0
      src/Web/WebhookClient/tye.yaml
  69. +1
    -0
      src/eShopOnContainers-ServicesAndWebApps.sln
  70. +151
    -0
      src/tye.yaml

+ 1
- 1
README.md View File

@ -59,7 +59,7 @@ Do you want to be up-to-date on .NET Architecture guidance and reference apps li
## Updated for .NET Core 3.1 (LTS)
eShopOnContainers is updated to .NET Core 3.1 "wave" of technologies. Not just compilation but also new recommended code in EF Core, ASP.NET Core, and other new related versions and a several significant changes.
eShopOnContainers is updated to .NET Core 3.1 "wave" of technologies. Not just compilation but also new recommended code in EF Core, ASP.NET Core, and other new related versions with several significant changes.
**See more details in the [Release notes](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Release-notes) wiki page**.


+ 1
- 1
build/azure-devops/multiarch.yaml View File

@ -26,7 +26,7 @@ jobs:
mkdir -p ~/.docker
sed '$ s/.$//' $DOCKER_CONFIG/config.json > ~/.docker/config.json
echo ',"experimental": "enabled" }' >> ~/.docker/config.json
docker --config ~/.docker manifest create ${{ parameters.registry }}/${{ parameters.image }}:{{ parameters.branch }} ${{ parameters.registry }}/${{ parameters.image }}:linux-${{ parameters.branch }}
docker --config ~/.docker manifest create ${{ parameters.registry }}/${{ parameters.image }}:${{ parameters.branch }} ${{ parameters.registry }}/${{ parameters.image }}:linux-${{ parameters.branch }}
docker --config ~/.docker manifest create ${{ parameters.registry }}/${{ parameters.image }}:latest ${{ parameters.registry }}/${{ parameters.image }}:linux-latest
docker --config ~/.docker manifest push ${{ parameters.registry }}/${{ parameters.image }}:${{ parameters.branch }}
docker --config ~/.docker manifest push ${{ parameters.registry }}/${{ parameters.image }}:latest


+ 45
- 18
deploy/windows/add-firewall-rules-for-sts-auth-thru-docker.ps1 View File

@ -1,26 +1,53 @@
param([switch]$Elevated)
param(
[string]$Name = "eShopOnContainers",
[string]$InboundDisplayName = "eShopOnContainers-Inbound",
[string]$OutboundDisplayName = "eShopOnContainers-Outbound",
[switch]$Elevated
)
function Check-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if ((Check-Admin) -eq $false) {
if ($elevated)
{
# could not elevate, quit
function Add-InboundRule {
New-NetFirewallRule -DisplayName $InboundDisplayName -Confirm -Description "$Name Inbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
}
else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
function Add-OutboundRule {
New-NetFirewallRule -DisplayName $OutboundDisplayName -Confirm -Description "$Name Outbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
}
exit
if ((Check-Admin) -eq $false) {
if ($elevated)
{
# could not elevate, quit
}
else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
}
exit
}
try {
Get-NetFirewallRule -DisplayName EshopDocker -ErrorAction Stop
Write-Host "Rule found"
$rules = $(Get-NetFirewallRule -DisplayName $Name-* -ErrorAction Stop | Out-String)
if (!$rules.Contains($InboundDisplayName) -and !$rules.Contains($OutboundDisplayName))
{
Add-InboundRule
Add-OutboundRule
}
elseif (!$rules.Contains($InboundDisplayName))
{
Add-InboundRule
}
elseif (!$rules.Contains($OutboundDisplayName))
{
Add-OutboundRule
}
else{
Write-Host "Rules found!"
}
}
catch [Exception] {
Add-InboundRule
Add-OutboundRule
}
catch [Exception] {
New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
}

+ 3
- 3
src/.env View File

@ -5,9 +5,9 @@
# The IP below should be swapped to your real IP or DNS name, like 192.168.88.248, etc. if testing from remote browsers or mobile devices
# Use this values to run the app locally in Windows
ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.win.localhost
ESHOP_STORAGE_CATALOG_URL=http://docker.for.win.localhost:5202/c/api/v1/catalog/items/[0]/pic/
ESHOP_STORAGE_MARKETING_URL=http://docker.for.win.localhost:5110/api/v1/campaigns/[0]/pic/
ESHOP_EXTERNAL_DNS_NAME_OR_IP=host.docker.internal
ESHOP_STORAGE_CATALOG_URL=http://host.docker.internal:5202/c/api/v1/catalog/items/[0]/pic/
ESHOP_STORAGE_MARKETING_URL=http://host.docker.internal:5110/api/v1/campaigns/[0]/pic/
# Use this values to run the app locally in Mac
# ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.mac.localhost


+ 13
- 0
src/ApiGateways/Envoy/config/webmarketing/envoy.yaml View File

@ -36,6 +36,19 @@ static_resources:
route:
auto_host_rewrite: true
cluster: marketing
- name: "l-short"
match:
prefix: "/l/"
route:
auto_host_rewrite: true
prefix_rewrite: "/locations-api/"
cluster: locations
- name: "l-long"
match:
prefix: "/locations-api/"
route:
auto_host_rewrite: true
cluster: locations
http_filters:
- name: envoy.router
access_log:


+ 3
- 0
src/ApiGateways/Envoy/config/webshopping/envoy.yaml View File

@ -56,6 +56,9 @@ static_resources:
auto_host_rewrite: true
cluster: signalr-hub
timeout: 300s
upgrade_configs:
upgrade_type: "websocket"
enabled: true
- name: "b-short"
match:
prefix: "/b/"


+ 76
- 0
src/ApiGateways/Envoy/tye-config/mobilemarketing/envoy.yaml View File

@ -0,0 +1,76 @@
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8001
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
route_config:
name: eshop_backend_route
virtual_hosts:
- name: eshop_backend
domains:
- "*"
routes:
- name: "m-short"
match:
prefix: "/m/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: marketing
- name: "m-long"
match:
prefix: "/marketing-api/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: marketing
http_filters:
- name: envoy.router
access_log:
- name: envoy.file_access_log
filter:
not_health_check_filter: {}
config:
json_format:
time: "%START_TIME%"
protocol: "%PROTOCOL%"
duration: "%DURATION%"
request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
response_flags: "%RESPONSE_FLAGS%"
route_name: "%ROUTE_NAME%"
upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
path: "/tmp/access.log"
clusters:
- name: marketing
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5110
- name: locations
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 80

+ 139
- 0
src/ApiGateways/Envoy/tye-config/mobileshopping/envoy.yaml View File

@ -0,0 +1,139 @@
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8001
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
route_config:
name: eshop_backend_route
virtual_hosts:
- name: eshop_backend
domains:
- "*"
routes:
- name: "c-short"
match:
prefix: "/c/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: catalog
- name: "c-long"
match:
prefix: "/catalog-api/"
route:
auto_host_rewrite: true
cluster: catalog
- name: "o-short"
match:
prefix: "/o/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: ordering
- name: "o-long"
match:
prefix: "/ordering-api/"
route:
auto_host_rewrite: true
cluster: ordering
- name: "h-long"
match:
prefix: "/hub/notificationhub"
route:
auto_host_rewrite: true
cluster: signalr-hub
timeout: 300s
- name: "b-short"
match:
prefix: "/b/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: basket
- name: "b-long"
match:
prefix: "/basket-api/"
route:
auto_host_rewrite: true
cluster: basket
- name: "agg"
match:
prefix: "/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: shoppingagg
http_filters:
- name: envoy.router
access_log:
- name: envoy.file_access_log
filter:
not_health_check_filter: {}
config:
json_format:
time: "%START_TIME%"
protocol: "%PROTOCOL%"
duration: "%DURATION%"
request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
response_flags: "%RESPONSE_FLAGS%"
route_name: "%ROUTE_NAME%"
upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
path: "/tmp/access.log"
clusters:
- name: shoppingagg
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5121
- name: catalog
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5101
- name: basket
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5103
- name: ordering
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5102
- name: signalr-hub
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5112

+ 76
- 0
src/ApiGateways/Envoy/tye-config/webmarketing/envoy.yaml View File

@ -0,0 +1,76 @@
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8001
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
route_config:
name: eshop_backend_route
virtual_hosts:
- name: eshop_backend
domains:
- "*"
routes:
- name: "m-short"
match:
prefix: "/m/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: marketing
- name: "m-long"
match:
prefix: "/marketing-api/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: marketing
http_filters:
- name: envoy.router
access_log:
- name: envoy.file_access_log
filter:
not_health_check_filter: {}
config:
json_format:
time: "%START_TIME%"
protocol: "%PROTOCOL%"
duration: "%DURATION%"
request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
response_flags: "%RESPONSE_FLAGS%"
route_name: "%ROUTE_NAME%"
upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
path: "/tmp/access.log"
clusters:
- name: marketing
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5110
- name: locations
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 80

+ 139
- 0
src/ApiGateways/Envoy/tye-config/webshopping/envoy.yaml View File

@ -0,0 +1,139 @@
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8001
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
route_config:
name: eshop_backend_route
virtual_hosts:
- name: eshop_backend
domains:
- "*"
routes:
- name: "c-short"
match:
prefix: "/c/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: catalog
- name: "c-long"
match:
prefix: "/catalog-api/"
route:
auto_host_rewrite: true
cluster: catalog
- name: "o-short"
match:
prefix: "/o/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: ordering
- name: "o-long"
match:
prefix: "/ordering-api/"
route:
auto_host_rewrite: true
cluster: ordering
- name: "h-long"
match:
prefix: "/hub/notificationhub"
route:
auto_host_rewrite: true
cluster: signalr-hub
timeout: 300s
- name: "b-short"
match:
prefix: "/b/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: basket
- name: "b-long"
match:
prefix: "/basket-api/"
route:
auto_host_rewrite: true
cluster: basket
- name: "agg"
match:
prefix: "/"
route:
auto_host_rewrite: true
prefix_rewrite: "/"
cluster: shoppingagg
http_filters:
- name: envoy.router
access_log:
- name: envoy.file_access_log
filter:
not_health_check_filter: {}
config:
json_format:
time: "%START_TIME%"
protocol: "%PROTOCOL%"
duration: "%DURATION%"
request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
response_flags: "%RESPONSE_FLAGS%"
route_name: "%ROUTE_NAME%"
upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
path: "/tmp/access.log"
clusters:
- name: shoppingagg
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5121
- name: catalog
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5101
- name: basket
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5103
- name: ordering
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5102
- name: signalr-hub
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: host.docker.internal
port_value: 5112

+ 43
- 0
src/ApiGateways/Mobile.Bff.Shopping/aggregator/tye.yaml View File

@ -0,0 +1,43 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: mobileshoppingagg
project: Mobile.Shopping.HttpAggregator.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: urls__basket
value: http://localhost:5103
- name: urls__catalog
value: http://localhost:5101
- name: urls__orders
value: http://localhost:5102
- name: urls__identity
value: http://localhost:5105
- name: urls__grpcBasket
value: http://localhost:9103
- name: urls__grpcCatalog
value: http://localhost:9101
- name: urls__grpcOrdering
value: http://localhost:9102
- name: CatalogUrlHC
value: http://localhost:5101/hc
- name: OrderingUrlHC
value: http://localhost:5102/hc
- name: IdentityUrlHC
value: http://localhost:5105/hc
- name: BasketUrlHC
value: http://localhost:5103/hc
- name: MarketingUrlHC
value: http://localhost:5110/hc
- name: PaymentUrlHC
value: http://localhost:5108/hc
- name: LocationUrlHC
value: http://localhost:5109/hc
- name: IdentityUrlExternal
value: http://localhost:5105
bindings:
- name: http-port-80-binding
port: 5120
protocol: http

+ 43
- 0
src/ApiGateways/Web.Bff.Shopping/aggregator/tye.yaml View File

@ -0,0 +1,43 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: webshoppingagg
project: Web.Shopping.HttpAggregator.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: urls__basket
value: http://localhost:5103
- name: urls__catalog
value: http://localhost:5101
- name: urls__orders
value: http://localhost:5102
- name: urls__identity
value: http://localhost:5105
- name: urls__grpcBasket
value: http://localhost:9103
- name: urls__grpcCatalog
value: http://localhost:9101
- name: urls__grpcOrdering
value: http://localhost:9102
- name: CatalogUrlHC
value: http://localhost:5101/hc
- name: OrderingUrlHC
value: http://localhost:5102/hc
- name: IdentityUrlHC
value: http://localhost:5105/hc
- name: BasketUrlHC
value: http://localhost:5103/hc
- name: MarketingUrlHC
value: http://localhost:5110/hc
- name: PaymentUrlHC
value: http://localhost:5108/hc
- name: LocationUrlHC
value: http://localhost:5109/hc
- name: IdentityUrlExternal
value: http://localhost:5105
bindings:
- name: http-port-80-binding
port: 5121
protocol: http

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

@ -21,12 +21,12 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
public class EventBusRabbitMQ : IEventBus, IDisposable
{
const string BROKER_NAME = "eshop_event_bus";
const string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
private readonly IRabbitMQPersistentConnection _persistentConnection;
private readonly ILogger<EventBusRabbitMQ> _logger;
private readonly IEventBusSubscriptionsManager _subsManager;
private readonly ILifetimeScope _autofac;
private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
private readonly int _retryCount;
private IModel _consumerChannel;
@ -86,7 +86,6 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
using (var channel = _persistentConnection.CreateModel())
{
_logger.LogTrace("Declaring RabbitMQ exchange to publish event: {EventId}", @event.Id);
channel.ExchangeDeclare(exchange: BROKER_NAME, type: "direct");


+ 22
- 1
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs View File

@ -15,11 +15,12 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services
{
public class IntegrationEventLogService : IIntegrationEventLogService
public class IntegrationEventLogService : IIntegrationEventLogService,IDisposable
{
private readonly IntegrationEventLogContext _integrationEventLogContext;
private readonly DbConnection _dbConnection;
private readonly List<Type> _eventTypes;
private volatile bool disposedValue;
public IntegrationEventLogService(DbConnection dbConnection)
{
@ -89,5 +90,25 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Servi
return _integrationEventLogContext.SaveChangesAsync();
}
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
_integrationEventLogContext?.Dispose();
}
disposedValue = true;
}
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}

+ 2
- 0
src/Services/Basket/Basket.API/Startup.cs View File

@ -36,6 +36,7 @@ using System.IO;
using GrpcBasket;
using Microsoft.AspNetCore.Http.Features;
using Serilog;
using System.Diagnostics;
namespace Microsoft.eShopOnContainers.Services.Basket.API
{
@ -43,6 +44,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{
public Startup(IConfiguration configuration)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
Configuration = configuration;
}


+ 41
- 0
src/Services/Basket/Basket.API/tye.yaml View File

@ -0,0 +1,41 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: basket-api
project: Basket.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: ConnectionString
value: 127.0.0.1
- name: identityUrl
value: http://localhost:5105
- name: IdentityUrlExternal
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: AzureServiceBusEnabled
value: False
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: UseLoadTest
value: False
- name: GRPC_PORT
value: 9103
- name: PORT
value: 80
- name: PATH_BASE
value: /basket-api
bindings:
- name: http-port-80-binding
port: 5103
protocol: http

+ 1
- 1
src/Services/Catalog/Catalog.API/Controllers/PicController.cs View File

@ -46,7 +46,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
string imageFileExtension = Path.GetExtension(item.PictureFileName);
string mimetype = GetImageMimeTypeFromImageFileExtension(imageFileExtension);
var buffer = System.IO.File.ReadAllBytes(path);
var buffer = await System.IO.File.ReadAllBytesAsync(path);
return File(buffer, mimetype);
}


+ 9
- 6
src/Services/Catalog/Catalog.API/Extensions/WebHostExtensions.cs View File

@ -40,13 +40,16 @@ namespace Catalog.API.Extensions
}
else
{
//var retry = Policy.Handle<SqlException>()
// .WaitAndRetry(new TimeSpan[]
// {
// TimeSpan.FromSeconds(3),
// TimeSpan.FromSeconds(5),
// TimeSpan.FromSeconds(8),
// });
var retry = Policy.Handle<SqlException>()
.WaitAndRetry(new TimeSpan[]
{
TimeSpan.FromSeconds(3),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(8),
});
.WaitAndRetry(10, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
//if the sql server container is not created on run docker compose this
//migration can't fail for network related exception. The retry options for DbContext only


+ 5
- 6
src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs View File

@ -68,11 +68,10 @@ namespace Catalog.API.Grpc
{
var items = await GetItemsByIdsAsync(request.Ids);
if (!items.Any())
{
context.Status = new Status(StatusCode.NotFound, $"ids value invalid. Must be comma-separated list of numbers");
}
context.Status = new Status(StatusCode.OK, string.Empty);
context.Status = !items.Any() ?
new Status(StatusCode.NotFound, $"ids value invalid. Must be comma-separated list of numbers") :
new Status(StatusCode.OK, string.Empty);
return this.MapToResponse(items);
}
@ -104,7 +103,7 @@ namespace Catalog.API.Grpc
private PaginatedItemsResponse MapToResponse(List<CatalogItem> items)
{
return this.MapToResponse(items, items.Count(), 1, items.Count());
return this.MapToResponse(items, items.Count, 1, items.Count);
}
private PaginatedItemsResponse MapToResponse(List<CatalogItem> items, long count, int pageIndex, int pageSize)


+ 21
- 1
src/Services/Catalog/Catalog.API/IntegrationEvents/CatalogIntegrationEventService.cs View File

@ -14,13 +14,14 @@ using System.Threading.Tasks;
namespace Catalog.API.IntegrationEvents
{
public class CatalogIntegrationEventService : ICatalogIntegrationEventService
public class CatalogIntegrationEventService : ICatalogIntegrationEventService,IDisposable
{
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory;
private readonly IEventBus _eventBus;
private readonly CatalogContext _catalogContext;
private readonly IIntegrationEventLogService _eventLogService;
private readonly ILogger<CatalogIntegrationEventService> _logger;
private volatile bool disposedValue;
public CatalogIntegrationEventService(
ILogger<CatalogIntegrationEventService> logger,
@ -65,5 +66,24 @@ namespace Catalog.API.IntegrationEvents
await _eventLogService.SaveEventAsync(evt, _catalogContext.Database.CurrentTransaction);
});
}
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
(_eventLogService as IDisposable)?.Dispose();
}
disposedValue = true;
}
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}

+ 3
- 0
src/Services/Catalog/Catalog.API/Program.cs View File

@ -13,6 +13,7 @@ using Microsoft.Extensions.Options;
using Serilog;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
@ -26,6 +27,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 43
- 0
src/Services/Catalog/Catalog.API/tye.yaml View File

@ -0,0 +1,43 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: catalog-api
project: Catalog.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ConnectionString
value: Server=localhost;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
- name: PicBaseUrl
value: http://localhost:5202/c/api/v1/catalog/items/[0]/pic/
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: AzureStorageAccountName
value:
- name: AzureStorageAccountKey
value:
- name: UseCustomizationData
value: True
- name: AzureServiceBusEnabled
value: False
- name: AzureStorageEnabled
value: False
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: GRPC_PORT
value: 9101
- name: PORT
value: 80
- name: PATH_BASE
value: /catalog-api
bindings:
- protocol: http
name: http-port-80-binding
port: 5101

+ 2
- 0
src/Services/Identity/Identity.API/Startup.cs View File

@ -20,6 +20,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using StackExchange.Redis;
using System;
using System.Diagnostics;
using System.Reflection;
namespace Microsoft.eShopOnContainers.Services.Identity.API
@ -28,6 +29,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
public Startup(IConfiguration configuration)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
Configuration = configuration;
}


+ 44
- 0
src/Services/Identity/Identity.API/tye.yaml View File

@ -0,0 +1,44 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: identity-api
project: Identity.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: SpaClient
value: http://localhost:5104/
- name: XamarinCallback
value: http://localhost:5105/xamarincallback
- name: ConnectionString
value: Server=localhost;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
- name: MvcClient
value: http://localhost:5100
- name: LocationApiClient
value: http://localhost:5109
- name: MarketingApiClient
value: http://localhost:5110
- name: BasketApiClient
value: http://localhost:5103
- name: OrderingApiClient
value: http://localhost:5102
- name: MobileShoppingAggClient
value: http://localhost:5120
- name: WebShoppingAggClient
value: http://localhost:5121
- name: WebhooksApiClient
value: http://localhost:5113
- name: WebhooksWebClient
value: http://localhost:5114
- name: UseCustomizationData
value: True
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
bindings:
- name: http-binding
port: 5105

+ 2
- 0
src/Services/Location/Locations.API/Program.cs View File

@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
using System;
using System.Diagnostics;
using System.IO;
namespace Microsoft.eShopOnContainers.Services.Locations.API
@ -16,6 +17,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 2
- 2
src/Services/Location/Locations.API/appsettings.json View File

@ -23,7 +23,7 @@
"UseVault": false,
"Vault": {
"Name": "eshop",
"ClientId": "your-clien-id",
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret"
}
}
}

+ 39
- 0
src/Services/Location/Locations.API/tye.yaml View File

@ -0,0 +1,39 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: locations-api
project: Locations.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: ConnectionString
value: mongodb://localhost:27017
- name: Database
value: LocationsDb
- name: identityUrl
value: http://localhost:5105
- name: IdentityUrlExternal
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: AzureServiceBusEnabled
value: False
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: UseLoadTest
value: False
- name: PATH_BASE
value: /locations-api
bindings:
- name: http-port-80-binding
port: 5109
protocol: http

+ 1
- 1
src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs View File

@ -13,7 +13,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
using EntityFrameworkCore;
using Dto;
using AspNetCore.Authorization;
using Extensions.Options;
using Microsoft.Extensions.Options;
using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel;
using Microsoft.AspNetCore.Http;
using System.Net;


+ 75
- 0
src/Services/Marketing/Marketing.API/Extensions/WebHostExtensions.cs View File

@ -0,0 +1,75 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Polly;
using System.Data.SqlClient;
using Microsoft.AspNetCore.Hosting;
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Extensions
{
public static class WebHostExtensions
{
public static bool IsInKubernetes(this IWebHost host)
{
var cfg = host.Services.GetService<IConfiguration>();
var orchestratorType = cfg.GetValue<string>("OrchestratorType");
return orchestratorType?.ToUpper() == "K8S";
}
public static IWebHost MigrateDbContext<TContext>(this IWebHost host, Action<TContext, IServiceProvider> seeder) where TContext : DbContext
{
var underK8s = host.IsInKubernetes();
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var logger = services.GetRequiredService<ILogger<TContext>>();
var context = services.GetService<TContext>();
try
{
logger.LogInformation("Migrating database associated with context {DbContextName}", typeof(TContext).Name);
if (underK8s)
{
InvokeSeeder(seeder, context, services);
}
else
{
var retry = Policy.Handle<SqlException>()
.WaitAndRetry(10, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
//if the sql server container is not created on run docker compose this
//migration can't fail for network related exception. The retry options for DbContext only
//apply to transient exceptions
// Note that this is NOT applied when running some orchestrators (let the orchestrator to recreate the failing service)
retry.Execute(() => InvokeSeeder(seeder, context, services));
}
logger.LogInformation("Migrated database associated with context {DbContextName}", typeof(TContext).Name);
}
catch (Exception ex)
{
logger.LogError(ex, "An error occurred while migrating the database used on context {DbContextName}", typeof(TContext).Name);
if (underK8s)
{
throw; // Rethrow under k8s because we rely on k8s to re-run the pod
}
}
}
return host;
}
private static void InvokeSeeder<TContext>(Action<TContext, IServiceProvider> seeder, TContext context, IServiceProvider services)
where TContext : DbContext
{
context.Database.Migrate();
seeder(context, services);
}
}
}

+ 3
- 0
src/Services/Marketing/Marketing.API/Marketing.API.csproj View File

@ -38,11 +38,14 @@
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
<PackageReference Include="MongoDB.Bson" Version="2.10.0" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.10.0" />
<PackageReference Include="MongoDB.Driver" Version="2.10.0" />
<PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.1-dev-00216" />


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

@ -11,9 +11,9 @@
using BuildingBlocks.EventBusRabbitMQ;
using BuildingBlocks.EventBusServiceBus;
using EntityFrameworkCore;
using Extensions.Configuration;
using Extensions.DependencyInjection;
using Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using HealthChecks.UI.Client;
using Infrastructure;
using Infrastructure.Filters;
@ -34,11 +34,13 @@
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Reflection;
using System.Diagnostics;
public class Startup
{
public Startup(IConfiguration configuration)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
Configuration = configuration;
}


+ 51
- 0
src/Services/Marketing/Marketing.API/tye.yaml View File

@ -0,0 +1,51 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: marketing-api
project: Marketing.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: ConnectionString
value: Server=localhost;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word
- name: MongoConnectionString
value: mongodb://localhost:27017
- name: MongoDatabase
value: MarketingDb
- name: identityUrl
value: http://localhost:5105
- name: IdentityUrlExternal
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: CampaignDetailFunctionUri
value:
- name: PicBaseUrl
value:
- name: AzureStorageAccountName
value:
- name: AzureStorageAccountKey
value:
- name: AzureServiceBusEnabled
value: False
- name: AzureStorageEnabled
value: False
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: UseLoadTest
value: False
- name: PATH_BASE
value: /marketing-api
bindings:
- name: http-port-80-binding
port: 5110
protocol: http

+ 76
- 0
src/Services/Ordering/Ordering.API/Extensions/WebHostExtensions.cs View File

@ -0,0 +1,76 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Polly;
using System.Data.SqlClient;
using Microsoft.AspNetCore.Hosting;
namespace Ordering.API.Extensions
{
public static class WebHostExtensions
{
public static bool IsInKubernetes(this IWebHost host)
{
var cfg = host.Services.GetService<IConfiguration>();
var orchestratorType = cfg.GetValue<string>("OrchestratorType");
return orchestratorType?.ToUpper() == "K8S";
}
public static IWebHost MigrateDbContext<TContext>(this IWebHost host, Action<TContext, IServiceProvider> seeder) where TContext : DbContext
{
var underK8s = host.IsInKubernetes();
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var logger = services.GetRequiredService<ILogger<TContext>>();
var context = services.GetService<TContext>();
try
{
logger.LogInformation("Migrating database associated with context {DbContextName}", typeof(TContext).Name);
if (underK8s)
{
InvokeSeeder(seeder, context, services);
}
else
{
var retry = Policy.Handle<SqlException>()
.WaitAndRetry(10, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
//if the sql server container is not created on run docker compose this
//migration can't fail for network related exception. The retry options for DbContext only
//apply to transient exceptions
// Note that this is NOT applied when running some orchestrators (let the orchestrator to recreate the failing service)
retry.Execute(() => InvokeSeeder(seeder, context, services));
}
logger.LogInformation("Migrated database associated with context {DbContextName}", typeof(TContext).Name);
}
catch (Exception ex)
{
logger.LogError(ex, "An error occurred while migrating the database used on context {DbContextName}", typeof(TContext).Name);
if (underK8s)
{
throw; // Rethrow under k8s because we rely on k8s to re-run the pod
}
}
}
return host;
}
private static void InvokeSeeder<TContext>(Action<TContext, IServiceProvider> seeder, TContext context, IServiceProvider services)
where TContext : DbContext
{
context.Database.Migrate();
seeder(context, services);
}
}
}

+ 2
- 0
src/Services/Ordering/Ordering.API/Program.cs View File

@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Serilog;
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
@ -22,6 +23,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 49
- 0
src/Services/Ordering/Ordering.API/tye.yaml View File

@ -0,0 +1,49 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: ordering-api
project: Ordering.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: ConnectionString
value: Server=localhost;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
- name: identityUrl
value: http://localhost:5105
- name: IdentityUrlExternal
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: UseCustomizationData
value: True
- name: AzureServiceBusEnabled
value: False
- name: CheckUpdateTime
value: 30000
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: UseLoadTest
value: False
- name: Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
value: Verbose
- name: Serilog__MinimumLevel__Override__ordering-api
value: Verbose
- name: GRPC_PORT
value: 9102
- name: PORT
value: 80
- name: PATH_BASE
value: /ordering-api
bindings:
- name: http-port-80-binding
port: 5102
protocol: http

+ 2
- 0
src/Services/Ordering/Ordering.BackgroundTasks/Program.cs View File

@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Ordering.BackgroundTasks.Extensions;
using Serilog;
using System.Diagnostics;
using System.IO;
namespace Ordering.BackgroundTasks
@ -14,6 +15,7 @@ namespace Ordering.BackgroundTasks
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateHostBuilder(args).Run();
}


+ 41
- 0
src/Services/Ordering/Ordering.BackgroundTasks/tye.yaml View File

@ -0,0 +1,41 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: ordering-backgroundtasks
project: Ordering.BackgroundTasks.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: ConnectionString
value: Server=localhost;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
- name: identityUrl
value: http://localhost:5105
- name: IdentityUrlExternal
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: UseCustomizationData
value: True
- name: AzureServiceBusEnabled
value: False
- name: CheckUpdateTime
value: 30000
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: UseLoadTest
value: False
- name: Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
value: Verbose
bindings:
- name: http-port-80-binding
port: 5111
protocol: http

+ 1
- 1
src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Address.cs View File

@ -23,7 +23,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
ZipCode = zipcode;
}
protected override IEnumerable<object> GetAtomicValues()
protected override IEnumerable<object> GetEqualityComponents()
{
// Using a yield return statement to return each element one at a time
yield return Street;


+ 6
- 17
src/Services/Ordering/Ordering.Domain/SeedWork/ValueObject.cs View File

@ -19,7 +19,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
return !(EqualOperator(left, right));
}
protected abstract IEnumerable<object> GetAtomicValues();
protected abstract IEnumerable<object> GetEqualityComponents();
public override bool Equals(object obj)
{
@ -27,26 +27,15 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
{
return false;
}
ValueObject other = (ValueObject)obj;
IEnumerator<object> thisValues = GetAtomicValues().GetEnumerator();
IEnumerator<object> otherValues = other.GetAtomicValues().GetEnumerator();
while (thisValues.MoveNext() && otherValues.MoveNext())
{
if (ReferenceEquals(thisValues.Current, null) ^ ReferenceEquals(otherValues.Current, null))
{
return false;
}
if (thisValues.Current != null && !thisValues.Current.Equals(otherValues.Current))
{
return false;
}
}
return !thisValues.MoveNext() && !otherValues.MoveNext();
var other = (ValueObject)obj;
return this.GetEqualityComponents().SequenceEqual(other.GetEqualityComponents());
}
public override int GetHashCode()
{
return GetAtomicValues()
return GetEqualityComponents()
.Select(x => x != null ? x.GetHashCode() : 0)
.Aggregate((x, y) => x ^ y);
}


+ 2
- 0
src/Services/Ordering/Ordering.SignalrHub/Program.cs View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -18,6 +19,7 @@ namespace Ordering.SignalrHub
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 18
- 3
src/Services/Ordering/Ordering.SignalrHub/Startup.cs View File

@ -19,6 +19,7 @@ using Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Ordering.SignalrHub.IntegrationEvents.Events;
using RabbitMQ.Client;
using System;
using System.Threading.Tasks;
using System.IdentityModel.Tokens.Jwt;
namespace Ordering.SignalrHub
@ -109,7 +110,7 @@ namespace Ordering.SignalrHub
RegisterEventBus(services);
services.AddOptions();
//configure autofac
var container = new ContainerBuilder();
container.RegisterModule(new ApplicationModule());
@ -133,7 +134,7 @@ namespace Ordering.SignalrHub
loggerFactory.CreateLogger<Startup>().LogDebug("Using PATH BASE '{pathBase}'", pathBase);
app.UsePathBase(pathBase);
}
app.UseRouting();
app.UseCors("CorsPolicy");
app.UseAuthentication();
@ -150,7 +151,7 @@ namespace Ordering.SignalrHub
{
Predicate = r => r.Name.Contains("self")
});
endpoints.MapHub<NotificationsHub>("/hub/notificationhub", options => options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransports.All);
endpoints.MapHub<NotificationsHub>("/hub/notificationhub");
});
ConfigureEventBus(app);
@ -185,6 +186,20 @@ namespace Ordering.SignalrHub
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
options.Audience = "orders.signalrhub";
options.Events = new JwtBearerEvents
{
OnMessageReceived = context =>
{
var accessToken = context.Request.Query["access_token"];
var path = context.HttpContext.Request.Path;
if (!string.IsNullOrEmpty(accessToken) && (path.StartsWithSegments("/hub/notificationhub")))
{
context.Token = accessToken;
}
return Task.CompletedTask;
}
};
});
}


+ 29
- 0
src/Services/Ordering/Ordering.SignalrHub/tye.yaml View File

@ -0,0 +1,29 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: ordering-signalrhub
project: Ordering.SignalrHub.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: identityUrl
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: AzureServiceBusEnabled
value: False
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
bindings:
- name: http-port-80-binding
port: 5112
protocol: http

+ 190
- 0
src/Services/Ordering/Ordering.UnitTests/Domain/SeedWork/ValueObjectTests.cs View File

@ -0,0 +1,190 @@
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
namespace Ordering.UnitTests.Domain.SeedWork
{
public class ValueObjectTests
{
public ValueObjectTests()
{ }
[Theory]
[MemberData(nameof(EqualValueObjects))]
public void Equals_EqualValueObjects_ReturnsTrue(ValueObject instanceA, ValueObject instanceB, string reason)
{
// Act
var result = EqualityComparer<ValueObject>.Default.Equals(instanceA, instanceB);
// Assert
Assert.True(result, reason);
}
[Theory]
[MemberData(nameof(NonEqualValueObjects))]
public void Equals_NonEqualValueObjects_ReturnsFalse(ValueObject instanceA, ValueObject instanceB, string reason)
{
// Act
var result = EqualityComparer<ValueObject>.Default.Equals(instanceA, instanceB);
// Assert
Assert.False(result, reason);
}
private static readonly ValueObject APrettyValueObject = new ValueObjectA(1, "2", Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), new ComplexObject(2, "3"));
public static readonly TheoryData<ValueObject, ValueObject, string> EqualValueObjects = new TheoryData<ValueObject, ValueObject, string>
{
{
null,
null,
"they should be equal because they are both null"
},
{
APrettyValueObject,
APrettyValueObject,
"they should be equal because they are the same object"
},
{
new ValueObjectA(1, "2", Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), new ComplexObject(2, "3")),
new ValueObjectA(1, "2", Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), new ComplexObject(2, "3")),
"they should be equal because they have equal members"
},
{
new ValueObjectA(1, "2", Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), new ComplexObject(2, "3"), notAnEqualityComponent: "xpto"),
new ValueObjectA(1, "2", Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), new ComplexObject(2, "3"), notAnEqualityComponent: "xpto2"),
"they should be equal because all equality components are equal, even though an additional member was set"
},
{
new ValueObjectB(1, "2", 1, 2, 3 ),
new ValueObjectB(1, "2", 1, 2, 3 ),
"they should be equal because all equality components are equal, including the 'C' list"
}
};
public static readonly TheoryData<ValueObject, ValueObject, string> NonEqualValueObjects = new TheoryData<ValueObject, ValueObject, string>
{
{
new ValueObjectA(a: 1, b: "2", c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(2, "3")),
new ValueObjectA(a: 2, b: "2", c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(2, "3")),
"they should not be equal because the 'A' member on ValueObjectA is different among them"
},
{
new ValueObjectA(a: 1, b: "2", c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(2, "3")),
new ValueObjectA(a: 1, b: null, c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(2, "3")),
"they should not be equal because the 'B' member on ValueObjectA is different among them"
},
{
new ValueObjectA(a: 1, b: "2", c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(a: 2, b: "3")),
new ValueObjectA(a: 1, b: "2", c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(a: 3, b: "3")),
"they should not be equal because the 'A' member on ValueObjectA's 'D' member is different among them"
},
{
new ValueObjectA(a: 1, b: "2", c: Guid.Parse("97ea43f0-6fef-4fb7-8c67-9114a7ff6ec0"), d: new ComplexObject(a: 2, b: "3")),
new ValueObjectB(a: 1, b: "2"),
"they should not be equal because they are not of the same type"
},
{
new ValueObjectB(1, "2", 1, 2, 3 ),
new ValueObjectB(1, "2", 1, 2, 3, 4 ),
"they should be not be equal because the 'C' list contains one additional value"
},
{
new ValueObjectB(1, "2", 1, 2, 3, 5 ),
new ValueObjectB(1, "2", 1, 2, 3 ),
"they should be not be equal because the 'C' list contains one additional value"
},
{
new ValueObjectB(1, "2", 1, 2, 3, 5 ),
new ValueObjectB(1, "2", 1, 2, 3, 4 ),
"they should be not be equal because the 'C' lists are not equal"
}
};
private class ValueObjectA : ValueObject
{
public ValueObjectA(int a, string b, Guid c, ComplexObject d, string notAnEqualityComponent = null)
{
A = a;
B = b;
C = c;
D = d;
NotAnEqualityComponent = notAnEqualityComponent;
}
public int A { get; }
public string B { get; }
public Guid C { get; }
public ComplexObject D { get; }
public string NotAnEqualityComponent { get; }
protected override IEnumerable<object> GetEqualityComponents()
{
yield return A;
yield return B;
yield return C;
yield return D;
}
}
private class ValueObjectB : ValueObject
{
public ValueObjectB(int a, string b, params int[] c)
{
A = a;
B = b;
C = c.ToList();
}
public int A { get; }
public string B { get; }
public List<int> C { get; }
protected override IEnumerable<object> GetEqualityComponents()
{
yield return A;
yield return B;
foreach (var c in C)
{
yield return c;
}
}
}
private class ComplexObject : IEquatable<ComplexObject>
{
public ComplexObject(int a, string b)
{
A = a;
B = b;
}
public int A { get; set; }
public string B { get; set; }
public override bool Equals(object obj)
{
return Equals(obj as ComplexObject);
}
public bool Equals(ComplexObject other)
{
return other != null &&
A == other.A &&
B == other.B;
}
public override int GetHashCode()
{
return HashCode.Combine(A, B);
}
}
}
}

+ 2
- 0
src/Services/Payment/Payment.API/Program.cs View File

@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
using System;
using System.Diagnostics;
using System.IO;
namespace Payment.API
@ -16,6 +17,7 @@ namespace Payment.API
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 31
- 0
src/Services/Payment/Payment.API/tye.yaml View File

@ -0,0 +1,31 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: payment-api
project: Payment.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
- name: AzureServiceBusEnabled
value: False
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling
value: Verbose
- name: Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
value: Verbose
bindings:
- name: http-port-80-binding
port: 5108
protocol: http

+ 2
- 0
src/Services/Webhooks/Webhooks.API/Program.cs View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -15,6 +16,7 @@ namespace Webhooks.API
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateWebHostBuilder(args).Build()
.MigrateDbContext<WebhooksContext>((_,__) => { })
.Run();


+ 2
- 0
src/Services/Webhooks/Webhooks.API/Startup.cs View File

@ -23,6 +23,7 @@ using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics;
using System.IdentityModel.Tokens.Jwt;
using System.Reflection;
using System.Threading;
@ -38,6 +39,7 @@ namespace Webhooks.API
public Startup(IConfiguration configuration)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
Configuration = configuration;
}


+ 27
- 0
src/Services/Webhooks/Webhooks.API/tye.yaml View File

@ -0,0 +1,27 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: webhooks-api
project: Webhooks.API.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: ConnectionString
value: Server=localhost;Database=Microsoft.eShopOnContainers.Services.WebhooksDb;User Id=sa;Password=Pass@word
- name: identityUrl
value: http://localhost:5105
- name: IdentityUrlExternal
value: http://localhost:5105
- name: EventBusConnection
value: localhost
- name: EventBusUserName
value:
- name: EventBusPassword
value:
bindings:
- name: http-port-80-binding
port: 5113
protocol: http

+ 1
- 0
src/Tests/Services/Application.FunctionalTests/Services/Basket/BasketTestsStartup.cs View File

@ -16,6 +16,7 @@ namespace FunctionalTests.Services.Basket
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())
{
app.UseMiddleware<AutoAuthorizeMiddleware>();
app.UseAuthorization();
}
else
{


+ 1
- 0
src/Tests/Services/Application.FunctionalTests/Services/Location/LocationsTestsStartup.cs View File

@ -19,6 +19,7 @@
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())
{
app.UseMiddleware<LocationAuthorizeMiddleware>();
app.UseAuthorization();
}
else
{


+ 1
- 0
src/Tests/Services/Application.FunctionalTests/Services/Marketing/MarketingTestsStartup.cs View File

@ -16,6 +16,7 @@
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())
{
app.UseMiddleware<AutoAuthorizeMiddleware>();
app.UseAuthorization();
}
else
{


+ 4
- 5
src/Tests/Services/Application.FunctionalTests/Services/Marketing/appsettings.json View File

@ -1,12 +1,11 @@
{
"AzureServiceBusEnabled": false,
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word",
"MongoConnectionString": "mongodb://localhost:27017",
"MongoDatabase": "MarketingDb",
"EventBusConnection": "localhost",
"IdentityUrl": "http://localhost:5105",
"isTest": "true",
"EventBusConnection": "localhost",
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Marketing",
"MongoConnectionString": "mongodb://localhost:27017",
"MongoDatabase": "MarketingDb",
"PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/",
"SubscriptionClientName": "Marketing"
}

+ 3
- 2
src/Web/WebMVC/Controllers/AccountController.cs View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = "OpenIdConnect")]
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class AccountController : Controller
{
private readonly ILogger<AccountController> _logger;
@ -20,7 +20,8 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
[Authorize(AuthenticationSchemes = "OpenIdConnect")] public async Task<IActionResult> SignIn(string returnUrl)
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public async Task<IActionResult> SignIn(string returnUrl)
{
var user = User as ClaimsPrincipal;
var token = await HttpContext.GetTokenAsync("access_token");


+ 2
- 1
src/Web/WebMVC/Controllers/CampaignsController.cs View File

@ -11,8 +11,9 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
using System.Threading.Tasks;
using ViewModels;
using ViewModels.Pagination;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
[Authorize(AuthenticationSchemes = "OpenIdConnect")]
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class CampaignsController : Controller
{
private readonly ICampaignService _campaignService;


+ 2
- 1
src/Web/WebMVC/Controllers/CartController.cs View File

@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
@ -8,7 +9,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = "OpenIdConnect")]
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class CartController : Controller
{
private readonly IBasketService _basketSvc;


+ 2
- 1
src/Web/WebMVC/Controllers/OrderController.cs View File

@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = "OpenIdConnect")]
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class OrderController : Controller
{
private IOrderingService _orderSvc;


+ 2
- 1
src/Web/WebMVC/Controllers/OrderManagementController.cs View File

@ -7,10 +7,11 @@ using WebMVC.Services.ModelDTOs;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
namespace WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = "OpenIdConnect")]
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class OrderManagementController : Controller
{
private IOrderingService _orderSvc;


+ 2
- 0
src/Web/WebMVC/Program.cs View File

@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
using System;
using System.Diagnostics;
using System.IO;
namespace Microsoft.eShopOnContainers.WebMVC
@ -15,6 +16,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 1
- 1
src/Web/WebMVC/Services/LocationService.cs View File

@ -23,7 +23,7 @@ namespace WebMVC.Services
_settings = settings;
_logger = logger;
_remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/api/v1/l/locations/";
_remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/l/api/v1/locations/";
}
public async Task CreateOrUpdateUserLocation(LocationDTO location)


+ 1
- 1
src/Web/WebMVC/libman.json View File

@ -37,7 +37,7 @@
},
{
"provider": "unpkg",
"library": "@microsoft/signalr@3.0.1",
"library": "@microsoft/signalr@latest",
"destination": "wwwroot/lib/@microsoft/signalr/",
"files": [
"dist/browser/signalr.js",


+ 55
- 0
src/Web/WebMVC/tye.yaml View File

@ -0,0 +1,55 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: webmvc
project: WebMVC.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: IdentityUrl
value: http://localhost:5105
- name: PurchaseUrl
value: http://localhost:5202
- name: CatalogUrl
value: http://localhost:5101
- name: BasketUrl
value: http://localhost:5103
- name: OrderingUrl
value: http://localhost:5102
- name: MarketingUrl
value: http://localhost:5203
- name: CallBackUrl
value: http://localhost:5100/
- name: LocationsUrl
value: http://localhost:5109/
- name: SignalrHubUrl
value: http://localhost:5202
- name: IdentityUrlHC
value: http://localhost:5105/hc
- name: IsClusterEnv
value: False
- name: UseResilientHttp
value: True
- name: UseLoadTest
value: False
- name: UseCustomizationData
value: False
- name: ActivateCampaignDetailFunction
value: False
- name: HttpClientRetryCount
value: 8
- name: HttpClientExceptionsAllowedBeforeBreaking
value: 7
- name: SessionCookieLifetimeMinutes
value: 60
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
bindings:
- name: http-port-80-binding
port: 5100
protocol: http

+ 2
- 0
src/Web/WebSPA/Program.cs View File

@ -4,6 +4,7 @@ using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Serilog;
using System.Diagnostics;
namespace eShopConContainers.WebSPA
{
@ -11,6 +12,7 @@ namespace eShopConContainers.WebSPA
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
BuildWebHost(args).Run();
}


+ 27
- 21
src/Web/WebSPA/package-lock.json View File

@ -1236,10 +1236,9 @@
"dev": true
},
"node-forge": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz",
"integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==",
"dev": true
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
},
"node-libs-browser": {
"version": "2.2.1",
@ -1863,8 +1862,8 @@
}
},
"yargs-parser": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
"integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
"dev": true,
"requires": {
@ -2943,9 +2942,9 @@
}
},
"yargs-parser": {
"version": "13.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
@ -8541,13 +8540,20 @@
"integrity": "sha512-cZdEF7r4gfRIq7ezX9J0T+kQmJNOub71dWbgAXVHDct80TKP4MCETtZQ31xyv38UwgzkWPYF/Xc0ge55dW9Z9w=="
},
"http-proxy": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz",
"integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==",
"version": "1.18.1",
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
"requires": {
"eventemitter3": "^3.0.0",
"eventemitter3": "^4.0.0",
"follow-redirects": "^1.0.0",
"requires-port": "^1.0.0"
},
"dependencies": {
"eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
}
}
},
"http-proxy-agent": {
@ -10381,8 +10387,8 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
},
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
"requires": {
"encoding": "^0.1.11",
@ -10401,9 +10407,9 @@
}
},
"node-forge": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz",
"integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ=="
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
},
"node-libs-browser": {
"version": "2.2.1",
@ -17255,9 +17261,9 @@
}
},
"yargs-parser": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
"integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
"requires": {
"camelcase": "^4.1.0"
}


+ 31
- 0
src/Web/WebSPA/tye.yaml View File

@ -0,0 +1,31 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: webspa
project: WebSPA.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: IdentityUrl
value: http://localhost:5105
- name: PurchaseUrl
value: http://localhost:5202
- name: MarketingUrl
value: http://localhost:5203
- name: IdentityUrlHC
value: http://localhost:5105/hc
- name: UseCustomizationData
value: True
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
- name: SignalrHubUrl
value: http://localhost:5202
bindings:
- name: http-port-80-binding
port: 5104
protocol: http

+ 2
- 0
src/Web/WebStatus/Program.cs View File

@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration;
using Serilog;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
@ -17,6 +18,7 @@ namespace WebStatus
public static int Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);


+ 71
- 0
src/Web/WebStatus/tye.yaml View File

@ -0,0 +1,71 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: webstatus
project: WebStatus.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: HealthChecksUI__HealthChecks__0__Name
value: WebMVC HTTP Check
- name: HealthChecksUI__HealthChecks__0__Uri
value: http://localhost:5100/hc
- name: HealthChecksUI__HealthChecks__1__Name
value: WebSPA HTTP Check
- name: HealthChecksUI__HealthChecks__1__Uri
value: http://localhost:5104/hc
- name: HealthChecksUI__HealthChecks__2__Name
value: Web Shopping Aggregator GW HTTP Check
- name: HealthChecksUI__HealthChecks__2__Uri
value: http://localhost:5121/hc
- name: HealthChecksUI__HealthChecks__3__Name
value: Mobile Shopping Aggregator HTTP Check
- name: HealthChecksUI__HealthChecks__3__Uri
value: http://localhost:5120/hc
- name: HealthChecksUI__HealthChecks__4__Name
value: Ordering HTTP Check
- name: HealthChecksUI__HealthChecks__4__Uri
value: http://localhost:5102/hc
- name: HealthChecksUI__HealthChecks__5__Name
value: Basket HTTP Check
- name: HealthChecksUI__HealthChecks__5__Uri
value: http://localhost:5103/hc
- name: HealthChecksUI__HealthChecks__6__Name
value: Catalog HTTP Check
- name: HealthChecksUI__HealthChecks__6__Uri
value: http://localhost:5101/hc
- name: HealthChecksUI__HealthChecks__7__Name
value: Identity HTTP Check
- name: HealthChecksUI__HealthChecks__7__Uri
value: http://localhost:5105/hc
- name: HealthChecksUI__HealthChecks__8__Name
value: Marketing HTTP Check
- name: HealthChecksUI__HealthChecks__8__Uri
value: http://localhost:5110/hc
- name: HealthChecksUI__HealthChecks__9__Name
value: Locations HTTP Check
- name: HealthChecksUI__HealthChecks__9__Uri
value: http://localhost:5109/hc
- name: HealthChecksUI__HealthChecks__10__Name
value: Payments HTTP Check
- name: HealthChecksUI__HealthChecks__10__Uri
value: http://localhost:5108/hc
- name: HealthChecksUI__HealthChecks__11__Name
value: Ordering SignalRHub HTTP Check
- name: HealthChecksUI__HealthChecks__11__Uri
value: http://localhost:5112/hc
- name: HealthChecksUI__HealthChecks__12__Name
value: Ordering HTTP Background Check
- name: HealthChecksUI__HealthChecks__12__Uri
value: http://localhost:5111/hc
- name: ApplicationInsights__InstrumentationKey
value:
- name: OrchestratorType
value:
bindings:
- name: http-port-80-binding
port: 5107
protocol: http

+ 2
- 0
src/Web/WebhookClient/Program.cs View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -14,6 +15,7 @@ namespace WebhookClient
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateWebHostBuilder(args).Build().Run();
}


+ 25
- 0
src/Web/WebhookClient/tye.yaml View File

@ -0,0 +1,25 @@
name: eshoponcontainers-servicesandwebapps
services:
- name: webhooks-client
project: WebhookClient.csproj
env:
- name: ASPNETCORE_ENVIRONMENT
value: Development
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: Token
value: 6168DB8D-DC58-4094-AF24-483278923590
- name: IdentityUrl
value: http://localhost:5105
- name: CallBackUrl
value: http://localhost:5114
- name: WebhooksUrl
value: http://localhost:5113
- name: SelfUrl
value: http://localhost:5114/
bindings:
- name: http-port-80-binding
port: 5114
protocol: http

+ 1
- 0
src/eShopOnContainers-ServicesAndWebApps.sln View File

@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.env = .env
Local.testsettings = Local.testsettings
NuGet.config = NuGet.config
tye.yaml = tye.yaml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{91CF7717-08AB-4E65-B10E-0B426F01E2E8}"


+ 151
- 0
src/tye.yaml View File

@ -0,0 +1,151 @@
name: eshoponcontainers-servicesandwebapps
extensions:
- name: zipkin
services:
- name: sqldata
image: mcr.microsoft.com/mssql/server:2017-latest
bindings:
- port: 1433
containerPort: 1433
env:
- name: ACCEPT_EULA
value: Y
- name: SA_PASSWORD
value: Pass@word
- name: nosqldata
image: mongo
bindings:
- port: 27017
containerPort: 27017
- name: basketdata
image: redis:alpine
bindings:
- port: 6379
containerPort: 6379
- name: rabbitmq
image: rabbitmq:3-management-alpine
bindings:
- name: http-binding
port: 15672
containerPort: 15672
- name: amqp-binding
port: 5672
containerPort: 5672
- name: seq
image: datalust/seq:latest
bindings:
- port: 5340
containerPort: 80
env:
- name: ACCEPT_EULA
value: Y
- name: identity-api
include: Services/Identity/Identity.API/tye.yaml
- name: catalog-api
include: Services/Catalog/Catalog.API/tye.yaml
- name: basket-api
include: Services/Basket/Basket.API/tye.yaml
- name: ordering-api
include: Services/Ordering/Ordering.API/tye.yaml
- name: ordering-backgroundtasks
include: Services/Ordering/Ordering.BackgroundTasks/tye.yaml
- name: marketing-api
include: Services/Marketing/Marketing.API/tye.yaml
- name: payment-api
include: Services/Payment/Payment.API/tye.yaml
- name: locations-api
include: Services/Location/Locations.API/tye.yaml
- name: webhooks-api
include: Services/Webhooks/Webhooks.API/tye.yaml
- name: mobileshoppingapigw
image: envoyproxy/envoy:v1.11.1
bindings:
- name: http-port-80-binding
port: 5200
containerPort: 80
- name: http-port-8001-binding
port: 15200
containerPort: 8001
volumes:
- source: ./ApiGateways/Envoy/config/mobileshopping
target: /etc/envoy
- name: mobilemarketingapigw
image: envoyproxy/envoy:v1.11.1
bindings:
- name: http-port-80-binding
port: 5201
containerPort: 80
- name: http-port-8001-binding
port: 15201
containerPort: 8001
volumes:
- source: ./ApiGateways/Envoy/config/mobilemarketing
target: /etc/envoy
- name: webshoppingapigw
image: envoyproxy/envoy:v1.11.1
bindings:
- name: http-port-80-binding
port: 5202
containerPort: 80
- name: http-port-8001-binding
port: 15202
containerPort: 8001
volumes:
- source: ./ApiGateways/Envoy/tye-config/webshopping
target: /etc/envoy
- name: webmarketingapigw
image: envoyproxy/envoy:v1.11.1
bindings:
- name: http-port-80-binding
port: 5203
containerPort: 80
- name: http-port-8001-binding
port: 15203
containerPort: 8001
volumes:
- source: ./ApiGateways/Envoy/tye-config/webmarketing
target: /etc/envoy
- name: mobileshoppingagg
include: ApiGateways/Mobile.Bff.Shopping/aggregator/tye.yaml
- name: webshoppingagg
include: ApiGateways/Web.Bff.Shopping/aggregator/tye.yaml
- name: ordering-signalrhub
include: Services/Ordering/Ordering.SignalrHub/tye.yaml
- name: webstatus
include: Web/WebStatus/tye.yaml
- name: webmvc
include: Web/WebMVC/tye.yaml
- name: webspa
include: Web/WebSPA/tye.yaml
- name: webhooks-client
include: Web/WebhookClient/tye.yaml

Loading…
Cancel
Save