Deploy scripts updated: fixing some bugs

This commit is contained in:
Eduard Tomas 2017-06-16 20:44:11 +02:00
parent 5dd1ce24f3
commit bd3d5072ed
5 changed files with 50 additions and 6 deletions

View File

@ -6,11 +6,11 @@ Param(
[parameter(Mandatory=$false)][bool]$useDockerHub, [parameter(Mandatory=$false)][bool]$useDockerHub,
[parameter(Mandatory=$false)][string]$execPath, [parameter(Mandatory=$false)][string]$execPath,
[parameter(Mandatory=$false)][string]$kubeconfigPath, [parameter(Mandatory=$false)][string]$kubeconfigPath,
[parameter(Mandatory=$true)][string]$configFile [parameter(Mandatory=$true)][string]$configFile,
[parameter(Mandatory=$false)][bool]$deployInfrastructure=$true
) )
$debugMode = $PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent $debugMode = $PSCmdlet.MyInvocation.BoundParameters["Debug"].IsPresent
function ExecKube($cmd) { function ExecKube($cmd) {
if($deployCI) { if($deployCI) {
$kubeconfig = $kubeconfigPath + 'config'; $kubeconfig = $kubeconfigPath + 'config';
@ -75,7 +75,13 @@ ExecKube -cmd 'delete configmap externalcfg'
# start sql, rabbitmq, frontend deploymentsExecKube -cmd 'delete configmap config-files' # start sql, rabbitmq, frontend deploymentsExecKube -cmd 'delete configmap config-files'
ExecKube -cmd 'create configmap config-files --from-file=nginx-conf=nginx.conf' ExecKube -cmd 'create configmap config-files --from-file=nginx-conf=nginx.conf'
ExecKube -cmd 'label configmap config-files app=eshop' 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'
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 'Deploying code deployments (databases, redis, ...)' -ForegroundColor Yellow
ExecKube -cmd 'create -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 # building and publishing docker images not necessary when deploying through CI VSTS
@ -143,6 +149,7 @@ ExecKube -cmd 'create configmap externalcfg `
--from-literal=MarketingBus=$($config.servicebus.marketing) ` --from-literal=MarketingBus=$($config.servicebus.marketing) `
--from-literal=BasketBus=$($config.servicebus.basket) ` --from-literal=BasketBus=$($config.servicebus.basket) `
--from-literal=OrderingBus=$($config.servicebus.ordering) ` --from-literal=OrderingBus=$($config.servicebus.ordering) `
--from-literal=CatalogBus=$($config.servicebus.catalog) `
--from-literal=PaymentBus=$($config.servicebus.payment) ' --from-literal=PaymentBus=$($config.servicebus.payment) '
ExecKube -cmd 'label configmap externalcfg app=eshop' ExecKube -cmd 'label configmap externalcfg app=eshop'

View File

@ -68,6 +68,11 @@ spec:
configMapKeyRef: configMapKeyRef:
name: urls name: urls
key: CatalogUrl key: CatalogUrl
-name: EventBusConnection
valueFrom:
configMapKeyRef:
name: externalcfg
key: CatalogBus
ports: ports:
- containerPort: 80 - containerPort: 80
imagePullSecrets: imagePullSecrets:

View File

@ -22,6 +22,8 @@
"ordering": "rabbitmq", "ordering": "rabbitmq",
"marketing": "rabbitmq", "marketing": "rabbitmq",
"locations": "rabbitmq", "locations": "rabbitmq",
"payment": "rabbitmq" "payment": "rabbitmq",
"basket": "rabbitmq",
"catalog": "rabbitmq"
} }
} }

View File

@ -83,8 +83,8 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
} }
location /location-api { location /locations-api {
proxy_pass http://location; proxy_pass http://locations;
proxy_redirect off; proxy_redirect off;
proxy_set_header Host $host; proxy_set_header Host $host;
} }

30
k8s/nosql-data.yaml Normal file
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