2

I configured pipeline to do zero down time deployment for Azure Functions. For that purpose I have following steps:

  • create slot
  • deploy to slot
  • start swap with preview
  • complete swap

My understanding of this is process is that all restarts should happen only on preview slot (so only JobHost should be restarted) and this should have a place before final swap. However, I noticed on Application Insight that Hosting stopped which result in on 503 code when I was hitting function. Is there away of avoiding this? I'm not sure if it matters but I use Premium plan.

Krzysztof Madej
  • 13,194
  • 6
  • 28
  • 50

2 Answers2

1

You cannot avoid the restart but you could use a custom warm-up if your function needs it.

The swap operation waits for the warm-up to finish before swapping with the target swap. You configure this in a web.config file, example below:

<system.webServer>
    <applicationInitialization>
        <add initializationPage="/" hostName="[app hostname]" />
        <add initializationPage="/Home/About" hostName="[app hostname]" />
    </applicationInitialization>
</system.webServer>

You can also customize the warm-up behavior with one or both of the following app settings:

  • WEBSITE_SWAP_WARMUP_PING_PATH: The path to ping to warm up your site. Add this app setting by specifying a custom path that begins with a slash as the value. An example is /statuscheck. The default value is /.
  • WEBSITE_SWAP_WARMUP_PING_STATUSES: Valid HTTP response codes for the warm-up operation. Add this app setting with a comma-separated list of HTTP codes. An example is 200,202 . If the returned status code isn't in the list, the warmup and swap operations are stopped. By default, all response codes are valid.
Martyn C
  • 1,031
  • 9
  • 18
0

I was able to achieve zero downtime deployment setting variable WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG to 1. For more info you can take a look here. One drwaback of this is slowness on processing requests during deployment.

I also recommend to follow this github issue where is discussion about zer/miniam downtime deployment.

Krzysztof Madej
  • 13,194
  • 6
  • 28
  • 50