Browse Source

Merge branch 'dev' into feature/GPS-location-xamarin

pull/223/merge
Christian Arenas 7 years ago
parent
commit
2fe1935e95
18 changed files with 496 additions and 84 deletions
  1. +1
    -0
      .gitignore
  2. +11
    -0
      cli-windows/build-images.ps1
  3. +8
    -8
      docker-compose-windows.yml
  4. +1
    -1
      docker-compose.ci.build.yml
  5. +1
    -1
      docker-compose.override.yml
  6. +1
    -1
      docker-compose.prod.yml
  7. +1
    -1
      docker-compose.vs.debug.yml
  8. +1
    -1
      docker-compose.vs.release.yml
  9. +12
    -13
      docker-compose.yml
  10. +5
    -0
      global.json
  11. +116
    -45
      k8s/deploy.ps1
  12. +188
    -11
      k8s/deployments.yaml
  13. +31
    -0
      k8s/local.json
  14. +18
    -0
      k8s/nginx.conf
  15. +30
    -0
      k8s/nosql-data.yaml
  16. +43
    -1
      k8s/services.yaml
  17. +28
    -0
      src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs
  18. +0
    -1
      src/Web/WebMVC/wwwroot/css/site.min.css

+ 1
- 0
.gitignore View File

@ -259,3 +259,4 @@ pub/
#Ignore marker-file used to know which docker files we have.
.eshopdocker_*
/src/Web/WebMVC/wwwroot/lib
/src/Web/WebMVC/wwwroot/css/site.min.css

+ 11
- 0
cli-windows/build-images.ps1 View File

@ -0,0 +1,11 @@
Param([string] $imageTag)
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
if ([string]::IsNullOrEmpty($imageTag)) {
$imageTag = $(git rev-parse --abbrev-ref HEAD)
}
Write-Host "Building images with tag $imageTag" -ForegroundColor Yellow
$env:TAG=$imageTag
docker-compose -f "$scriptPath\..\docker-compose.yml" build

+ 8
- 8
docker-compose-windows.yml View File

@ -2,7 +2,7 @@ version: '2.1'
services:
basket.api:
image: eshop/basket.api-win
image: eshop/basket.api-win:${TAG:-latest}
build:
context: ./src/Services/Basket/Basket.API
dockerfile: Dockerfile.nanowin
@ -11,7 +11,7 @@ services:
- identity.api
catalog.api:
image: eshop/catalog.api-win
image: eshop/catalog.api-win:${TAG:-latest}
build:
context: ./src/Services/Catalog/Catalog.API
dockerfile: Dockerfile.nanowin
@ -19,7 +19,7 @@ services:
- sql.data
identity.api:
image: eshop/identity.api-win
image: eshop/identity.api-win:${TAG:-latest}
build:
context: ./src/Services/Identity/Identity.API
dockerfile: Dockerfile.nanowin
@ -27,7 +27,7 @@ services:
- sql.data
ordering.api:
image: eshop/ordering.api-win
image: eshop/ordering.api-win:${TAG:-latest}
build:
context: ./src/Services/Ordering/Ordering.API
dockerfile: Dockerfile.nanowin
@ -35,7 +35,7 @@ services:
- sql.data
webspa:
image: eshop/webspa-win
image: eshop/webspa-win:${TAG:-latest}
build:
context: ./src/Web/WebSPA
dockerfile: Dockerfile.nanowin
@ -44,7 +44,7 @@ services:
- basket.api
webmvc:
image: eshop/webmvc-win
image: eshop/webmvc-win:${TAG:-latest}
build:
context: ./src/Web/WebMVC
dockerfile: Dockerfile.nanowin
@ -55,7 +55,7 @@ services:
- basket.api
locations.api:
image: locations.api
image: eshop/locations.api:${TAG:-latest}
build:
context: ./src/Services/Location/Locations.API
dockerfile: Dockerfile
@ -64,7 +64,7 @@ services:
- rabbitmq
marketing.api:
image: eshop/marketing.api
image: eshop/marketing.api:${TAG:-latest}
build:
context: ./src/Services/Marketing/Marketing.API
dockerfile: Dockerfile


+ 1
- 1
docker-compose.ci.build.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '3'
services:
ci-build:


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

@ -1,4 +1,4 @@
version: '2'
version: '3'
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine.
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:


+ 1
- 1
docker-compose.prod.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '3'
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:


+ 1
- 1
docker-compose.vs.debug.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '3'
services:
basket.api:


+ 1
- 1
docker-compose.vs.release.yml View File

@ -1,4 +1,4 @@
version: '2'
version: '3'
services:
basket.api:


+ 12
- 13
docker-compose.yml View File

@ -1,9 +1,8 @@
version: '2'
version: '3'
services:
graceperiodmanager:
image: eshop/graceperiodmanager
image: eshop/graceperiodmanager:${TAG:-latest}
build:
context: ./src/Services/GracePeriod/GracePeriodManager
dockerfile: Dockerfile
@ -12,7 +11,7 @@ services:
- rabbitmq
basket.api:
image: eshop/basket.api
image: eshop/basket.api:${TAG:-latest}
build:
context: ./src/Services/Basket/Basket.API
dockerfile: Dockerfile
@ -21,7 +20,7 @@ services:
- identity.api
catalog.api:
image: eshop/catalog.api
image: eshop/catalog.api:${TAG:-latest}
build:
context: ./src/Services/Catalog/Catalog.API
dockerfile: Dockerfile
@ -30,7 +29,7 @@ services:
- rabbitmq
identity.api:
image: eshop/identity.api
image: eshop/identity.api:${TAG:-latest}
build:
context: ./src/Services/Identity/Identity.API
dockerfile: Dockerfile
@ -38,7 +37,7 @@ services:
- sql.data
ordering.api:
image: eshop/ordering.api
image: eshop/ordering.api:${TAG:-latest}
build:
context: ./src/Services/Ordering/Ordering.API
dockerfile: Dockerfile
@ -47,7 +46,7 @@ services:
- rabbitmq
marketing.api:
image: eshop/marketing.api
image: eshop/marketing.api:${TAG:-latest}
build:
context: ./src/Services/Marketing/Marketing.API
dockerfile: Dockerfile
@ -58,7 +57,7 @@ services:
- rabbitmq
webspa:
image: eshop/webspa
image: eshop/webspa:${TAG:-latest}
build:
context: ./src/Web/WebSPA
dockerfile: Dockerfile
@ -67,7 +66,7 @@ services:
- basket.api
webmvc:
image: eshop/webmvc
image: eshop/webmvc:${TAG:-latest}
build:
context: ./src/Web/WebMVC
dockerfile: Dockerfile
@ -95,13 +94,13 @@ services:
- "5672:5672"
webstatus:
image: eshop/webstatus
image: eshop/webstatus:${TAG:-latest}
build:
context: ./src/Web/WebStatus
dockerfile: Dockerfile
payment.api:
image: eshop/payment.api
image: eshop/payment.api:${TAG:-latest}
build:
context: ./src/Services/Payment/Payment.API
dockerfile: Dockerfile
@ -109,7 +108,7 @@ services:
- rabbitmq
locations.api:
image: eshop/locations.api
image: eshop/locations.api:${TAG:-latest}
build:
context: ./src/Services/Location/Locations.API
dockerfile: Dockerfile


+ 5
- 0
global.json View File

@ -0,0 +1,5 @@
{
"sdk": {
"version":"1.0.4"
}
}

+ 116
- 45
k8s/deploy.ps1 View File

