Configurable retries for deploy via Tomcat manager?

I am trying to deploy a webapp using the Deploy to Tomcat via manager step, and the webapp is failing to start successfully – this is expected behavior right now, but I’m not thrilled that it takes 12+ minutes for the step to finish running. I did some investigating and discovered that this step attempts 5 deployments, and for each deployment, it tries to start the webapp 5 times.

Is there any way to configure the number of retries when performing a deployment via the Tomcat manager? I can look in the Tomcat logs and see a [SEVERE] error almost immediately. I really don’t want to sit around and wait for it to execute a combined 25 deploy/retry operations before returning.

Hi @justinm89,

Thanks for posting your question, and I can see how it would be frustrating to wait that long while the redeployments are attempted.

One suggestion is to have your Tomcat webapps deploy in a stopped state, and then you could either manually script the startup of them or use our built-in step in your deployment process or a runbook. If you haven’t seen it yet, the following documentation on our built-in step might be helpful here: Restarting a Tomcat Web application - Octopus Deploy

Note that the behavior of the radio buttons is as follows (from the documentation):

  • Leave the application running (default). Note, This option will start the app if in a stopped state.
  • Stop the application

Let me know if that’s helpful, otherwise, you might provide me with a few more details on your use case so I can potentially provide a better suggestion.

Best,
Patrick

I just started messing around with this option – I take it that for this option to work as intended, the autoDeploy attribute needs to be false in server.xml?

<Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true">

It could be a misunderstanding on my part also, I’m not sure what the difference between a “deployed” app and a “started” app in Tomcat is.

Nevermind, I understand what it’s doing now.

Hi @justinm89,

Unfortunately, I’m not much of a Tomcat expert but it sounds like you’re on the right track and have a way forward. However, let me know if you have any further questions or issues and I’ll be glad to help!

Best,
Patrick

One last question – when deploying an application as running and it fails to start, I get a useful stacktrace logged to the Error channel, but the step itself is marked as successful with warnings – is there anyway to have it hard-error here? Maybe some variable I can hook into in a post-deploy script?

Hi Justin,
Thanks for getting back to us.

Good question and I believe one of our Tomcat blogs has some info on this. Essentially you can add a step to your process to run a HTTP request and check for a 200 response. This smoke test should let you know if it was successful. You can also use an output variable from that or another step to do some further work such as send an email or other work.

There is also quite a lot of good info on tomcat deployments in general if you need it in that blog article.

Let me know if that works for you.

Kind regards,
Paraic

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.