none
[Java][Web Apps] Tomcat restart in deployment script ? RRS feed

  • Question

  • Hello everyone,

    I'm wondering if restarting Tomcat from a deployment script is possible ?

    Context:

    I have a .war Java Application to deploy on my Azure Web App running on Tomcat 7.0.62 (created with App Services UI).

    To do so, I use Continuous Deployment (Configured with Git Local). I simply push my .war into the webapps/ folder, which triggers Tomcat's deployment. The application is well deployed, everything works fine.

    Now, I would like to avoid PermGen Space errors to occure. I know this error could occured by deploying the .war several times without restarting Tomcat.

    My solution to avoid PermGen Space error is to restart Tomcat. I tried to do so on Azure Web App:

    - Check for environment variable "AZURE_TOMCAT7_HOME"

    - Executing AZURE_TOMCAT7_HOME\bin\shutdown.bat   (THIS DOES NOT WORK)

    - Executing AZURE_TOMCAT7_HOME\bin\startup.bat

    This is done in the deployment script "deploy.cmd" with a ".deployment" file. (files generated with azure-cli)

    The 2nd step does not work. I can't shutdown Tomcat because the Shutdown port is not configured. I suppose it's not made to be configured.

    My Questions:

    Is it possible to restart Tomcat from the deployment script ? Is it risky ?

    Can I automatically restart the Web App (like I would click on Restart button on Azure Portal) ?

    Thanks.




    Wednesday, March 2, 2016 9:56 AM

Answers

  • Hi,

    Per my experience, I think you can try to combine Azure Automation with the PowerShell cmdlet Restart-AzureRmWebApp  to implement your needs.

    Please refer to these documents below.

    1. For creating the Automation & runbook, please see https://azure.microsoft.com/en-us/documentation/articles/automation-first-runbook-graphical/.

    2. About the cmdlet Restart-AzureRmWebApp, please see https://msdn.microsoft.com/en-us/library/mt619268.aspx.

    There is the trainning videos for Azure Automation at https://mva.microsoft.com/en-US/training-courses/automating-the-cloud-with-azure-automation-8323?l=C6mIpCay_4804984382.

    Hope it helps.

    Best Regards.

    Thursday, March 3, 2016 5:20 AM
    Moderator

All replies