update k8s deploy script
This commit is contained in:
parent
6cabf6691d
commit
fb3c85ef56
@ -26,13 +26,14 @@ kubectl create secret docker-registry registry-key `
|
|||||||
--docker-password=$dockerPassword `
|
--docker-password=$dockerPassword `
|
||||||
--docker-email=not@used.com
|
--docker-email=not@used.com
|
||||||
|
|
||||||
# start sql and frontend deployments
|
# start sql, rabbitmq, frontend deployments
|
||||||
kubectl create configmap config-files --from-file=nginx-conf=nginx.conf
|
kubectl create configmap config-files --from-file=nginx-conf=nginx.conf
|
||||||
kubectl label configmap config-files app=eshop
|
kubectl label configmap config-files app=eshop
|
||||||
kubectl create -f sql-data.yaml -f services.yaml -f frontend.yaml
|
kubectl create -f sql-data.yaml -f rabbitmq.yaml -f services.yaml -f frontend.yaml
|
||||||
|
|
||||||
Write-Host "Building solution..." -ForegroundColor Yellow
|
Write-Host "Building and publishing eShopOnContainers..." -ForegroundColor Yellow
|
||||||
../cli-windows/build-bits-simple.ps1
|
dotnet restore ../eShopOnContainers-ServicesAndWebApps.sln
|
||||||
|
dotnet publish -c Release -o obj/Docker/publish ../eShopOnContainers-ServicesAndWebApps.sln
|
||||||
|
|
||||||
Write-Host "Building Docker images..." -ForegroundColor Yellow
|
Write-Host "Building Docker images..." -ForegroundColor Yellow
|
||||||
docker-compose -p .. -f ../docker-compose.yml build
|
docker-compose -p .. -f ../docker-compose.yml build
|
||||||
@ -40,13 +41,13 @@ docker-compose -p .. -f ../docker-compose.yml build
|
|||||||
Write-Host "Pushing images to $registry..." -ForegroundColor Yellow
|
Write-Host "Pushing images to $registry..." -ForegroundColor Yellow
|
||||||
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "webmvc", "webspa")
|
$services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "webmvc", "webspa")
|
||||||
foreach ($service in $services) {
|
foreach ($service in $services) {
|
||||||
docker tag eshop/$service $registry/$service
|
docker tag eshop/$service $registry/eshop/$service
|
||||||
docker push $registry/$service
|
docker push $registry/eshop/$service
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Waiting for frontend's external ip..." -ForegroundColor Yellow
|
Write-Host "Waiting for frontend's external ip..." -ForegroundColor Yellow
|
||||||
while ($true) {
|
while ($true) {
|
||||||
$frontendUrl = kubectl get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}" 2> $_
|
$frontendUrl = kubectl get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}"
|
||||||
if ([bool]($frontendUrl -as [ipaddress])) {
|
if ([bool]($frontendUrl -as [ipaddress])) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -62,19 +63,18 @@ kubectl create configmap urls `
|
|||||||
--from-literal=SpaClient=http://$($frontendUrl)
|
--from-literal=SpaClient=http://$($frontendUrl)
|
||||||
kubectl label configmap urls app=eshop
|
kubectl label configmap urls app=eshop
|
||||||
|
|
||||||
# TODO verify database readiness?
|
|
||||||
Write-Host "Creating deployments..."
|
Write-Host "Creating deployments..."
|
||||||
kubectl apply -f deployments.yaml
|
kubectl apply -f deployments.yaml
|
||||||
|
|
||||||
# update deployments with the private registry
|
# update deployments with the private registry before k8s tries to pull images
|
||||||
# (deployment templating, or Helm, would obviate this)
|
# (deployment templating, or Helm, would obviate this)
|
||||||
kubectl set image -f deployments.yaml `
|
kubectl set image -f deployments.yaml `
|
||||||
basket=$registry/basket.api `
|
basket=$registry/eshop/basket.api `
|
||||||
catalog=$registry/catalog.api `
|
catalog=$registry/eshop/catalog.api `
|
||||||
identity=$registry/identity.api `
|
identity=$registry/eshop/identity.api `
|
||||||
ordering=$registry/ordering.api `
|
ordering=$registry/eshop/ordering.api `
|
||||||
webmvc=$registry/webmvc `
|
webmvc=$registry/eshop/webmvc `
|
||||||
webspa=$registry/webspa
|
webspa=$registry/eshop/webspa
|
||||||
kubectl rollout resume -f deployments.yaml
|
kubectl rollout resume -f deployments.yaml
|
||||||
|
|
||||||
Write-Host "WebSPA is exposed at http://$frontendUrl, WebMVC at http://$frontendUrl/webmvc" -ForegroundColor Yellow
|
Write-Host "WebSPA is exposed at http://$frontendUrl, WebMVC at http://$frontendUrl/webmvc" -ForegroundColor Yellow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user