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?
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: