tomcatantinstallationmanager-app

Using `ant install` on Tomcat virtual host


I want to use ant install to deploy (and re-deploy and re-deploy) my webapp on a local virtualhost.

It works fine with the default host, but the virtual host does not have the manager webapp. I would like to use similar setup in the live enviromnet (no manager on the given host).

I found a promisiong property:

webapp.virtual.host=...

in some example build.properties, but it does not seem to get the job done. Is it even possible, and how?


Solution

  • In my answer to one SO post, Christian Semrau commented:

    In standard configuration, Tomcat monitors its webapps folder and deploys any webapp for which you copy a .war file into the webapps folder, and undeploys it if you remove the .war file, and re-deploys it when you change the .war file. But when doing that, you don't get automatic feedback about the success of a deployment, which you do get from the Tomcat Manager.

    That said, your task becomes as easy as copying or removing the file on the remote server.

    Yet, I still don't understand why having manager app is a problem. You could, for example, only deploy it on different host/port:

    <Connector port="8080" address="main.ip.add.ress">
      ...
      <Context path="/your_main_context">
      ...
      </Context>
    </Connector>
    
    <Connector port="18080" address="another.ip.add.ress">
      ...
      <Context path="/manager">
      ...
      </Context>
    </Connector>
    

    and put relevant firewall restrictions. Or, alternatively, you could place

    <Valve className="org.apache.catalina.valves.RemoteHostValve"
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/>      
    

    inside Context and achieve similar results.