Added SignalR Hub service to k8s
This commit is contained in:
parent
04560ff4eb
commit
25c752c61a
@ -46,6 +46,16 @@ services:
|
||||
- sql.data
|
||||
- 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:
|
||||
image: eshop/marketing.api-win:${TAG:-latest}
|
||||
build:
|
||||
|
@ -54,5 +54,10 @@ services:
|
||||
|
||||
locations.api:
|
||||
environment:
|
||||
- EventBusUserName=admin
|
||||
- EventBusPassword=password
|
||||
|
||||
ordering.signalrhub:
|
||||
environment:
|
||||
- EventBusUserName=admin
|
||||
- EventBusPassword=password
|
@ -311,7 +311,6 @@ services:
|
||||
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
|
||||
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
||||
- 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:
|
||||
- "5112:80"
|
||||
|
||||
|
@ -153,7 +153,7 @@ services:
|
||||
- sql.data
|
||||
- rabbitmq
|
||||
ordering.signalrhub:
|
||||
image: eshop/orderingsignalrhub:${TAG:-latest}
|
||||
image: eshop/ordering.signalrhub:${TAG:-latest}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/Services/Ordering/Ordering.SignalrHub/Dockerfile
|
||||
|
@ -65,7 +65,7 @@ if ($buildImages) {
|
||||
docker-compose -p .. -f ../docker-compose.yml build
|
||||
|
||||
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) {
|
||||
$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/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$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/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/apigwwm'
|
||||
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
|
||||
|
||||
|
@ -51,13 +51,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -109,13 +103,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -204,13 +192,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -277,13 +259,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -348,6 +324,57 @@ spec:
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
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:
|
||||
name: locations
|
||||
spec:
|
||||
@ -409,13 +436,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -492,13 +513,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -540,13 +555,7 @@ spec:
|
||||
value: 'K8S'
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -642,16 +651,15 @@ spec:
|
||||
name: externalcfg
|
||||
key: all__EnableLoadTest
|
||||
- name: OrchestratorType
|
||||
value: 'K8S'
|
||||
value: 'K8S'
|
||||
- name: SignalrHubUrl
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: urls
|
||||
key: webshoppingapigw_e
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
@ -814,15 +822,14 @@ spec:
|
||||
key: all__InstrumentationKey
|
||||
- name: OrchestratorType
|
||||
value: 'K8S'
|
||||
- name: SignalrHubUrl
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: urls
|
||||
key: webshoppingapigw_e
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /hc
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 300
|
||||
periodSeconds: 240
|
||||
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
|
@ -71,6 +71,18 @@
|
||||
],
|
||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "ordering-signalrhub",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/hub/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
|
@ -59,14 +59,28 @@ kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: eshop
|
||||
component: orderingbackground
|
||||
name: orderingbackground
|
||||
component: ordering-background
|
||||
name: ordering-background
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
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
|
||||
kind: Service
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
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);
|
||||
|
||||
orderToUpdate.SetPaidStatus();
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
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);
|
||||
|
||||
orderToUpdate.SetStockConfirmedStatus();
|
||||
|
@ -14,6 +14,7 @@
|
||||
<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.Core" Version="1.0.0-preview2-final" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Redis" Version="1.0.0-preview2-final" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -15,6 +15,7 @@ using Ordering.SignalrHub.IntegrationEvents;
|
||||
using Ordering.SignalrHub.IntegrationEvents.EventHandling;
|
||||
using Ordering.SignalrHub.IntegrationEvents.Events;
|
||||
using RabbitMQ.Client;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
|
||||
@ -40,7 +41,23 @@ namespace Ordering.SignalrHub
|
||||
.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"))
|
||||
{
|
||||
|
@ -1,13 +1,11 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
||||
using Moq;
|
||||
using Ordering.API.Application.Commands;
|
||||
using Ordering.API.Infrastructure.Hubs;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
Loading…
x
Reference in New Issue
Block a user