powershell - 当 AppService 运行/扩展到 2 个以上实例时的 Azure 部署

标签 powershell azure continuous-deployment

我正在为我们的项目开发一项功能,该功能将持续部署到生产中。 在开发过程中我发现如果使用部署槽:

暂存交换到生产环境 在运行多个实例的 Web 角色中(也称为横向扩展模式), 交换 Stage->Prod 仅发生在 1 个实例上。

所以问题是我可能会运行陈旧/错误的代码。 到目前为止我发现的唯一方法: 1. 缩小规模 2.交换 3.扩大规模

该解决方案效率不高。有没有办法热交换Web角色的所有实例?

最佳答案

我们按照 Microsoft 指南进行部署实现。
https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-staged-publishing

部署后结果实例计数将持续存在

要创建 Staging slot,-Slot 是 Staging

New-AzureRmWebAppSlot -ResourceGroupName [resource group name] -Name [app name] -Slot [deployment slot name] -AppServicePlan [app service plan name]

交换插槽

$ParametersObject = @{targetSlot  = "[slot name – e.g. “production”]"} 
Invoke-AzureRmResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-07-01

请注意,您可能需要部署服务主体才能与资源管理器交互

https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal

更新于 4/19 - 我发现可能存在其他与持久性相关的问题,这些问题会在部署后扰乱应用程序,这里有两个示例可能会有所帮助,但问题主要是特定于应用程序的

  1. Disabling ARR’s Instance Affinity in Windows Azure Web Sites

  2. Azure Websites and stateful webApp

关于powershell - 当 AppService 运行/扩展到 2 个以上实例时的 Azure 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41050840/

相关文章:

azure - 使用 for 循环使用 terraform 从 csv 文件中获取值

continuous-deployment - 我应该使用 gradle 进行持续部署吗?

apache-spark - Pyspark CI CD 管道

powershell - Powershell:多次解析和复制

azure - 使用 AZ 命令行列出 CosmosDB 实例中的数据库

powershell - 拒绝尝试从Powershell启动Appfabric缓存集群的访问

c# - excel 文件托管在 Azure Blob 上,如何将其读入 FileStream?

docker - 在 Rancher 管道中并行推送多个 Docker 镜像

arrays - 奇怪的行为:输入参数(具有以 “D”或 “L”字符结尾的多个值)

Powershell:如何找出哪些正在运行的服务不是操作系统和非 MS 的一部分