azureazure-devopsdeploymentazure-appserviceazure-deployment-slots

How to achieve true zero downtime deployment in Azure App Service


I have some containers deployed on Azure App Service. To achieve zero downtime, Azure recommends using Deployment slots and swapping the staging and production slots. This is fine for a normal web applications, but If I have a web app where I am also doing other stuff like reading messages from queues, running workers in the background etc.

How do I ensure that the container is terminated in a graceful manner. Do Azure sends some kind of signal to the docker container indicating that it is terminating the application, so we should do cleanups. If not, how can I make my app truly zero downtime deployable hosted in App Service?


Solution

  • but I have a web app where I am also doing other stuff like reading messages from queues, running workers in the background etc.

    This design is going to make it very difficult for you to do zero-downtime upgrades. I would recommend splitting the different purposes, and deploy them on different azure resources which can be upgraded in different ways:

    1. your web app runs on Azure App Service, with blue/green upgrades using deployment slots
    2. worker processes, and queue processing, could each be done by Azure Functions, which have their own version of deployment slots for zero-downtime upgrades