Production web app and celery restarts when deploying to staging

Shivendra Singh 1 Reputation point
2022-02-22T12:51:09.367+00:00

I have a web app which uses azure web app service for deployment. The app service has 2 slots for production and staging. Whenever i have new changes to deploy I deploy first on staging and then swap with production slot.

The issue is i have celery installed which handles large excel file generation and download.
When i deploy on staging the production slot is restarted and already running task in celery is lost.

How can i resolve this issue?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 17,731 Reputation points Microsoft Employee Moderator
    2022-02-24T02:46:01.167+00:00

    @Shivendra Singh Thank you for your question regarding how to avoid your production slot from restarting when making deployments to your staging slot. We apologize for the frustration you have encountered with this setup.

    By design, the production slot should not be restarting when making deployments to the staging slot. As long as you do not have auto swap on and have not gone ahead and swapped staging and production, this would be an unexpected behavior.

    You mention that you are writing lots of data to local storage on the web app via your Excel/Celery setup. Without seeing your logs, we wonder if this is causing storage failovers, which do cause the web app to restart. One way to hopefully reduce this is to set an app setting.

    1. Navigate to the configuration blade in your web app in the Azure portal
    2. Under Application Settings place WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG=1
    3. Place this app setting on ALL of your slots. (Note this setting does not work with WCF)

    Source

    Please report back to us with the results. We look forward to your update.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.