We do a lot of deployments of Java web applications to Weblogic and Jboss servers. Quite often the deployment looks like this:
-
Copy the code and default configs to a staging directory on the application server or Weblogic admin server.
-
Edit a properties file to set environment-specific variables (IP addresses, usernames, etc.)
-
Run ant to create the ear/war and drop it in the appropriate directory.
-
Start services
This has proven to be a very unfriendly set of steps to use with Puppet as our configuration management tool. We would prefer a process which is much more similar to the Package, File, Service trifecta of Puppet, but having to configure the properties before building the ear/war makes this difficult because it requires an extra step to build the war/ear on the host after the properties have been populated.
Is there a way to build a war/ear which is environment-agnostic and keep the configurations external, removing the extra build step?
Has anyone specifically worked with web applications and Puppet, and do you have any recommendations?
What I’ve done with tomcat and .war webapps is build a system package with an unzipped war and then deal with the conf files. I haven’t dealt with Weblogic much or JBoss at all, so I don’t know how it deals with unzipped WAR stuff.
1) Build a package (RPM) where I do all the .war building stuff, then something like:
(so that the unzipped .war file is in the package with no actual .war file in there. With tomcat it will then leave that directory alone, especially if it doesn’t have write access because the files belong to root)
2) Puppet stuff somewhat like:
This particular package has 32 files in 8 directories that we’re modifying or pushing out to configure it. If it was just a few files, I’d use a couple simple
file{}resources to manage those files instead of the recursive stuff.If you didn’t want to build a system type package, you could do a
file{}resource for the war into an alternate directory, anexec{"unzip ...": creates => '/path/to/unzipped/webapp;}and have thefile{}resources for configuration require theExec["unzip ..."].