@ -2,10 +2,14 @@ Param(
[parameter(Mandatory=$false)][string]$registry,
[parameter(Mandatory=$false)][string]$dockerUser,
[parameter(Mandatory=$false)][string]$dockerPassword,
[parameter(Mandatory=$false)][bool]$deployCI,
[parameter(Mandatory=$false)][bool]$useDockerHub,
[parameter(Mandatory=$false)][string]$execPath,
[parameter(Mandatory=$false)][string]$kubeconfigPath
[parameter(Mandatory=$false)][string]$kubeconfigPath,
[parameter(Mandatory=$true)][string]$configFile,
[parameter(Mandatory=$false)][string]$imageTag,
[parameter(Mandatory=$false)][string]$externalDns,
[parameter(Mandatory=$false)][bool]$deployCI=$false,
[parameter(Mandatory=$false)][bool]$buildImages=$false,
[parameter(Mandatory=$false)][bool]$deployInfrastructure=$true
)
function ExecKube($cmd) {
@ -20,7 +24,11 @@ function ExecKube($cmd) {
}
}
# Not used when deploying through CI VSTS
# Initialization
$debugMode = $PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent
$useDockerHub = [string]::IsNullOrEmpty($registry)
# Check required commands (only if not in CI environment)
if(-not $deployCI) {
$requiredCommands = ("docker", "docker-compose", "kubectl")
foreach ($command in $requiredCommands) {
@ -30,6 +38,45 @@ if(-not $deployCI) {
}
}
}
else {
$buildImages = false; # Never build images through CI, as they previously built
}
# Get tag to use from current branch if no tag is passed
if ([string]::IsNullOrEmpty($imageTag)) {
$imageTag = $(git rev-parse --abbrev-ref HEAD)
}
Write-Host "Docker image Tag: $imageTag" -ForegroundColor Yellow
# Read config to use
$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json
if ($debugMode) {
Write-Host "[DEBUG]: Using following JSON config: " -ForegroundColor Yellow
$json = ConvertTo-Json $config -Depth 5
Write-Host $json
if (-not $deployCI) {
Write-Host "[DEBUG]: Press a key " -ForegroundColor Yellow
[System.Console]::Read()
}
}
# building and publishing docker images if needed
if($buildImages) {
Write-Host "Building and publishing eShopOnContainers..." -ForegroundColor Yellow
dotnet restore ../eShopOnContainers-ServicesAndWebApps.sln
dotnet publish -c Release -o obj/Docker/publish ../eShopOnContainers-ServicesAndWebApps.sln
Write-Host "Building Docker images tagged with '$imageTag'" -ForegroundColor Yellow
$env:TAG=$imageTag
docker-compose -p .. -f ../docker-compose.yml build
Write-Host "Pushing images to $registry..." -ForegroundColor Yellow
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus")
foreach ($service in $services) {
docker tag eshop/${service}:$imageTag $registry/eshop/${service}:$imageTag
docker push $registry/eshop/${service}:$imageTag
}
}
# Use ACR instead of DockerHub as image repository
if(-not $useDockerHub) {
@ -54,38 +101,34 @@ ExecKube -cmd 'delete deployments --all'
ExecKube -cmd 'delete services --all'
ExecKube -cmd 'delete configmap config-files'
ExecKube -cmd 'delete configmap urls'
ExecKube -cmd 'delete configmap externalcfg'
# start sql, rabbitmq, frontend deploymentsExecKube -cmd 'delete configmap config-files'
ExecKube -cmd 'create configmap config-files --from-file=nginx-conf=nginx.conf'
ExecKube -cmd 'label configmap config-files app=eshop'
ExecKube -cmd 'create -f sql-data.yaml -f basket-data.yaml -f keystore-data.yaml -f rabbitmq.yaml -f services.yaml -f frontend.yaml'
# building and publishing docker images not necessary when deploying through CI VSTS
if(-not $deployCI) {
Write-Host "Building and publishing eShopOnContainers..." -ForegroundColor Yellow
dotnet restore ../eShopOnContainers-ServicesAndWebApps.sln
dotnet publish -c Release -o obj/Docker/publish ../eShopOnContainers-ServicesAndWebApps.sln
Write-Host "Building Docker images..." -ForegroundColor Yellow
docker-compose -p .. -f ../docker-compose.yml build
Write-Host "Pushing images to $registry..." -ForegroundColor Yellow
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "webmvc", "webspa", "webstatus")
foreach ($service in $services) {
docker tag eshop/$service $registry/eshop/$service
docker push $registry/eshop/$service
}
if ($deployInfrastructure) {
Write-Host 'Deploying infrastructure deployments (databases, redis, ...)' -ForegroundColor Yellow
ExecKube -cmd 'create -f sql-data.yaml -f basket-data.yaml -f keystore-data.yaml -f rabbitmq.yaml -f nosql-data.yaml'
}
Write-Host "Waiting for frontend's external ip..." -ForegroundColor Yellow
while ($true) {
$frontendUrl = & ExecKube -cmd 'get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}"'
if ([bool]($frontendUrl -as [ipaddress])) {
break
}
Start-Sleep -s 15
Write-Host 'Deploying code deployments (databases, redis, ...)' -ForegroundColor Yellow
ExecKube -cmd 'create -f services.yaml -f frontend.yaml'
if ([string]::IsNullOrEmpty($externalDns)) {
Write-Host "Waiting for frontend's external ip..." -ForegroundColor Yellow
while ($true) {
$frontendUrl = & ExecKube -cmd 'get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}"'
if ([bool]($frontendUrl -as [ipaddress])) {
break
}
Start-Sleep -s 15
}
$externalDns = $frontendUrl
}
Write-Host "Using $externalDns as the external DNS/IP of the k8s cluster"
ExecKube -cmd 'create configmap urls `
--from-literal=BasketUrl=http://basket `
--from-literal=BasketHealthCheckUrl=http://basket/hc `
@ -101,37 +144,65 @@ ExecKube -cmd 'create configmap urls `
--from-literal=MvcClientCatalogUrl=http://catalog `
--from-literal=MvcClientBasketUrl=http://basket `
--from-literal=WebSpaHealthCheckUrl=http://webspa/hc `
--from-literal=SpaClientOrderingExternalUrl=http://$($frontendUrl)/ordering-api `
--from-literal=SpaClientCatalogExternalUrl=http://$($frontendUrl)/catalog-api `
--from-literal=SpaClientBasketExternalUrl=http://$($frontendUrl)/basket-api `
--from-literal=SpaClientIdentityExternalUrl=http://$($frontendUrl)/identity `
--from-literal=SpaClientExternalUrl=http://$($frontendUrl)'
--from-literal=SpaClientOrderingExternalUrl=http://$($externalDns)/ordering-api `
--from-literal=SpaClientCatalogExternalUrl=http://$($externalDns)/catalog-api `
--from-literal=SpaClientBasketExternalUrl=http://$($externalDns)/basket-api `
--from-literal=SpaClientIdentityExternalUrl=http://$($externalDns)/identity `
--from-literal=SpaClientExternalUrl=http://$($externalDns)'
ExecKube -cmd 'label configmap urls app=eshop'
Write-Host "Creating deployments..." -ForegroundColor Yellow
Write-Host "Applying external configuration from json" -ForegroundColor Yellow
ExecKube -cmd 'create configmap externalcfg `
--from-literal=CatalogSqlDb=$($config.sql.catalog) `
--from-literal=IdentitySqlDb=$($config.sql.identity) `
--from-literal=OrderingSqlDb=$($config.sql.ordering) `
--from-literal=MarketingSqlDb=$($config.sql.marketing) `
--from-literal=LocationsNoSqlDb=$($config.nosql.locations.constr) `
--from-literal=LocationsNoSqlDbName=$($config.nosql.locations.db) `
--from-literal=MarketingNoSqlDb=$($config.nosql.marketing.constr) `
--from-literal=MarketingNoSqlDbName=$($config.nosql.marketing.db) `
--from-literal=BasketRedisConStr=$($config.redis.basket) `
--from-literal=LocationsBus=$($config.servicebus.locations) `
--from-literal=MarketingBus=$($config.servicebus.marketing) `
--from-literal=BasketBus=$($config.servicebus.basket) `
--from-literal=OrderingBus=$($config.servicebus.ordering) `
--from-literal=CatalogBus=$($config.servicebus.catalog) `
--from-literal=PaymentBus=$($config.servicebus.payment) `
--from-literal=UseAzureServiceBus=$($config.servicebus.use_azure) `
--from-literal=keystore=$($config.redis.keystore) '
ExecKube -cmd 'label configmap externalcfg app=eshop'
Write-Host "Creating deployments..." -ForegroundColor Yellow
ExecKube -cmd 'create -f deployments.yaml'
# not using ACR for pulling images when deploying through CI VSTS
if(-not $deployCI) {
# update deployments with the private registry before k8s tries to pull images
# (deployment templating, or Helm, would obviate this)
Write-Host "Update Image containers..." -ForegroundColor Yellow
ExecKube -cmd 'set image deployments/basket basket=$registry/eshop/basket.api'
ExecKube -cmd 'set image deployments/catalog catalog=$registry/eshop/catalog.api'
ExecKube -cmd 'set image deployments/identity identity=$registry/eshop/identity.api'
ExecKube -cmd 'set image deployments/ordering ordering=$registry/eshop/ordering.api'
ExecKube -cmd 'set image deployments/webmvc webmvc=$registry/eshop/webmvc'
ExecKube -cmd 'set image deployments/webstatus webstatus=$registry/eshop/webstatus'
ExecKube -cmd 'set image deployments/webspa webspa=$registry/eshop/webspa'
# update deployments with the correct image (with tag and/or registry)
Write-Host "Update Image containers to use prefix '$registry' and tag '$imageTag'" -ForegroundColor Yellow
$registryPath = ""
if (-not [string]::IsNullOrEmpty($registry)) {
$registryPath = "$registry/"
}
ExecKube -cmd 'set image deployments/basket basket=${registryPath}eshop/basket.api:$imageTag'
ExecKube -cmd 'set image deployments/catalog catalog=${registryPath}eshop/catalog.api:$imageTag'
ExecKube -cmd 'set image deployments/identity identity=${registryPath}eshop/identity.api:$imageTag'
ExecKube -cmd 'set image deployments/ordering ordering=${registryPath}eshop/ordering.api:$imageTag'
ExecKube -cmd 'set image deployments/marketing marketing=${registryPath}eshop/marketing.api:$imageTag'
ExecKube -cmd 'set image deployments/locations locations=${registryPath}eshop/locations.api:$imageTag'
ExecKube -cmd 'set image deployments/payment payment=${registryPath}eshop/payment.api:$imageTag'
ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}eshop/webmvc:$imageTag'
ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}eshop/webstatus:$imageTag'
ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}eshop/webspa:$imageTag'
Write-Host "Execute rollout..." -ForegroundColor Yellow
ExecKube -cmd 'rollout resume deployments/basket'
ExecKube -cmd 'rollout resume deployments/catalog'
ExecKube -cmd 'rollout resume deployments/identity'
ExecKube -cmd 'rollout resume deployments/ordering'
ExecKube -cmd 'rollout resume deployments/marketing'
ExecKube -cmd 'rollout resume deployments/locations'
ExecKube -cmd 'rollout resume deployments/payment'
ExecKube -cmd 'rollout resume deployments/webmvc'
ExecKube -cmd 'rollout resume deployments/webstatus'
ExecKube -cmd 'rollout resume deployments/webspa'


