Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Configuration management of JBoss files

 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've worked on many web applications deployed to various app servers, and so far haven't really found an ideal way to push out changes to server configuration files that fall outside the ears, wars, jars or whatever, which we deploy through the normal build process. JBoss, in particular, has dozens of XML files distributed throughout server/default/conf and server/default/deploy that can be tweaked to enable features and improve performance. At the moment we just push these out to the other developers on an ad hoc, which, even though it's rarely necessary, is still a big PITA.

I'm interested how others are handling it. Do you put the entire server/default/deploy (less your deployed artifacts) and server/default/conf directories into source control, or just XML files, or just files that vary from the default distro?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I store only the modified config files in source control. And my Ant build script deploys the config files along with the app.
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good advice, and that's probably what we'll do. A few more questions though:

I often modify my jboss-log4j.xml locally to see some more or less logging in areas I'm interested in. It would be annoying if my local changes got wiped out every time I did a build. Do you just change that file in the project and then be careful not to check it in?

We have SSL enabled, and so need a keystore with a self-signed certificate. Do you put that in source code control? The domain name actually has to go into the cert. It can be localhost for all us developers, but on the shared server, it actually must contain the IP address. How have you solved that?

How about other files that may have a dev version and a production version?

Recently I disabled the JBoss root application by taking index.html away from the ROOT.war and replacing it with a 404.jsp. How do you distribute changes that require file deletions? Probably by updating your build's clean target, right?

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I would use Mercurial or Git and create the local repository in the conf directory.

2) I don't need ssl for what I have been doing. But I would store the cert in source control. In the cert I would place an expression such as ${domain.name} into the cert and then use a Ant (or Maven) build to replace that with the proper name.

3) Same as #2. Check out the ch00/src/main/db/jbia-ds.xml file that is part of the source code for JBoss in Action. I use this one file for all of the *-ds.xml files for the book - different datasource names and different database (mysql and posgresql). Both Ant and Maven are very good at this sort of thing. All deployment-specific information should be templated and applied via properties at build/deploy time.

4) I usually do that as part of my app server setup target. Look at how I set up the Ant script for the book. Essentially, you start with the JBoss AS zip file. The script extract the base files (everything except server/xxx) in one step, and then extracts 'default' (or 'all') as xxx, and then does some post processing to fix things up within server/xxx. That is the point at which I would replace the index.html with 404.jsp.
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter! That's very helpful, as your book has been. Our build uses Maven instead of Ant, which I don't understand as well, and so that's part of what I'm struggling with. One point I'm still confused on: the "cert" as I understand it is a binary file, so is it even possible to put a token like ${domain.name} in it? Also, to be useful, the cert has to be added into the trust store. I'll check into your Ant builds and see if I can figure out how you're handling that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic