Graceful shutdown of app service on Linux

M Brouwer 6 Reputation points
2022-05-17T15:07:40.073+00:00

When deploying an app service there is the ability to specify a start command, but there is no way AFAIK to specify a stop command for an app service. We really have the need for a proper graceful shutdown for our web application that is deployed based on SpringBoot. We need the ability to delay the shutdown until certain tasks have completed and currently we experience when we perform a redeployment that the existing web app is taken offline without shutting down. Based on logging via application insights it just seems to be gone at some point. Adding a shutdown hooks to the Java VM don't indicate a shutdown is even initiated.

I understand that a graceful shutdown should not prevent from shutting down the web app altogether. However I can imagine the option to specify a stop command and a timeout parameter that represents the maximum time in ms that it might take the web app process to stop/shutdown before the web app instance is taken offline.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,228 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 18,816 Reputation points
    2022-05-24T20:44:21.923+00:00

    Hi @M Brouwer ,

    Thanks for the question. Apologies for the delay in response. If I understand correctly, you're looking for a command to stop your web app ?
    have you tried the Stop-AzWebApp command? Can you please share how you implemented your shutdown hooks?

    az webapp stop --name MyWebapp --resource-group MyResourceGroup  
    
    1 person found this answer helpful.

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.