Browse Source

Fix SignalR + MVC through Envoy

fix/post-release-fixes
Miguel Veloso 5 years ago
parent
commit
f88d8c4ba3
5 changed files with 35 additions and 18 deletions
  1. +25
    -10
      src/ApiGateways/Envoy/config/webshopping/envoy.yaml
  2. +2
    -0
      src/Web/WebMVC/Views/Shared/_Layout.cshtml
  3. +1
    -1
      src/Web/WebMVC/bundleconfig.json
  4. +6
    -6
      src/Web/WebMVC/libman.json
  5. +1
    -1
      src/docker-compose.override.yml

+ 25
- 10
src/ApiGateways/Envoy/config/webshopping/envoy.yaml View File

@ -42,13 +42,20 @@ static_resources:
route: route:
auto_host_rewrite: true auto_host_rewrite: true
prefix_rewrite: "/ordering-api/" prefix_rewrite: "/ordering-api/"
cluster: ordering
cluster: ordering
- name: "o-long" - name: "o-long"
match: match:
prefix: "/ordering-api/" prefix: "/ordering-api/"
route: route:
auto_host_rewrite: true auto_host_rewrite: true
cluster: ordering
cluster: ordering
- name: "h-long"
match:
prefix: "/hub/notificationhub"
route:
auto_host_rewrite: true
cluster: signalr-hub
timeout: 300s
- name: "b-short" - name: "b-short"
match: match:
prefix: "/b/" prefix: "/b/"
@ -61,7 +68,7 @@ static_resources:
prefix: "/basket-api/" prefix: "/basket-api/"
route: route:
auto_host_rewrite: true auto_host_rewrite: true
cluster: basket
cluster: basket
- name: "agg" - name: "agg"
match: match:
prefix: "/" prefix: "/"
@ -70,7 +77,7 @@ static_resources:
prefix_rewrite: "/" prefix_rewrite: "/"
cluster: shoppingagg cluster: shoppingagg
http_filters: http_filters:
- name: envoy.router
- name: envoy.router
access_log: access_log:
- name: envoy.file_access_log - name: envoy.file_access_log
filter: filter:
@ -80,15 +87,15 @@ static_resources:
time: "%START_TIME%" time: "%START_TIME%"
protocol: "%PROTOCOL%" protocol: "%PROTOCOL%"
duration: "%DURATION%" duration: "%DURATION%"
request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
response_flags: "%RESPONSE_FLAGS%" response_flags: "%RESPONSE_FLAGS%"
route_name: "%ROUTE_NAME%" route_name: "%ROUTE_NAME%"
upstream_host: "%UPSTREAM_HOST%" upstream_host: "%UPSTREAM_HOST%"
upstream_cluster: "%UPSTREAM_CLUSTER%" upstream_cluster: "%UPSTREAM_CLUSTER%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
path: "/tmp/access.log"
path: "/tmp/access.log"
clusters: clusters:
- name: shoppingagg - name: shoppingagg
connect_timeout: 0.25s connect_timeout: 0.25s
@ -113,7 +120,7 @@ static_resources:
hosts: hosts:
- socket_address: - socket_address:
address: basket-api address: basket-api
port_value: 80
port_value: 80
- name: ordering - name: ordering
connect_timeout: 0.25s connect_timeout: 0.25s
type: strict_dns type: strict_dns
@ -121,4 +128,12 @@ static_resources:
hosts: hosts:
- socket_address: - socket_address:
address: ordering-api address: ordering-api
port_value: 80
port_value: 80
- name: signalr-hub
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: ordering-signalrhub
port_value: 80

+ 2
- 0
src/Web/WebMVC/Views/Shared/_Layout.cshtml View File

@ -102,10 +102,12 @@
function stablishConnection(cb) { function stablishConnection(cb) {
let connection = new signalR.HubConnectionBuilder() let connection = new signalR.HubConnectionBuilder()
.withUrl('@settings.Value.SignalrHubUrl/hub/notificationhub', { .withUrl('@settings.Value.SignalrHubUrl/hub/notificationhub', {
transport: signalR.HttpTransportType.LongPolling,
accessTokenFactory: () => { accessTokenFactory: () => {
return "Authorization", getToken(); return "Authorization", getToken();
} }
}) })
.withAutomaticReconnect()
.build(); .build();
connection.start().then(function () { connection.start().then(function () {


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

@ -11,7 +11,7 @@
{ {
"outputFileName": "wwwroot/js/site.js", "outputFileName": "wwwroot/js/site.js",
"inputFiles": [ "inputFiles": [
"wwwroot/lib/@aspnet/signalr/dist/browser/signalr.js",
"wwwroot/lib/@microsoft/signalr/dist/browser/signalr.js",
"wwwroot/lib/toastr/toastr.min.js" "wwwroot/lib/toastr/toastr.min.js"
], ],
// Optionally specify minification options // Optionally specify minification options


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

@ -9,6 +9,7 @@
{ {
"provider": "unpkg", "provider": "unpkg",
"library": "bootstrap@4.3.1", "library": "bootstrap@4.3.1",
"destination": "wwwroot/lib/bootstrap/",
"files": [ "files": [
"dist/css/bootstrap.css", "dist/css/bootstrap.css",
"dist/css/bootstrap.css.map", "dist/css/bootstrap.css.map",
@ -16,8 +17,7 @@
"dist/css/bootstrap.min.css.map", "dist/css/bootstrap.min.css.map",
"dist/js/bootstrap.js", "dist/js/bootstrap.js",
"dist/js/bootstrap.min.js" "dist/js/bootstrap.min.js"
],
"destination": "wwwroot/lib/bootstrap/"
]
}, },
{ {
"library": "jquery-validation-unobtrusive@3.2.11", "library": "jquery-validation-unobtrusive@3.2.11",
@ -37,12 +37,12 @@
}, },
{ {
"provider": "unpkg", "provider": "unpkg",
"library": "@aspnet/signalr@1.1.2",
"files": [
"library": "@microsoft/signalr@3.0.1",
"destination": "wwwroot/lib/@microsoft/signalr/",
"files": [
"dist/browser/signalr.js", "dist/browser/signalr.js",
"dist/browser/signalr.min.js" "dist/browser/signalr.min.js"
],
"destination": "wwwroot/lib/@aspnet/signalr/"
]
} }
] ]
} }

+ 1
- 1
src/docker-compose.override.yml View File

@ -360,7 +360,7 @@ services:
- PurchaseUrl=http://webshoppingapigw - PurchaseUrl=http://webshoppingapigw
- IdentityUrl=http://10.0.75.1:5105 - IdentityUrl=http://10.0.75.1:5105
- MarketingUrl=http://webmarketingapigw - MarketingUrl=http://webmarketingapigw
- SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5112
- SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202
- IdentityUrlHC=http://identity-api/hc - IdentityUrlHC=http://identity-api/hc
- UseCustomizationData=True - UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}


Loading…
Cancel
Save