Added SignalR Hub service to k8s
This commit is contained in:
parent
04560ff4eb
commit
25c752c61a
@ -46,6 +46,16 @@ services:
|
|||||||
- sql.data
|
- sql.data
|
||||||
- rabbitmq
|
- rabbitmq
|
||||||
|
|
||||||
|
ordering.signalrhub:
|
||||||
|
image: eshop/ordering.signalrhub:${TAG:-latest}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: src/Services/Ordering/Ordering.SignalrHub/Dockerfile
|
||||||
|
depends_on:
|
||||||
|
- sql.data
|
||||||
|
- identity.api
|
||||||
|
- rabbitmq
|
||||||
|
|
||||||
marketing.api:
|
marketing.api:
|
||||||
image: eshop/marketing.api-win:${TAG:-latest}
|
image: eshop/marketing.api-win:${TAG:-latest}
|
||||||
build:
|
build:
|
||||||
|
@ -56,3 +56,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- EventBusUserName=admin
|
- EventBusUserName=admin
|
||||||
- EventBusPassword=password
|
- EventBusPassword=password
|
||||||
|
|
||||||
|
ordering.signalrhub:
|
||||||
|
environment:
|
||||||
|
- EventBusUserName=admin
|
||||||
|
- EventBusPassword=password
|
@ -311,7 +311,6 @@ services:
|
|||||||
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
|
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
|
||||||
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
||||||
- IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
|
|
||||||
ports:
|
ports:
|
||||||
- "5112:80"
|
- "5112:80"
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ services:
|
|||||||
- sql.data
|
- sql.data
|
||||||
- rabbitmq
|
- rabbitmq
|
||||||
ordering.signalrhub:
|
ordering.signalrhub:
|
||||||
image: eshop/orderingsignalrhub:${TAG:-latest}
|
image: eshop/ordering.signalrhub:${TAG:-latest}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: src/Services/Ordering/Ordering.SignalrHub/Dockerfile
|
dockerfile: src/Services/Ordering/Ordering.SignalrHub/Dockerfile
|
||||||
|
@ -65,7 +65,7 @@ if ($buildImages) {
|
|||||||
docker-compose -p .. -f ../docker-compose.yml build
|
docker-compose -p .. -f ../docker-compose.yml build
|
||||||
|
|
||||||
Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow
|
Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow
|
||||||
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "ordering.backgroundtasks", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "ocelotapigw", "mobileshoppingagg", "webshoppingagg")
|
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "ordering.backgroundtasks", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "ocelotapigw", "mobileshoppingagg", "webshoppingagg", "ordering.signalrhub")
|
||||||
|
|
||||||
foreach ($service in $services) {
|
foreach ($service in $services) {
|
||||||
$imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"}
|
$imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"}
|
||||||
@ -168,6 +168,7 @@ ExecKube -cmd 'set image deployments/payment payment=${registryPath}${dockerOrg}
|
|||||||
ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag'
|
ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag'
|
||||||
ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag'
|
ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag'
|
||||||
ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag'
|
ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag'
|
||||||
|
ExecKube -cmd 'set image deployments/ordering-signalrhub ordering-signalrhub=${registryPath}${dockerOrg}/ordering.signalrhub:$imageTag'
|
||||||
|
|
||||||
ExecKube -cmd 'set image deployments/mobileshoppingagg mobileshoppingagg=${registryPath}${dockerOrg}/mobileshoppingagg:$imageTag'
|
ExecKube -cmd 'set image deployments/mobileshoppingagg mobileshoppingagg=${registryPath}${dockerOrg}/mobileshoppingagg:$imageTag'
|
||||||
ExecKube -cmd 'set image deployments/webshoppingagg webshoppingagg=${registryPath}${dockerOrg}/webshoppingagg:$imageTag'
|
ExecKube -cmd 'set image deployments/webshoppingagg webshoppingagg=${registryPath}${dockerOrg}/webshoppingagg:$imageTag'
|
||||||
@ -195,6 +196,7 @@ ExecKube -cmd 'rollout resume deployments/apigwmm'
|
|||||||
ExecKube -cmd 'rollout resume deployments/apigwms'
|
ExecKube -cmd 'rollout resume deployments/apigwms'
|
||||||
ExecKube -cmd 'rollout resume deployments/apigwwm'
|
ExecKube -cmd 'rollout resume deployments/apigwwm'
|
||||||
ExecKube -cmd 'rollout resume deployments/apigwws'
|
ExecKube -cmd 'rollout resume deployments/apigwws'
|
||||||
|
ExecKube -cmd 'rollout resume deployments/ordering-signalrhub'
|
||||||
|
|
||||||
Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow
|
Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow
|
||||||
|
|
||||||
|
@ -51,13 +51,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -109,13 +103,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -204,13 +192,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -277,13 +259,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -348,6 +324,57 @@ spec:
|
|||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: ordering-signalrhub
|
||||||
|
spec:
|
||||||
|
paused: true
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: eshop
|
||||||
|
component: ordering-signalrhub
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ordering-signalrhub
|
||||||
|
image: eshop/ordering.signalrhub
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: EventBusConnection
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: externalcfg
|
||||||
|
key: all__EventBusConnection
|
||||||
|
- name: IdentityUrl
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: urls
|
||||||
|
key: identity_e
|
||||||
|
- name: AzureServiceBusEnabled
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: externalcfg
|
||||||
|
key: all__UseAzureServiceBus
|
||||||
|
- name: ApplicationInsights__InstrumentationKey
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: externalcfg
|
||||||
|
key: all__InstrumentationKey
|
||||||
|
- name: OrchestratorType
|
||||||
|
value: 'K8S'
|
||||||
|
- name: IsClusterEnv
|
||||||
|
value: 'True'
|
||||||
|
- name: SignalrStoreConnectionString
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: externalcfg
|
||||||
|
key: keystore
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: registry-key
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: locations
|
name: locations
|
||||||
spec:
|
spec:
|
||||||
@ -409,13 +436,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -492,13 +513,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -540,13 +555,7 @@ spec:
|
|||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -643,15 +652,14 @@ spec:
|
|||||||
key: all__EnableLoadTest
|
key: all__EnableLoadTest
|
||||||
- name: OrchestratorType
|
- name: OrchestratorType
|
||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
|
- name: SignalrHubUrl
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: urls
|
||||||
|
key: webshoppingapigw_e
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
@ -814,15 +822,14 @@ spec:
|
|||||||
key: all__InstrumentationKey
|
key: all__InstrumentationKey
|
||||||
- name: OrchestratorType
|
- name: OrchestratorType
|
||||||
value: 'K8S'
|
value: 'K8S'
|
||||||
|
- name: SignalrHubUrl
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: urls
|
||||||
|
key: webshoppingapigw_e
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /hc
|
|
||||||
port: 80
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 300
|
|
||||||
periodSeconds: 240
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: registry-key
|
- name: registry-key
|
||||||
---
|
---
|
||||||
|
@ -71,6 +71,18 @@
|
|||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||||
"UpstreamHttpMethod": []
|
"UpstreamHttpMethod": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "ordering-signalrhub",
|
||||||
|
"Port": 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/hub/{everything}",
|
||||||
|
"UpstreamHttpMethod": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"DownstreamPathTemplate": "/{everything}",
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
@ -59,14 +59,28 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: eshop
|
app: eshop
|
||||||
component: orderingbackground
|
component: ordering-background
|
||||||
name: orderingbackground
|
name: ordering-background
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 80
|
- port: 80
|
||||||
selector:
|
selector:
|
||||||
app: eshop
|
app: eshop
|
||||||
component: orderingbackground
|
component: ordering-background
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: eshop
|
||||||
|
component: ordering-signalrhub
|
||||||
|
name: ordering-signalrhub
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
selector:
|
||||||
|
app: eshop
|
||||||
|
component: ordering-signalrhub
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
public async Task Handle(OrderPaymentSuccededIntegrationEvent @event)
|
public async Task Handle(OrderPaymentSuccededIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
|
// Simulate a work time for validating the payment
|
||||||
|
await Task.Delay(10000);
|
||||||
|
|
||||||
var orderToUpdate = await _orderRepository.GetAsync(@event.OrderId);
|
var orderToUpdate = await _orderRepository.GetAsync(@event.OrderId);
|
||||||
|
|
||||||
orderToUpdate.SetPaidStatus();
|
orderToUpdate.SetPaidStatus();
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
public async Task Handle(OrderStockConfirmedIntegrationEvent @event)
|
public async Task Handle(OrderStockConfirmedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
|
// Simulate a work time for confirming the stock
|
||||||
|
await Task.Delay(10000);
|
||||||
|
|
||||||
var orderToUpdate = await _orderRepository.GetAsync(@event.OrderId);
|
var orderToUpdate = await _orderRepository.GetAsync(@event.OrderId);
|
||||||
|
|
||||||
orderToUpdate.SetStockConfirmedStatus();
|
orderToUpdate.SetStockConfirmedStatus();
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview2-final" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview2-final" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.0.0-preview2-final" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.0.0-preview2-final" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Redis" Version="1.0.0-preview2-final" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -15,6 +15,7 @@ using Ordering.SignalrHub.IntegrationEvents;
|
|||||||
using Ordering.SignalrHub.IntegrationEvents.EventHandling;
|
using Ordering.SignalrHub.IntegrationEvents.EventHandling;
|
||||||
using Ordering.SignalrHub.IntegrationEvents.Events;
|
using Ordering.SignalrHub.IntegrationEvents.Events;
|
||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
|
using StackExchange.Redis;
|
||||||
using System;
|
using System;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
|
||||||
@ -40,7 +41,23 @@ namespace Ordering.SignalrHub
|
|||||||
.AllowCredentials());
|
.AllowCredentials());
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSignalR();
|
if (Configuration.GetValue<string>("IsClusterEnv") == bool.TrueString)
|
||||||
|
{
|
||||||
|
services
|
||||||
|
.AddSignalR()
|
||||||
|
.AddRedis(Configuration["SignalrStoreConnectionString"]);
|
||||||
|
|
||||||
|
//services
|
||||||
|
// .AddSignalR()
|
||||||
|
// .AddRedis(options => options.Factory = writer =>
|
||||||
|
// {
|
||||||
|
// return ConnectionMultiplexer.Connect(Configuration["SignalrStoreConnectionString"], writer);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
services.AddSignalR();
|
||||||
|
}
|
||||||
|
|
||||||
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
|
using Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Ordering.API.Application.Commands;
|
using Ordering.API.Application.Commands;
|
||||||
using Ordering.API.Infrastructure.Hubs;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user