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:

  1. wipe tmp directory
  2. compile project tmp directory
  3. copy template property file merging in properties
  4. wrap tmp folder war_for_us.war
  5. copy war_for_us.war in tomcat webapps directory
  6. copy template property file merging in eu properties
  7. wrap tmp folder war_for_eu.war
  8. 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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -