We use a variation of this approach in most of our projects, by taking advantage of the PropertyOverrideConfigurer���s behavior:
- This configurer was designed so that you can have multiple PropertyOverrideConfigurer that load different files, even if they have the same properties. If a variable is defined/loaded multiple times, the definition from the last configurer is the one used. - So, we define identical properties files for each environment, and load them in order of finality (PROD first, DEV last). - We use ignoreResourceNotFound =����tr����� so that missing properties files don���t cause problems. The result is: - In version control and DEV environments we have all of the properties files, allowing us to work and prepare them for all environments. But only the DEV configuration gets use����� because its property configurer is the last one. - When deploying to other environments we simply d�����t deploy unnecessary properties files. For example, in PROD we only deploy the PROD properties file. The missing files are ignored, and the app behaves as PRO����� with no fuss. - We never have to modify the app, context or even property files during deployment. From: [email protected] [mailto:[email protected]] On Behalf Of Eric Pierce Sent: Monday, August 10, 2009 7:56 PM To: [email protected] Subject: Re: [cas-user] Best practice for upgrading I'm using PropertyOverrideConfigurer and an external config file to configure the servers. I added the following bean to deployerConfigContext.xml and auditTrailContext: <bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer" p:location="file:/usr/local/etc/cas-connection.properties" p:ignoreResourceNotFound="false" /> And then all of the configuration in the rest of the file is generic -- I've got all of the config options that are the same across all my servers (search filters, baseDN, etc) but all of the connection parameters are blank. Then /usr/local/etc/cas-connection.properties has all of the server-specific info: contextSource.urls=ldap://localhost:389,ldap://example.edu:389<http://example.edu:389> contextSource.userDn=uid=admin,o=example.edu<http://example.edu> contextSource.password=secret ServicesdataSource.driverClassName=com.mysql.jdbc.Driver ServicesdataSource.url=jdbc:mysql://localhost:3306/cas?autoReconnect=true ServicesdataSource.username=root ServicesdataSource.password=secret AuditDataSource.driverClassName=com.mysql.jdbc.Driver AuditDataSource.url=jdbc:mysql://localhost:3306/audit?autoReconnect=true AuditDataSource.username=root AuditDataSource.password=secret Eric Pierce, RHCE -- University of South Florida -- (813) 974-8868 -- [email protected]<mailto:[email protected]> On Mon, Aug 10, 2009 at 11:43 AM, Andrew Feller <[email protected]<mailto:[email protected]>> wrote: > > Eric, > > Thanks for taking the time with that response; most helpful. > > The only thing that I can think of is that I would like to include custom > code for all of my CAS servers, however I need to include different versions > of particular configuration files depending on the server. My test servers > use different Memcached configurations than my production servers do, etc. > > Do you have any thoughts on how this should be handled? > > Thanks once again, > A- > > > > On 8/10/09 10:04 AM, "Eric Pierce" <[email protected]<mailto:[email protected]>> > wrote: > > > It works fine with pre-compiled JARs and source files. If you have > > JAR files you need to include, just create a > > 'src/main/webapp/WEB-INF/lib' directory in your overlay directory and > > drop the jars in. > > > > Overlay setup instructions are here: > > http://www.ja-sig.org/wiki/display/CASUM/Maintaining+local+customizations+usin > > g+Maven+2 > > > > Maven is an incredible time saver. When a new version of CAS comes > > out, all I need to do is change the version numbers in pom.xml and > > rebuild the project on my dev. server. I can quickly test our local > > modifications to make sure nothing broke with the upgrade, fix > > anything that did break and push the changes (including the pom.xml) > > into my SVN repo. Then upgrading production is easy as: > > > > svn co https://www.ja-sig.org/svn/cas3/tags/cas-3-3-3-final/ > > cd cas-3-3-3-final > > mvn clean package install > > svn co https://dev.usf.edu/svn/CAS/3-3-3/cas-server-usf > > cd cas-server-usf > > mvn clean package install > > > > The WAR file is now in 'cas-server-usf/target' and is ready to be > > deployed. You can even configure Maven to deploy the WAR for you, but > > I haven't gotten that fancy with it :) > > > > -Eric > > > > Eric Pierce, RHCE -- University of South Florida -- (813) 974-8868 > > -- [email protected]<mailto:[email protected]> > > > > > > > > On Mon, Aug 10, 2009 at 10:38 AM, Andrew > > Feller<[email protected]<mailto:[email protected]>> wrote: > >> Scott, > >> > >> I must admit I am ignorant about the overlay method. Does this only work > >> with pre-compiled code (JARs) or will it also compile code against CAS > >> source pulled in the pom.xml? > >> > >> Thanks, > >> A- > >> > >> On 8/10/09 8:58 AM, "Scott Battaglia" > >> <[email protected]<mailto:[email protected]>> wrote: > >> > >> Our recommendation is always to use the Maven2 WAR Overlay method which > >> keeps your code and configuration separate from the main distribution. > >> > >> > >> > >> On Mon, Aug 10, 2009 at 8:17 AM, Matthias Debus > >> <[email protected]<mailto:[email protected]>> > >> wrote: > >> > >> Hi all, > >> > >> I'm quite new to both Tomcat and CAS-Server but I got everything to work. > >> > >> Now, I'm quite unsure how to upgrade to the recent version (3.3.3). Is > >> there any information on this? Do I have to build a new .war file? > >> > >> We're also using Alfresco which stores it's configuration outside the > >> webapps tree, so that you can safely upgrade. Is this also possible > >> with CAS? > >> > >> TIA! > >> > >> Greets, > >> Matthias. > >> > >> -- > >> You are currently subscribed to > >> [email protected]<mailto:[email protected]> as: > >> [email protected]<mailto:[email protected]> > >> To unsubscribe, change settings or access archives, see > >> http://www.ja-sig.org/wiki/display/JSG/cas-user > >> > >> -- > >> Andrew Feller, Business System Programmer > >> LSU University Information Services > >> 200 Frey Computing Services Center > >> Baton Rouge, LA 70803 > >> Office: 225.578.3737 > >> Fax: 225.578.6400 > >> > >> -- > >> You are currently subscribed to > >> [email protected]<mailto:[email protected]> as: > >> [email protected]<mailto:[email protected]> > >> To unsubscribe, change settings or access archives, see > >> http://www.ja-sig.org/wiki/display/JSG/cas-user > > -- > Andrew Feller, Business System Programmer > LSU University Information Services > 200 Frey Computing Services Center > Baton Rouge, LA 70803 > Office: 225.578.3737 > Fax: 225.578.6400 > > > > -- > You are currently subscribed to > [email protected]<mailto:[email protected]> as: > [email protected]<mailto:[email protected]> > To unsubscribe, change settings or access archives, see > http://www.ja-sig.org/wiki/display/JSG/cas-user > -- 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 -- 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
