I'm planing to package WAR files as RPMs. Current deployment process just doesn't work for us and my idea of fixing it would be to create a new Custom Channel in RHN Satellite and publish my WAR files through that Channel. Currently (as we are trying to win some time) I'm managing some config files through Satellite so configs are not a big problem. We don't keep them in WAR for many reasons but that's different story.
Anyway, has anyone packaged WAR as RPMs? Do you do hot deployment or do you force JBOSS/Tomcat to restart? Is that After RPM installation or as a part of it? What's your SPEC file looks like? Can I please see it as an example? Do you check in your SPEC for JBOSS/Java/Oracle client or just install WAR? Any stories to tell? Any major problems? Should I consider something else? I can build RPMs no problem but I'd like to hear what's the best way of doing this with WAR files and JBOSS (some Tomcats are still running here but they will be phased out soon-ish so I'm not too worried about them).
I do appropriate any input.
Thanks in advance Kind Regards Chris
I have packaged a WAR file and its companion config file as RPM. My SPEC file checks whether JBoss is running. If it is, the installation exits with an error message, requesting that JBoss be stopped before installation.
In general, it is not a good idea to kill processes or force restart through RPMs. The person in charge of installation should have a separate procedure for doing this.
If so, you might want to standardize on a path under which all installations on the server will go. (For example, /usr/local/bin/myorg/) It might also help to have a custom *nix user and group, for which file attributes are set for all installations on the server.
Is there ever a chance that you might want to change the default path for your installation? If so, a relocatable RPM will help. There are conditions where a relocatable RPM may not work, so check out these things to consider at www.rpm.org.
If so, you would need to write that code in your SPEC file.
Summary: Summary for my Java project
Name: Name for my Java project
Version: 2.1.2
Release: 5
Requires: jboss >= 5.1
BuildArch: noarch
Group: Internet / Applications
Prefix: /usr/local/bin
License: (C) Copyright my organization
Vendor: my organization
%description
Description for my Java project
%prep
# Check if the WAR file has been created
%install
# Copy war file to buildroot's Jboss deployment directory
# Copy config file to buildroot's Jboss config directory
%files
# Set file permissions and ownership
%pre
# Check if JBoss deployment path exists on the web server.
# If not, exit with an error.
# Check if JBoss config file path exists on the web server.
# If not, exit with an error.
# Check if custom user 'myuser' exists. If not, exit with an error.
# Check if custom group 'mygroup' exists. If not, exit with an error
# Check if JBOSS is running. If yes, exit with an error.
# Take backup of existing deployment, if needed.
%post
# Perform post-installation steps, if needed.
echo "Installation complete."
We plan to somehow standardize Java webapp installation on Fedora, but there is nothing yet. Debian guys created a rather nice proposal http://dep.debian.net/deps/dep7 which you should probably read to get an idea what you'd have to deal with more or less.
As for JBoss/Tomcat restart, I would advise against it. Leave it to the system (webserver) administrator. They should know what they are updating and why. Forcing restart of webserver all the time is asking for trouble IMO (especially if one server is hosting multiple webapps)
I would put the wars in /usr/share/webapps-java. Then probably have JBoss/Tomcat use that directory. That said, no spec files, sorry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With