> I'm looking for a bit
> of advice on how to best handle deploying different configurations to
> different systems.
> A) Maintain a single code tree, and script the heck out of everything.
> B) Use parallel code branches for each deployment target, with simpler
> scripts.

If you're like most dev/pprd/prod environments, your configurations
only differ in hostnames and credentials.  Why invest in build/deploy
complexity when you can simply factor out the
host/environment-specific data to something external to the build,
e.g. properties file on filesystem, and use a single build tree.  This
strategy works exceedingly well for us where I manage 6 virtual hosts
in 3 different environments.  Deployment consists of dropping a single
WAR deployable on the filesystem and a Tomcat restart to be safe.
This avoids the "which version did I just deploy" problem since the
deployable contains no environment-specific data.  Additionally, it
keeps the build and deployment complexity low.

The cornerstone of our solution is to use
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html,
which allows us to factor out host and environment-specific properties
to a single properties file.  Placeholders are used in the Spring
configuration, for example:

  <bean
    id="dataSource"
    class="com.mchange.v2.c3p0.ComboPooledDataSource"
    p:driverClass="${database.driverClass}"
    p:jdbcUrl="${database.url}"
    p:user="${database.user}"
    p:password="${database.password}"
    p:initialPoolSize="${database.pool.minSize}"
    p:minPoolSize="${database.pool.minSize}"
    p:maxPoolSize="${database.pool.maxSize}"
    p:maxIdleTimeExcessConnections="${database.pool.maxIdleTime}"
    p:checkoutTimeout="${database.pool.maxWait}"
    p:acquireIncrement="${database.pool.acquireIncrement}"
    p:acquireRetryAttempts="${database.pool.acquireRetryAttempts}"
    p:acquireRetryDelay="${database.pool.acquireRetryDelay}"
    p:idleConnectionTestPeriod="${database.pool.idleConnectionTestPeriod}"
    p:preferredTestQuery="${database.pool.connectionHealthQuery}"
  />

M

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to