2012/2/17 Jeffrey Janner <jeffrey.jan...@polydyne.com>:
> Assume latest Tomcat 6.x for current deployment, and 7.x for future 
> deployments.
>
> I host an app for a couple of dozen customers.  Naturally, upgrade time can 
> be a bit of a pain, and I'd like to simplify things.
> Assuming that all the customer-specific information (DB connection info, 
> logger info, etc.) can be described as resources in the context.xml file, 
> would it be possible to put the actual webapp in a single pre-exploded 
> directory without causing Tomcat fits?
>
> Example directory tree:
>
> Web-app-1.1
>    Images
>   META-INF
>   JSPs
>  WEB-INF  (with generic web.xml for web-app-1.1)
>     lib
>     classes
>
> ROOT.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <Context path=""
>         docBase="path/to/Web-app-1.1">
>  <Valve className="org.apache.catalina.authenticator.SSLAuthenticator"
>        securePagesWithPragma="false" />
>  <....resources definitions.... />
> </Context>
>
>
> Then when a new release comes out, I can deploy the web-app once and modify 
> the individual customer's contexts to point to the new release path as they 
> choose upgrade (or all at once).
>
> And, yes, I know that disk is cheap and I could just do it by replacing 3-4 
> dozen war files nearly as easily.  And right now, I'm not sure if the future 
> 7.x versioning feature will come in handy as our dev staff haven't started 
> investigating 7.x yet.
>

1. It is possible to have several contexts to point to the same
exploded directory or a war file.

People use this a lot with virtual hosts - to deploy the same manager
webapp to different hosts at once.

I use this when running with separate CATALINA_HOME and CATALINA_BASE:
I leave manager webapp in CATALINA_HOME, pointing to it from a context
file. (So that I do not need to do a fresh copy of manager app when I
update Tomcat).

Note that you can use properties substitution in xml files parsed by
Tomcat, e.g. use ${catalina.home}.

2. Regarding different configuration:
- It is possible to add paths to classloader via context.xml - by
using VirtualWebappLoader class.

- It is possible to overwrite resources by using aliases in Context in Tomcat 7.

3. If you need to minimize downtime, in Tomcat 7 you can use versioned contexts.

4. If you frequently use redeployment on a running Tomcat, make sure
that your web application does not have PermGen memory leak.  The
manager app can detect them.

5. If you are redeploying on a stopped Tomcat, make sure that you
purge the work directory from old files.

>> I was under the impression that one should run from the exploded
>> directory for performance reasons, i.e. it's faster to pull files
>> from the directory than from inside the war file.
>
> IIRC, Tomcat explodes the WAR file into the work directory anyway. You
> can easily confirm that.
>

Only classes and jars. Resources are not unpacked when running from
unexploded WAR.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to