使用部署槽与使用独立应用服务在部署不同版本的应用服务时的选择时机

huangapple go评论64阅读模式
英文:

When to use Deployment Slots vs Separate App Services when deploying different versions of an App Service

问题

关于部署槽的问题,因为我试图弄清楚我想要使用部署槽的方式是否可行。在我们的团队中,我们倾向于为大多数Web应用程序拥有3个环境:

  • DEV - 最新的开发代码
  • QA - QA正在积极测试的代码
  • BC - 最后,另一个环境,用于QA运行向后兼容性测试

目前,我们只有一个单一的应用服务资源。因为我们希望为这三个环境部署三个应用程序代码版本,所以我想知道是否可以利用三个单独的部署槽,还是应该创建三个单独的Web应用程序?

根据文档,我知道部署槽是用于快速测试然后切换到生产环境的,但由于我们目前受限于Web应用程序的单一实例,所以我在考虑利用部署槽。

我想知道您对此的看法,是否应该选择新的应用服务还是槽来处理这种情况。

英文:

I had a question regarding deployment slots because I am trying to figure out the way I want to use the deployment slots is acceptable or not. In our team we tend to have 3 environments for most of our web applications :

  • DEV - latest dev code
  • QA - code that QA is actively testing
  • BC - lastly a separate environment again for QA to run backward compatibility tests

Currently we are given a single app service resource. Since we would like to maintain 3 versions of the application code deployed for said 3 environments, I was wondering if 3 separate deployment slots could be leveraged for it, or would creating 3 separate web apps is the way to go?

From the doc I know that the deployment slots are meant for quick testing and then swapping it out to production but since we are currently limited to single instance of web app I was thinking of leveraging deployment slots.

I would like to know your thoughts on this and if I should go with new app services or slots for these kind of scenario.

答案1

得分: 8

只要将它们分开是更灵活和可能更安全的方式。正如提到的,没有成本差异;然而,我想指出,如果 Web 应用确实是 3 个不同的环境,那么它们应该是 3 个不同的应用服务。这将使您能够在每个环境后面拥有一个数据库,为每个环境分配一个身份应用程序注册以及潜在的不同访问限制规则。

实际上,将它们分开可能会节省成本,因为 DEV 中的应用服务可能比 PROD 中的应用服务规模较小。或者当不使用 DEV 时,可以将其删除,然后在进行工作时通过ARM重新部署。

Microsoft 最佳实践中的应用服务插槽中提到,可以使用插槽来进行:

> - 在与生产插槽交换之前,您可以在分级部署插槽中验证应用程序更改。
> - 首先将应用程序部署到插槽中,然后将其与生产环境交换,以确保插槽的所有实例在交换到生产环境之前都已启动。这可以在不需要预交换验证时消除停机时间。流量重定向是无缝的,没有因交换操作而丢失的请求。您可以通过配置自动交换来自动化整个工作流程,当不需要预交换验证时。
> - 在交换后,以前分级的应用程序现在位于之前的生产插槽中。如果交换到生产插槽的更改不如您所期望,您可以立即执行相同的交换,以获取您的“最后已知良好站点”。

为了进一步澄清,部署插槽应该用于蓝绿部署或金丝雀发布。此链接适用于 DevOps 部署,但适用于应用服务插槽的相同概念。

当然,缺点是可能会增加一些额外的开销和管理。如果使用单独的应用服务,则可能需要单独的DNS记录、网络规则、SSL证书等。

英文:

Just to add separating them out is the more flexible and potentially a more secure way to go. As mentioned there is not cost difference; however, I'd like to point out that if web apps will truly be 3 different environments then they should be 3 different app services. This will enable you to have a database behind each environment, an Identity assign to each environment, Application registration and potentially different access restrictions rules for each environment.

In fact there could potentially be a cost savings separating them out as the app service in DEV might be more scaled down then in PROD. Or DEV could be just deleted off when not in use and redeployed via ARM when being worked on.

From Microsoft Best Practices on app service slots it calls out using a slot for:

> - You can validate app changes in a staging deployment slot before swapping it with the production slot.
> - Deploying an app to a slot first and swapping it into production makes sure that all instances of the slot are warmed up before
> being swapped into production. This eliminates downtime when you
> deploy your app. The traffic redirection is seamless, and no
> requests are dropped because of swap operations. You can automate
> this entire workflow by configuring auto swap when pre-swap
> validation isn't needed.
> - After a swap, the slot with previously staged app now has the previous production app. If the changes swapped into the production
> slot aren't as you expect, you can perform the same swap
> immediately to get your "last known good site" back.

For further clarification deployments slots should be used for Blue-green deployment or canary releases This link is for DevOps deployment but same concept applies for app service slots.

Of course the downside is potentially some more overhead and management. If separate app services then potentially separate DNS records, network rules, SSL certs, etc..

答案2

得分: 7

从技术上讲,我相信你所建议的是可能的,因为每个部署槽都托管了应用程序的完全功能版本,你可以使用这种路由方法来访问特定的槽位。你只需将每个环境部署到自己的槽位,而不需要交换它们。

然而,没有必要这样做。你可以免费创建额外的Web应用程序。你只需要支付App Service计划的费用,而且你可以在该计划上运行尽可能多的Web应用程序,因此最好为每个环境创建一个单独的App Service,而且由于它们都是非生产环境,你可以安全地在同一个App Service计划中运行它们。

英文:

Technically I believe it is possible to do what you are suggesting because each deployment slot does host a fully functional version of your application and you can access specific slots using this routing method. You would simply deploy each environment to its own slot and never swap them.

However, there is no reason to do this. You can create additional web applications at no cost. You are only paying for the App Service Plan, and you can have as many web apps running on that plan as you want, so you would be better off creating a separate App Service for each of your environments, and since they are all non-production, you can safely run them all in the same App Service Plan.

huangapple
  • 本文由 发表于 2020年1月3日 20:07:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/59578368.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定