From: Cristian B. <cr...@na...> - 2006-11-13 10:23:01
|
further standard preaching :) of course the standard deployment allows you do not maintain a CVS checkout on the server but simply drop a WAR file in the host root directory. one very cool thing with WAR deployment is that you can deploy remotely with a simple ant script. if something breaks, you can very easily switch back to yesterday's WAR file cristi Cristian Bogdan wrote: > Hey > > i might have told you this before: > > the current tomcat working environment made by me and Stefan a long ago > is very outdated. i know that "if it ain't broke, ain't fix it" but i > think there are limits to this. many of the things happening now in the > XML files are responding to issues of tomcat 4.0 and tomcat 4.1 that are > long gone in tomcat 5, so you can have a much more standard working env. > > some issues: > - commons.xml is really a pain, should be integrated in build.xml (this > was already done for parade2) > - dependencies on util-java are a pain, should be replaced with jar > files in WEB-INF/lib which can be CVSed with the application (like we > already do for makumba) > - there should be no copying to tomcat's common/libs. this was a hack. > the tomcat should be read-only, and easily changeable. in fact tomcat > can be started with a script like > setenv JAVA_HOME /pkg/jdk/1.5.0_01/os > setenv CATALINA_BASE . > setenv CATALINA_HOME ../apache-tomcat-5.5.16/ > setenv JAVA_OPTS -Xmx800M > ${CATALINA_HOME}bin/startup.sh > > - logging should not be done to stdout. one logging file per context (or > one family of logging files) is much better. > - logging should be done per context by simply dropping a > logging.properties in WEB-INF/classes, and not indicated in the command > line at startup like now > - contexts should not be specified by path, but simply dropped in > tomcat/webapps or whatever is defined in the tomcat <Host> directive > (the appBase attribute) in server.xml (see below) > - MakumbaDatabase.properties should not need to be altered by hand at > each CVS checkout. you can simply use > servername1#directoryname1=host_mysql_database1 > servername2#directoryname2=host_mysql_database2 > default=host_mysql_database3 > - actually makumba specifies recently a way to get the database name > from the name of the context. that may be useful as well. > - if you have more to specify about a context, you can use the file > META-INF/context.xml instead of writing in the tomcat-located > server.xml. that way, the context information "travels" and can be CVSed > with the context itself (even if its syntax remains tomcat-specific). > for example this context.xml specifies the login info to be used, and > the logging style for that context. > > <Context path="" > > <Realm className="org.apache.catalina.realm.UserDatabaseRealm" > resourceName="IplabUserDatabase"/> > > <Valve className="org.apache.catalina.valves.AccessLogValve" > directory="logs_webapp" prefix="hci_access." suffix=".log" > pattern="combined" fileDateFormat="dd-MM-yy" resolveHosts="false"/> > </Context> > > etc, etc... > > See below a minimalistic server.xml defining a number of hosts, and some > password files. Karamba and Parade only need one host but anyway. > > cristi > > <Server port="18081" shutdown="SHUTDOWN"> > > <!-- Comment these entries out to disable JMX MBeans support used for the > administration web application --> > <Listener className="org.apache.catalina.core.AprLifecycleListener" /> > <Listener > className="org.apache.catalina.mbeans.ServerLifecycleListener" /> > <Listener > className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListen > er" /> > <Listener > className="org.apache.catalina.storeconfig.StoreConfigLifecycleListe > ner"/> > > <!-- Global JNDI resources --> > <GlobalNamingResources> > > <!-- Editable user database that can also be used by > UserDatabaseRealm to authenticate users --> > <Resource name="UserDatabase" auth="Container" > type="org.apache.catalina.UserDatabase" > description="User database that can be updated and saved" > factory="org.apache.catalina.users.MemoryUserDatabaseFactory" > pathname="conf/tomcat-users.xml" /> > > <Resource name="IplabUserDatabase" auth="Container" > type="org.apache.catalina.UserDatabase" > description="User database that can be updated and saved" > factory="org.apache.catalina.users.MemoryUserDatabaseFactory" > pathname="conf/iplab-users.xml" /> > > </GlobalNamingResources> > > > <Service name="Catalina"> > > <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> > <Connector port="18080" maxHttpHeaderSize="8192" > maxThreads="150" minSpareThreads="25" maxSpareThreads="75" > enableLookups="false" redirectPort="8443" acceptCount="100" > connectionTimeout="20000" disableUploadTimeout="true" /> > <!-- Note : To disable connection timeouts, set connectionTimeout value > to 0 --> > > <!-- AJP --> > <Connector port="8089" > enableLookups="false" redirectPort="8443" debug="0" > protocol="AJP/1.3" /> > > <!-- Define the top level container in our container hierarchy --> > <Engine name="Catalina" defaultHost="localhost"> > > <!-- Define the default virtual host > Note: XML Schema validation will not work with Xerces 2.2. > --> > <!-- this is copland.nada.kth.se! --> > <Host name="localhost" appBase="webapps" > unpackWARs="true" autoDeploy="true" > xmlValidation="false" xmlNamespaceAware="false"/> > > <Host name="iplab.nada.kth.se" appBase="iplab.nada.kth.se" > unpackWARs="true" autoDeploy="true" > xmlValidation="false" xmlNamespaceAware="false"/> > > <Host name="hci.csc.kth.se" appBase="hci.csc.kth.se" > unpackWARs="true" autoDeploy="true" > xmlValidation="false" xmlNamespaceAware="false"/> > > <Host name="svenskwebb.nada.kth.se" appBase="svenskwebb.nada.kth.se" > unpackWARs="true" autoDeploy="true" > xmlValidation="false" xmlNamespaceAware="false" /> > > </Engine> > > </Service> > > </Server> > > |