tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@gopivotal.com>
Subject Re: Host appBase
Date Fri, 08 Nov 2013 20:29:00 GMT
On Nov 8, 2013, at 1:54 PM, Milo Hyson <milo@cyberlifelabs.com> wrote:

> The term that immediately comes to mind is YAGNI. How many of these things have legitimate
use-cases and how many are simply there because it was thought somebody somewhere someday
*might* want to adjust them?

> /dev/null

I disagree with this statement.  The default settings in Tomcat are convenient and provide
a good general environment for deploying applications, however it is always nice to be able
to adjust and customize things.  With the exception of xmlBase, I've used all of the settings
below on multiple occasions and I'm glad they exist.

> 
> - Milo Hyson
> Chief Scientist
> CyberLife Labs, Inc.
> 
> On Nov 8, 2013, at 9:18 AM, Leo Donahue - OETX <LeoDonahue@mail.maricopa.gov> wrote:
> 
>> Tomcat 7.0.47
>> 
>> Reading over the security benchmark I posted a link to earlier, there is one that
suggests to separate out the web content directory from the Tomcat system files.  Reading
the Tomcat docs for appBase, I see I can set this value.
>> 
>> Reading further down in the Tomcat docs for Host, other questions have spawned...
and I blame it on being Friday.
>> 
>> 1.  When/Why would I change the xmlBase directory location?  

Can't say I've ever used this setting before.  The default has always worked nicely for me.
 It's here for flexibility though.  For example if you would like to locate your xml context
files outside of CATALINA_BASE or CATALINA_HOME.  Perhaps on a different disk or partition.

>> For the same reasons I would change the appBase directory?

I see this used occasionally.  Some users like to host their applications in a dedicated folder
like "/my-apps".  Often on a different disk or partition.


>> 2.  What is the benefit of un-packing WAR files?

I'm not sure there's a concrete answer here.  Generally I see people unpack WAR files, but
it's not a must.  One nice thing about having the WAR file exploded is that I can edit certain
files without having to redeploy my application.


>> 	a.  If you drop a WAR file into your webapps directory (appBase I guess), and it
unpacks, should you leave the WAR file there or remove it?

If Tomcat is running, you would leave it there unless you want to undeploy the application.
 Then you would delete it.  

If Tomcat is not running, you could delete the WAR file.  If the exploded WAR directory still
exists you could start Tomcat back up and run the application from it.  Running from an exploded
WAR directory has some advantages like the WAR file doesn't need to be extracted on startup
and you can edit certain files without needing to redeploy.


>> 3.  WAR files located outside of the Host's appBase will not be expanded...
>> 	a.  Why would I deploy WAR files outside of the Host's appBase?

This is a preference / customizability thing.  Some people prefer to deploy their applications
to a custom folder like "/my-apps", but instead of pointing the entire appBase at this directory
they'll use a context file in the xmlBase to deploy an application that is outside of the
appBase.

One reason that I've personally used this is when developing software.  I set the docBase
in a context file to point to the directory that contains the output from Maven.  Paired with
the "reloadable" setting, this means that Tomcat will redeploy my application automatically
when trigger a Maven build.


>> 	b.  Where are those deployed?  By specifying the docBase?

Files outside of the app base can be anywhere.  As you mentioned, you'd just point to them
with the docBase.


>> 4. What is the difference exactly between appBase and docBase?

The appBase (configured on the Host tag, defaults to "webapps") points to a directory that
can contain web applications to be deployed to Tomcat.  Any valid web app in that directory
will get deployed.  

The docBase (configured on the Context tag) points to a directory or WAR file for one specific
application.


>> If the Context is specified in server.xml, I can have an appBase and a docBase?

I wouldn't suggest adding Context tags in server.xml.  You can but it's not flexible and you
need to restart Tomcat to make changes.  As far as appBase and docBase, you can specify both
although they are specified on two different tags (Host vs Context).  When you specify a Context
tag in server.xml, you need to specify a docBase.  You would never specify a docBase that
points to an application residing under the appBase.  That would be bad.


>>  I know docBase has to be set outside of the Host's appBase, but why would I have
two locations for WAR files?

Not sure I understand this question.  Perhaps you have multiple applications to deploy, some
are located in the appBase and some are not.

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


Mime
View raw message