Configure Envoy to forward SignalR notifications

This commit is contained in:
Miguel Veloso 2019-12-05 17:27:38 +00:00
parent d42be1b857
commit 62db94848d
3 changed files with 79 additions and 34 deletions

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,25 +77,25 @@ 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:
not_health_check_filter: {} not_health_check_filter: {}
config: config:
json_format: json_format:
time: "%START_TIME%" time: "%START_TIME%"
protocol: "%PROTOCOL%" protocol: "%PROTOCOL%"
duration: "%DURATION%" duration: "%DURATION%"
request_method: "%REQ(:METHOD)%" request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%" request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" 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

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_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%" request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" 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

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,25 +77,25 @@ 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:
not_health_check_filter: {} not_health_check_filter: {}
config: config:
json_format: json_format:
time: "%START_TIME%" time: "%START_TIME%"
protocol: "%PROTOCOL%" protocol: "%PROTOCOL%"
duration: "%DURATION%" duration: "%DURATION%"
request_method: "%REQ(:METHOD)%" request_method: "%REQ(:METHOD)%"
request_host: "%REQ(HOST)%" request_host: "%REQ(HOST)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" 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