Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I stop an Azure App Service during an update?

I am updating my Azure App Service from Azure DevOps. Currently, my release is like this:

  1. Stop the App Service,
  2. Update the App Service, and
  3. Start the App Service.

My question is whether it reasonable to stop the App Service during the update? When I select a release template from Azure DevOps for Azure App Service, there are't any stop/start steps, only the update step. So I am wondering if the stop/start is even needed?

like image 922
Lassi Autio Avatar asked Oct 22 '18 19:10

Lassi Autio


People also ask

Can we stop Azure App Service?

You can start or stop multiple Azure App services together. You are familiar with the start, stop or restart an App Services from the App Service overview dashboard. This is fine as long as we are dealing with single App Service.

How do I update my Azure App Service?

In the Azure portal, search for and select App services and select the app that you want to move. From the left menu, select Change App Service plan. In the App Service plan dropdown, select an existing plan to move the app to.

Do you get charged for a stopped App Service Azure?

Each Plan can host multiple Web App, and stopping one Web App does not affect the billing for the Plan. To stop the billing, you have to either delete your App Hosting Plan or scale it down to Free.

Which deployment method should you choose to reduce downtime for the application you are deploying?

Swapping into production—instead of deploying to production—prevents downtime and allows you to roll back the changes by swapping again.


3 Answers

There are (5) options for safe-deployment (atomic updates) to Azure Web Apps. Here is my preferred order ranked by priority and feature richness:

  1. Run-from-Package + ZipDeploy (makes site read-only)
  2. ZipDeploy (using kudu REST api - automatically takes site offline)
  3. Azure CLI (az webapp)
  4. msdeploy (-enableRule:AppOffline, or stop/start site to enforce atomicity)
  5. FTP (using publish profile, make sure to upload appoffline.htm)

There are numerous other deployment options like cloud sync, github continuous, local git, etc - but they are all built upon Kudu APIs (as is Azure CLI).

Note: If you're using Azure DevOps - it's supports nearly all these options - leverage the Azure App Service Deploy task

like image 183
SliverNinja - MSFT Avatar answered Oct 12 '22 19:10

SliverNinja - MSFT


What we have done mostly is:

  1. Stop staging slot
  2. Deploy to slot
  3. Start slot
  4. Swap staging to production
  5. Stop staging slot

Martin's suggestion on Take app offline is also a good one!

We prefer to deploy to slots and then swap so we incur minimal impact to production and can also rollback easily. Stopping/taking app offline can prevent file locking issues.

like image 40
juunas Avatar answered Oct 12 '22 19:10

juunas


It probably depends on your app. If you don't have any issues when you just update your app (such as the a file is in use issue) you can consider to use the Take App Offline flag which will place an app_offline.htm file in the root directory of the App Service during the update (then it will be removed). This way user will recognize that something is happening with the app.

However, I often ended up doing the same like you: Stop, Update, Start 😉

enter image description here

like image 22
Martin Brandl Avatar answered Oct 12 '22 18:10

Martin Brandl