+ 188
- 11
k8s/deployments.yaml View File

@ -18,9 +18,20 @@ spec:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/basket-api
- name: ConnectionString
value: basket-data
valueFrom:
configMapKeyRef:
name: externalcfg
key: BasketRedisConStr
- name: EventBusConnection
value: rabbitmq
valueFrom:
configMapKeyRef:
name: externalcfg
key: BasketBus
- name: AzureServiceBusEnabled
valueFrom:
configMapKeyRef:
name: externalcfg
key: UseAzureServiceBus
- name: IdentityUrl
valueFrom:
configMapKeyRef:
@ -51,14 +62,20 @@ spec:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/catalog-api
- name: ConnectionString
value: "Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word"
- name: EventBusConnection
value: rabbitmq
valueFrom:
configMapKeyRef:
name: externalcfg
key: CatalogSqlDb
- name: ExternalCatalogBaseUrl
valueFrom:
configMapKeyRef:
name: urls
key: CatalogUrl
- name: EventBusConnection
valueFrom:
configMapKeyRef:
name: externalcfg
key: CatalogBus
ports:
- containerPort: 80
imagePullSecrets:
@ -84,9 +101,15 @@ spec:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/identity
- name: ConnectionStrings__DefaultConnection
value: "Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word"
valueFrom:
configMapKeyRef:
name: externalcfg
key: IdentitySqlDb
- name: DPConnectionString
value: keystore-data
valueFrom:
configMapKeyRef:
name: externalcfg
key: keystore
- name: IsClusterEnv
value: 'True'
- name: MvcClient
@ -124,9 +147,69 @@ spec:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/ordering-api
- name: ConnectionString
value: "Server=sql-data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"
valueFrom:
configMapKeyRef:
name: externalcfg
key: OrderingSqlDb
- name: EventBusConnection
valueFrom:
configMapKeyRef:
name: externalcfg
key: OrderingBus
- name: AzureServiceBusEnabled
valueFrom:
configMapKeyRef:
name: externalcfg
key: UseAzureServiceBus
- name: IdentityUrl
valueFrom:
configMapKeyRef:
name: urls
key: IdentityUrl
ports:
- containerPort: 80
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: locations
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: locations
spec:
containers:
- name: locations
image: eshop/locations.api
imagePullPolicy: Always
env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/locations-api
- name: ConnectionString
valueFrom:
configMapKeyRef:
name: externalcfg
key: LocationsNoSqlDb
- name: Database
valueFrom:
configMapKeyRef:
name: externalcfg
key: LocationsNoSqlDbName
- name: AzureServiceBusEnabled
valueFrom:
configMapKeyRef:
name: externalcfg
key: UseAzureServiceBus
- name: EventBusConnection
value: rabbitmq
valueFrom:
configMapKeyRef:
name: externalcfg
key: LocationsBus
- name: IdentityUrl
valueFrom:
configMapKeyRef:
@ -139,6 +222,94 @@ spec:
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: marketing
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: marketing
spec:
containers:
- name: marketing
image: eshop/marketing.api
imagePullPolicy: Always
env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/marketing-api
- name: ConnectionString
valueFrom:
configMapKeyRef:
name: externalcfg
key: MarketingSqlDb
- name: MongoConnectionString
valueFrom:
configMapKeyRef:
name: externalcfg
key: MarketingNoSqlDb
- name: MongoDatabase
valueFrom:
configMapKeyRef:
name: externalcfg
key: MarketingNoSqlDbName
- name: AzureServiceBusEnabled
valueFrom:
configMapKeyRef:
name: externalcfg
key: UseAzureServiceBus
- name: EventBusConnection
valueFrom:
configMapKeyRef:
name: externalcfg
key: MarketingBus
- name: IdentityUrl
valueFrom:
configMapKeyRef:
name: urls
key: IdentityUrl
ports:
- containerPort: 80
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: payment
spec:
paused: true
template:
metadata:
labels:
app: eshop
component: payment
spec:
containers:
- name: payment
image: eshop/payment.api
imagePullPolicy: Always
env:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/payment-api
- name: AzureServiceBusEnabled
valueFrom:
configMapKeyRef:
name: externalcfg
key: UseAzureServiceBus
- name: EventBusConnection
valueFrom:
configMapKeyRef:
name: externalcfg
key: PaymentBus
ports:
- containerPort: 80
imagePullSecrets:
- name: registry-key
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: webmvc
spec:
@ -157,7 +328,10 @@ spec:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80/webmvc
- name: DPConnectionString
value: keystore-data
valueFrom:
configMapKeyRef:
name: externalcfg
key: keystore
- name: IsClusterEnv
value: 'True'
- name: BasketUrl
@ -264,7 +438,10 @@ spec:
- name: ASPNETCORE_URLS
value: http://0.0.0.0:80
- name: DPConnectionString
value: keystore-data
valueFrom:
configMapKeyRef:
name: externalcfg
key: keystore
- name: IsClusterEnv
value: 'True'
- name: BasketUrl


