Webjob的临时隙不停止后一个管道部署在蔚蓝的测试

0

的问题

在一些部署我在做一个 App Service 资源中包含2个插槽(a productionstaging 槽),webjob的临时并不停止之后交换的时隙。

基本上我有在我的管线以下任务:

## Start App Service (staging)
- task: AzureAppServiceManage@0
  displayName: 'Start Azure App Service: some-app-webjob (staging)'
  inputs:
    azureSubscription: 'xxx'
    Action: 'Start Azure App Service'
    WebAppName: 'some-app-webjob'
    SpecifySlotOrASE: true
    ResourceGroupName: 'some-rg-app-webjob'
    Slot: staging
##Start staging continuous webjob
- task: AzureAppServiceManage@0
  displayName: 'Start all continuous webjobs: some-app-webjob (staging)'
  inputs:
    azureSubscription: 'Subscrição do Visual Studio Enterprise(c9f20c2b-15cf-41fb-8122-ddf095c6db02)'
    Action: 'Start all continuous webjobs'
    WebAppName: 'some-app-webjob'
    SpecifySlotOrASE: true
    ResourceGroupName: 'some-rg-app-webjob'
    Slot: 'staging'

## Swap Slots (staging to production)
- task: AzureAppServiceManage@0
  displayName: 'Swap Slots: some-app-webjob'
  inputs:
    azureSubscription: 'xxx'
    WebAppName: 'some-app-webjob'
    ResourceGroupName: 'some-rg-app-webjob'
    SourceSlot: staging
    TargetSlot: production

# Stop WebJobs running Staging
- task: AzureAppServiceManage@0
  displayName: 'Stop all continuous webjobs: some-app-webjob (staging)'
  inputs:
    azureSubscription: 'xxx'
    Action: 'Stop all continuous webjobs'
    WebAppName: 'some-app-webjob'
    SpecifySlotOrASE: true
    ResourceGroupName: 'some-rg-app-webjob'
    Slot: staging
    
## Stop App Service (staging)
- task: AzureAppServiceManage@0
  displayName: 'Stop Azure App Service: some-app-webjob (staging)'
  inputs:
    azureSubscription: 'xxx'
    Action: 'Stop Azure App Service'
    WebAppName: 'some-app-webjob'
    SpecifySlotOrASE: true
    ResourceGroupName: 'some-rg-app-webjob'
    Slot: staging

如果我去看看我的老虎临时的应用程序服务是停止。 但有时workjob保持运行时,它不应该。 因为我有一个任务,应该有持续web作业之后交换与生产。

在总结这可能发生这样的情况:

  • 连续webjob在隙临时运行
  • 连续webjob在隙生产运行的

搜索后,我发现这个线。 https://github.com/projectkudu/kudu/issues/1886 它表示web作业的运行在scm网站而不受停止网站的命令。 不过,我有一个任务,应停止所有连续web作业.

没有任何理由为这样的事情发生? 我们如何才能防止这个吗? 我不想一个webjob与老码运行之后的部署。

1

最好的答案

1

部署一个连续WebJob于停止状态简单地添加一个文件叫 disable.job 在根WebJob(二进制文件),在此告诉该框架的WebJob目前已停止。

你可以添加的应用程序的设置 WEBJOBS_STOPPED 你的过渡槽,并将其设置到 1 (在蔚蓝的门户网站). 让这个设置'槽设定',因此,它不是交换与生产。

这是会发生什么事当您换一个来源的老虎(临时)到一目标隙(生产)。

  • 第一,临时网站需要通过设置一些变化应用程序的设置和连串的标记为')'. 还有其他变化相关来源的控制,可能需要加以应用。 这导致临时网站重新启动,它是好的。

  • 接下来,临时网站得到升温,具有通过请求发送给它的根路径(即'/'),并等待它完成。

  • 现在,临时网站是温暖,它就会换成生产。 没有下次的,因为它直接从一个温站到另一个。

  • 最后,该网站,用于生产和现在的临时也需要获得一些设置适用,导致它重新启动。 再次,这是好的,因为它发生在临时网站。

我不想一个webjob与老码运行之后的部署。

  • 如果你有一个阶段的环境(加阶段的网络应用程序的名称)并且如果这样去蔚管理门户网站,并阻止他们。

  • 这是不足以阻止该网络应用程序,必须停止web作业。 这样做是(在新的门户网站)之下设置->web作业,然后右击web作业的名称的选择停止。

请参阅 Azure网应用程序(网站)部署槽 的更多细节。

2021-11-24 08:07:57

你好@HarshithaVeeramalla-MT我认为这标志 WEBJOBS_STOPPED 是一个很好的解决方案应用到临时隙。 它不会优雅地停止webjob这是交换?
Nmaster88

请参阅 管理web作业
HarshithaVeeramalla-MT

WEBJOB_STOPPED值为1停止所有web作业运行的网站上。 这可能是方便的办法来防止冲突web作业的运行两个在过渡和生产的插槽。
HarshithaVeeramalla-MT

谢谢,我已经读过它,但是它不似乎是明确如何停止的持续web作业. 它只是说,这停止,我假设它杀死的过程。
Nmaster88

对于连续的,你可以这样做只是把一个文件叫"禁止。工作"在根WebJob目录。
HarshithaVeeramalla-MT

请参阅 连续WebJob 点6
HarshithaVeeramalla-MT

我申请的WEBJOBS_STOPPED标志,这两个暂存槽。 它停止连续和触发webjpbs运行。
Nmaster88

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................