Tomcat + managing properties files -
we have 1 tomcat server running 2 webapps; 1 sites, , webapp eu. have functionally partitioned app & db along these lines; 1 logical instance running site, , eu site.
currently, our release process follows: - deploy 2 identical war's on tomcat, except before re-starting tomcat change properties file identify us, or eu webapp
what we'd automate whole process. i'd deploy 2 wars, without modifying properties files without changing build scripts much. suggestions how remove manual step?
if using ant build script can use filterset
feature of copy
command set properties. need:
- a template property file
- two property files (one each webapp)
your template file:
... locale = @deploy.locale@ other.stuff.int = 123 other.stuff.string = test string ...
(note @deploy.locale@
placeholder)
your property file:
... deploy.locale = ...
you eu property file:
... deploy.locale = eu ....
in ant build file can:
- wipe tmp directory
- compile project tmp directory
- copy template property file merging in properties
- wrap tmp folder war_for_us.war
- copy war_for_us.war in tomcat webapps directory
- copy template property file merging in eu properties
- wrap tmp folder war_for_eu.war
- copy war_for_eu.war in tomcat webapps directory
you can stop & start tomcat in build script. here's how copy template:
<copy todir="${tmp.dir}" overwrite="true"> <fileset dir="templates"> <include name="template.properties" /> </fileset> <filterset filtersfile="us.properties" /> </copy> ... <copy todir="${tmp.dir}" overwrite="true"> <fileset dir="templates"> <include name="template.properties" /> </fileset> <filterset filtersfile="eu.properties" /> </copy>
see this post other ant deploy tips.
Comments
Post a Comment