update k8s deploy script
This commit is contained in:
parent
1bbd152dc4
commit
66a2457676
@ -26,13 +26,14 @@ kubectl create secret docker-registry registry-key `
|
||||
--docker-password=$dockerPassword `
|
||||
--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 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
|
||||
../cli-windows/build-bits-simple.ps1
|
||||
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
|
||||
@ -40,13 +41,13 @@ 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")
|
||||
foreach ($service in $services) {
|
||||
docker tag eshop/$service $registry/$service
|
||||
docker push $registry/$service
|
||||
docker tag eshop/$service $registry/eshop/$service
|
||||
docker push $registry/eshop/$service
|
||||
}
|
||||
|
||||
Write-Host "Waiting for frontend's external ip..." -ForegroundColor Yellow
|
||||
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])) {
|
||||
break
|
||||
}
|
||||
@ -62,19 +63,18 @@ kubectl create configmap urls `
|
||||
--from-literal=SpaClient=http://$($frontendUrl)
|
||||
kubectl label configmap urls app=eshop
|
||||
|
||||
# TODO verify database readiness?
|
||||
Write-Host "Creating deployments..."
|
||||
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)
|
||||
kubectl set image -f deployments.yaml `
|
||||
basket=$registry/basket.api `
|
||||
catalog=$registry/catalog.api `
|
||||
identity=$registry/identity.api `
|
||||
ordering=$registry/ordering.api `
|
||||
webmvc=$registry/webmvc `
|
||||
webspa=$registry/webspa
|
||||
basket=$registry/eshop/basket.api `
|
||||
catalog=$registry/eshop/catalog.api `
|
||||
identity=$registry/eshop/identity.api `
|
||||
ordering=$registry/eshop/ordering.api `
|
||||
webmvc=$registry/eshop/webmvc `
|
||||
webspa=$registry/eshop/webspa
|
||||
kubectl rollout resume -f deployments.yaml
|
||||
|
||||
Write-Host "WebSPA is exposed at http://$frontendUrl, WebMVC at http://$frontendUrl/webmvc" -ForegroundColor Yellow
|
||||
|
Loading…
x
Reference in New Issue
Block a user