Multiple tomcat instances

Bug #207787 reported by Brian Pontarelli
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat5.5 (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Binary package hint: tomcat5.5

This is an enhancement. I have written some scripts that change the standard debian/Ubuntu tomcat packages to allow multiple tomcat instances on a single system. They provide the following features:

- Setup system to allow multiple instances
- Provide scripts to creating and removing instances including init.d scripts and configuration

I've posted these on my blog and a lot of folks have been using them. I think it would be great if we could roll these back into the standard distribution. I couldn't figure out who was the upstream-debian maintainer, so I figured I would submit an issue here and we could pull them in as we go.

I'll attach my files to the issue so you can start looking them over. They will need some work, but for the most part they are fully functional.

Revision history for this message
Thierry Carrez (ttx) wrote :

The new Tomcat 6 packages in intrepid support private instances in addition to the system instance through the tomcat6-user package. See http://ubuntuserver.wordpress.com/2008/09/01/tomcat-6-lands-in-intrepid

Not sure we'll try to do the same for tomcat5.5.

Changed in tomcat5.5:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Brian Pontarelli (brian-pontarelli) wrote :

This sorta covers the case, but not entirely. This creates instances for developers. My scripts and solution create multiple instances on servers. Often companies run multiple instances of Tomcat on a server to scale things up and also run different webapps on a single server in separate Tomcat instances. In order to use this solution in the same manner, I'd have to create multiple users on the server and then setup instances for each user. Your solution will work as long as it provides init scripts for each user Tomcat instance. Otherwise, it is not the same solution and won't work on servers.

Revision history for this message
Thierry Carrez (ttx) wrote :

I agree the tomcat6-user package covers a different use case. Feel free to attach your files so that we can review them.

Revision history for this message
Brian Pontarelli (brian-pontarelli) wrote :

You can check them out from my Google code project here:

svn checkout http://debian-tomcat-scripts.googlecode.com/svn/trunk/ debian-tomcat-scripts-read-only

Or visit the project page at:

http://code.google.com/p/debian-tomcat-scripts

Revision history for this message
born2chill (david-gabriel) wrote :

Hi there,

seem to lots of use cases out there... here are my two cents to the multi-instance tomcat5.5 thingy.

skel- files, little reworked init-script and a create-instance script that accepts options for ports, ip and some java-opts. drop the contents of the zipfile to /usr/local/bin, then

unzip tomcat5.5_instance.zip
mv tomcat5.5_start_instance /etc/init.d

view options:
./tomcat5.5_new_instance.sh -h

it will create a new tomcat instance with its own init script and catalina_base, log and work folders, so no cluttering up the system. it also has an option to remove instances if they are no longer used. needs just tomcat5.5 and a java-jdk, will re-use the /usr/share/tomcat5.5-libs.

example:
./tomcat_new_instance.sh -C -I test -i 10.205.30.113 -j /usr/lib/jvm/java-1.5.0-sun -a 8010 -p 8181 -s 8006 -x 128 -y 1024 -z 256

would create an instance, using sun's java 1.5, binding to ip 10.205.30.113 with ajp on 8010, http on 8181 and shutdownport on 8006, setting Xms memory to 128m, Xmx to 1024 and max permissionsize to 256m.

./tomcat_new_instance.sh -D -I test
would remove the above instance.

br,
David

Revision history for this message
Brian Pontarelli (brian-pontarelli) wrote :

David,

Great suggestions. I've actually abandoned the Tomcat 5.5 project and I've also stopped using all of the Tomcat packages in the repositories. The Tomcat packages in the repository are completely invalid. If you download Tomcat from Apache and compare it to the Tomcat from the repository packages, they contain different JAR files and this causes major issues with some applications. Tomcat specifically repackages certain libraries from Apache Commons to avoid naming and version conflicts. The Tomcat packages from the repositories use the Apache Commons libraries instead and this is incorrect.

Rather than continue using Tomcat 5.5 and keeping my scripts up to date, I've written a new set of packages for Tomcat 6 that do a number of things differently.

  - First, they install a correct version of Tomcat that is identical to the version downloaded from Apache

  - Second, it provides a very clean install that makes it much simpler to update. My previous scripts assumed you were installing the packages from the repositories and then really moved things around. This caused major issues with updates.

  - Third, the new packages are completely based on multiple instances. This is much better because it can support a single instance or multiple instances without any issues.

  - I use much more standard locations for everything now.

Here's the thread over at the forums about these new packages:

    http://ubuntuforums.org/showthread.php?t=1211517

I'd like to see this packages incorporated into the main repositories once they are cleaned up some. I love the options you have added to your new_instance scripts and would welcome your assistance with adding those to my packages. I much prefer using a separate script for removing instances to reduce confusion. However, if the script was named tomcat6_manager.sh or something like that, it would be okay. 2 scripts still seems better though.

Revision history for this message
born2chill (david-gabriel) wrote :

Hi again,

thx for your comments, greatly appreciated. At my company we mainly use standard packages and this script builds upon them, however i was not aware of neither the broken state of tomcat5.5 nor the thread you pointed out above. Thanks for that.

No, it is no problem to rename the script or even split it into create/delete. Actually it was only supposed to create instances and be done, but well things tend to grow... I was actually going to rework it for tomcat6 and the upcoming 10.04 'lucid' LTS release, as we will use that in the foreseeable future.

As we deploy servers via puppet ( http://reductivelabs.com/trac/puppet/wiki/AboutPuppet check it out, it's cool! ;), the script has all the options it needs so we can automatically deploy and start a complete instance. Also, you need 'root'-rights to operate it in opposite to the scripts in the tomcat-user package. If you look at the reworked init script, you'll notice that it is only to be called via symlinks; It determines via the symlink's name what instance it should handle, so i'm not sure if this is possible with your new init scripts. However i like the idea as it gives the whole thing some consistency: all the folders (catalina_base, log, config...) and the initscript share the instances name. This makes server handling more easily in large environments imho, but we'll probably have to work out some 'golden middle' solution that won't interfere with all the work you've already done.

I'll take a look at your packages when i'm back at the company on monday. The packages you provide are not the same as those coming with standard ubuntu repos right now i suppose?

br & thx,
David

Revision history for this message
Brian Pontarelli (brian-pontarelli) wrote :

I was using the same method for my init scripts via symlinks and I changed it to a real file because I found myself tweaking the scripts quite a bit and modifying the parameters and options for each instance. This could still be done by sourcing additional scripts for each instance, but that's somewhat counter-intuitive for the next person coming along. It is definitely something we could discuss.

Let me know when you check out the new Tomcat6 packages and how you want to proceed. There is very little from the Ubuntu and Debian folks, so I figure we should just charge forward for now. Also, Redhat, Fedora, and CentOS all have the same issues with their Tomcat distributions and it might be nice to roll RPMs as well at some point.

Revision history for this message
born2chill (david-gabriel) wrote :

hi,

as a start i repackaged tomcat6 for 8.04 LTS, starting from the jaunty package and using the apache source files from tomcat 6.0.20. Please consider this post on the forums:
http://ubuntuforums.org/showpost.php?p=8066371&postcount=4

also the new packages are up for grabs here:
http://aegis.dest-unreachable.net/debs/tomcat/

how do we want to continue the multi instance effort?

br,
David

Revision history for this message
Brian Pontarelli (brian-pontarelli) wrote : Re: [Bug 207787] Re: Multiple tomcat instances

I replied to your thread post. I don't think a source build is a good
idea. Check out my reply and we can continue discussions from there.
I'll also work on the Google code project for the entire thing at some
point this week.

-bp

On Oct 7, 2009, at 6:38 AM, born2chill wrote:

> hi,
>
> as a start i repackaged tomcat6 for 8.04 LTS, starting from the
> jaunty package and using the apache source files from tomcat 6.0.20.
> Please consider this post on the forums:
> http://ubuntuforums.org/showpost.php?p=8066371&postcount=4
>
> also the new packages are up for grabs here:
> http://aegis.dest-unreachable.net/debs/tomcat/
>
> how do we want to continue the multi instance effort?
>
> br,
> David
>
> --
> Multiple tomcat instances
> https://bugs.launchpad.net/bugs/207787
> You received this bug notification because you are a direct subscriber
> of the bug.

Revision history for this message
born2chill (david-gabriel) wrote :

hi,

updated the forums posts too. binary packages ready for download now.

br,
David

Revision history for this message
Communism and Socialism (sandeepbhandari1) wrote :

I have written a Java based portable utility for automating the above steps for <a href="http://www.javaexperience.com/run-multiple-tomcat-instances/">creating multiple instances</a>. Since Java is platform independent, this utility works on all operating systems

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.