如何防止Azure Webjob在Azure网站生产中被交换< ---->暂存槽 [英] How to prevent Azure webjobs from being swapped in Azure website production <--> staging slots

查看:72
本文介绍了如何防止Azure Webjob在Azure网站生产中被交换< ---->暂存槽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Azure网站,该网站的生产和登台版位带有多个实例.

I have an Azure website with a production and staging slot with multiple instances.

我在网站上运行了多个Azure webjob,其中一些是连续触发的.

I run several Azure webjobs on the site, some of which are triggered others that are continuous.

我了解触发的Webjob只能在一个实例上运行一次.

I understand triggered webjobs will only run once on one instance.

我当前的设置是:

  • 生产站点除了从暂存区交换外没有部署

  • Production site has no deployment other than swapping from staging

分阶段网站已设置为可以从bitbucket进行连续部署

Staging website is setup to continuous deployment from bitbucket

使用发布到Azure"将Webjob从VS内部署到生产位置(因为AFAIK不支持基于计划的webjob的连续部署)

Webjobs are deployed from within VS to production slot using "publish to Azure" (since AFAIK there is no support for continuous deployment of webjobs that are schedule based)

网站的VS解决方案与包含webjobs的VS解决方案不同

The VS solution for the website is different from the VS solution containing webjobs

我注意到当我交换制作和演出时,webjobs也被交换了! 当我将一个新的Webjob部署到生产环境,然后进行网站部署,然后进行交换时,我意识到了这一点,新部署的webjob不再在生产环境中!

I noticed when I swap production and staging, webjobs are also swapped! I realized this when I had deployed a new webjob to production and subsequently did a website deployment followed by a swap, the newly deployed webjob was no longer in the production slot!

我的问题:

  1. 是否有可能防止webjob在生产和暂存之间进行交换(webjob实际上是与网站完全不同的代码段)

  1. is it possible to prevent webjobs from swapping between production and staging (webjobs are really entirely different pieces of code than the website)

什么是网络工作的确切交换?二进制文件?日程?都是吗?

What exactly is swapped for webjobs? Binaries? Schedule? Both ?

如何防止所有webjob在登台插槽上运行?我的网络职位不需要高度可用,我可以轻松地对其进行脱机测试.

how do i prevent all webjobs from running on the staging slot? My webjobs do not need to be highly available and i can test them offline easily.

如果我VS将Webjobs部署到登台插槽并进行交换,那么当前的登台插槽将缺少已部署的Webjob,当我进行下一个网站更新时我会丢失它,所以我应该在哪里部署我的webjobs?

If i VS deploy webjobs to the staging slot and do a swap, then the current staging slot will be missing the deployed webjob and I'll lose it when i do my next website update, so where should i be deploying my webjobs?

有一个相关线程,但它假定该Webjob与我目前没有的网站.

There is a related thread but it assumes the webjob is deployed simultaneously with a website which is not what I have currently.

我真的很喜欢网站和Web作业,但似乎与连续独立部署Web作业和网站有关的故事已被打破.

I really like websites and webjobs, but it seems the story related to continuous independent deployment of webjobs and websites is broken.

非常感谢您的建议!

谢谢

推荐答案

Azure网站部署位置不是一个容易理解的概念,与WebJobs一起使用会变得更加困难.

Azure websites deployment slots are not an easy concept to understand, together with WebJobs it gets a little bit more difficult.

我建议阅读以下文章,以更好地了解部署插槽- http://blog.amitapple.com/post/2014/11/azure-websites-slots/(包括有关有用信息的评论部分)

I suggest reading the following post to get a better understanding on deployment slots - http://blog.amitapple.com/post/2014/11/azure-websites-slots/ (including the comments section for useful information)

要更好地了解WebJobs的工作方式和部署方式,请参阅此帖子- http://blog .amitapple.com/post/74215124623/deploy-azure-webjobs/

To get a better understanding on how WebJobs work and deployed see this post - http://blog.amitapple.com/post/74215124623/deploy-azure-webjobs/

重要的是要了解:

  1. 交换部署插槽时,实际上是在2个插槽之间交换网站的内容/文件.
  2. WebJobs是网站内容的一部分.

因此,当您交换广告位时,实际上就是交换了包括WebJob在内的网站文件.

So when you swap the slot you actually swap the website files including the WebJob.

请注意,直接部署WebJob而不是将其作为网站文件/存储库的一部分是一种不良做法,这可能是导致您遇到问题的原因.

Note it is a bad practice to deploy a WebJob directly and not as part of your website files/repository, this is probably the cause of issues you are having.

要防止WebJobs在登台插槽上运行,您可以添加一个名为WEBJOBS_STOPPED的应用程序设置并将其设置为1(在azure门户中). ().确保此应用设置固定在广告位上,否则它将传播到生产广告位.

To prevent WebJobs from running on the staging slot you can add an app setting called WEBJOBS_STOPPED and set it to 1 (in the azure portal). (source). Make sure this app setting is sticky to the slot otherwise it'll propagate to the production slot.

这篇关于如何防止Azure Webjob在Azure网站生产中被交换< ---->暂存槽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