Config files for k8s deployment of all services updated
This commit is contained in:
parent
2ad485015f
commit
5dd1ce24f3
@ -108,7 +108,7 @@ services:
|
||||
- rabbitmq
|
||||
|
||||
locations.api:
|
||||
image: locations.api
|
||||
image: eshop/locations.api
|
||||
build:
|
||||
context: ./src/Services/Location/Locations.API
|
||||
dockerfile: Dockerfile
|
||||
|
5
global.json
Normal file
5
global.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version":"1.0.4"
|
||||
}
|
||||
}
|
@ -5,9 +5,12 @@ Param(
|
||||
[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
|
||||
)
|
||||
|
||||
$debugMode = $PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent
|
||||
|
||||
function ExecKube($cmd) {
|
||||
if($deployCI) {
|
||||
$kubeconfig = $kubeconfigPath + 'config';
|
||||
@ -20,6 +23,19 @@ function ExecKube($cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json
|
||||
|
||||
if ($debugMode) {
|
||||
Write-Host "Using following JSON config: "
|
||||
$json = ConvertTo-Json $config -Depth 5
|
||||
Write-Host $json
|
||||
Write-Host "Press a key "
|
||||
[System.Console]::Read()
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Not used when deploying through CI VSTS
|
||||
if(-not $deployCI) {
|
||||
$requiredCommands = ("docker", "docker-compose", "kubectl")
|
||||
@ -54,11 +70,13 @@ 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'
|
||||
# ExecKube -cmd 'create -f sql-data.yaml -f basket-data.yaml -f keystore-data.yaml -f rabbitmq.yaml -f services.yaml -f frontend.yaml'
|
||||
ExecKube -cmd 'create -f services.yaml -f frontend.yaml'
|
||||
|
||||
# building and publishing docker images not necessary when deploying through CI VSTS
|
||||
if(-not $deployCI) {
|
||||
@ -109,6 +127,27 @@ ExecKube -cmd 'create configmap urls `
|
||||
|
||||
ExecKube -cmd 'label configmap urls app=eshop'
|
||||
|
||||
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=MarketingsNoSqlDb=$($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=PaymentBus=$($config.servicebus.payment) '
|
||||
|
||||
ExecKube -cmd 'label configmap externalcfg app=eshop'
|
||||
|
||||
|
||||
Write-Host "Creating deployments..." -ForegroundColor Yellow
|
||||
|
||||
ExecKube -cmd 'create -f deployments.yaml'
|
||||
|
@ -18,9 +18,17 @@ 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
|
||||
value: "true"
|
||||
- name: IdentityUrl
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
@ -51,9 +59,10 @@ 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:
|
||||
@ -84,7 +93,10 @@ 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
|
||||
- name: IsClusterEnv
|
||||
@ -124,9 +136,17 @@ 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
|
||||
value: rabbitmq
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: externalcfg
|
||||
key: OrderingBus
|
||||
- name: AzureServiceBusEnabled
|
||||
value: "true"
|
||||
- name: IdentityUrl
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
@ -139,6 +159,134 @@ spec:
|
||||
---
|
||||
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
|
||||
value: "true"
|
||||
- name: EventBusConnection
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: externalcfg
|
||||
key: LocationsBus
|
||||
- name: IdentityUrl
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: urls
|
||||
key: IdentityUrl
|
||||
ports:
|
||||
- containerPort: 80
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
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
|
||||
value: "true"
|
||||
- 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
|
||||
value: ·true"
|
||||
- name: EventBusConnection
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: externalcfg
|
||||
key: PaymentBus
|
||||
ports:
|
||||
- containerPort: 80
|
||||
imagePullSecrets:
|
||||
- name: registry-key
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: webmvc
|
||||
spec:
|
||||
|
27
k8s/local.json
Normal file
27
k8s/local.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"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"
|
||||
},
|
||||
"servicebus": {
|
||||
"ordering": "rabbitmq",
|
||||
"marketing": "rabbitmq",
|
||||
"locations": "rabbitmq",
|
||||
"payment": "rabbitmq"
|
||||
}
|
||||
}
|
@ -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 /location-api {
|
||||
proxy_pass http://location;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://webspa;
|
||||
proxy_redirect off;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user