+ 31
- 0
k8s/local.json View File

@ -0,0 +1,31 @@
{
"sql": {
"catalog": "Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;",
"identity":"Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word;",
"ordering":"Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;",
"marketing":"Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word;"
},
"nosql": {
"locations": {
"constr": "mongodb://nosql-data",
"db": "LocationsDb"
},
"marketing": {
"constr": "mongodb://nosql-data",
"db": "MarketingDb"
}
},
"redis": {
"basket" : "basket-data",
"keystore": "keystore-data"
},
"servicebus": {
"use_azure": false,
"ordering": "rabbitmq",
"marketing": "rabbitmq",
"locations": "rabbitmq",
"payment": "rabbitmq",
"basket": "rabbitmq",
"catalog": "rabbitmq"
}
}

+ 18
- 0
k8s/nginx.conf View File

@ -71,6 +71,24 @@ http {
proxy_set_header Host $host;
}
location /marketing-api {
proxy_pass http://marketing;
proxy_redirect off;
proxy_set_header Host $host;
}
location /payment-api {
proxy_pass http://payment;
proxy_redirect off;
proxy_set_header Host $host;
}
location /locations-api {
proxy_pass http://locations;
proxy_redirect off;
proxy_set_header Host $host;
}
location / {
proxy_pass http://webspa;
proxy_redirect off;


+ 30
- 0
k8s/nosql-data.yaml View File

@ -0,0 +1,30 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: nosql-data
name: nosql-data
spec:
ports:
- port: 27017
selector:
app: eshop
component: nosql-data
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nosql-data
spec:
template:
metadata:
labels:
app: eshop
component: nosql-data
spec:
containers:
- name: nosql-data
image: mongo
ports:
- containerPort: 27017

+ 43
- 1
k8s/services.yaml View File

@ -56,6 +56,48 @@ spec:
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: locations
name: locations
spec:
ports:
- port: 80
selector:
app: eshop
component: locations
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: payment
name: payment
spec:
ports:
- port: 80
selector:
app: eshop
component: payment
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
component: marketing
name: marketing
spec:
ports:
- port: 80
selector:
app: eshop
component: marketing
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eshop
@ -94,4 +136,4 @@ spec:
- port: 80
selector:
app: eshop
component: webspa
component: webspa

+ 28
- 0
src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs View File

@ -24,6 +24,7 @@
{
await SetIndexes();
await SetUSLocations();
await SetBarcelonaLocations();
}
}
@ -85,6 +86,20 @@
await ctx.Locations.InsertOneAsync(rdm);
}
static async Task SetBarcelonaLocations()
{
var bcn = new Locations()
{
Code = "BCN",
Description = "Barcelona",
LocationId = 5
};
bcn.SetLocation(2.156453, 41.395226);
bcn.SetArea(GetBarcelonaPoligon());
await ctx.Locations.InsertOneAsync(bcn);
}
static async Task SetIndexes()
{
// Set location indexes
@ -145,5 +160,18 @@
new GeoJson2DGeographicCoordinates(-124.68633, 48.8943)
};
}
static List<GeoJson2DGeographicCoordinates> GetBarcelonaPoligon()
{
return new List<GeoJson2DGeographicCoordinates>()
{
new GeoJson2DGeographicCoordinates(2.033879, 41.383858),
new GeoJson2DGeographicCoordinates(2.113741, 41.419068),
new GeoJson2DGeographicCoordinates(2.188778, 41.451153),
new GeoJson2DGeographicCoordinates(2.235266, 41.418033),
new GeoJson2DGeographicCoordinates(2.137101, 41.299536),
new GeoJson2DGeographicCoordinates(2.033879, 41.383858)
};
}
}
}

+ 0
- 1
src/Web/WebMVC/wwwroot/css/site.min.css
File diff suppressed because it is too large
View File


Loading…
Cancel
Save