16990382 allow multiple Tomcat instances to be run
authorPetr Sumbera <petr.sumbera@oracle.com>
Wed, 10 Jul 2013 01:44:35 -0700
changeset 1386 4e8ea821eb75
parent 1385 089964dc63d0
child 1387 6df6087cb5b9
16990382 allow multiple Tomcat instances to be run
components/tomcat/Solaris/http-tomcat6
components/tomcat/Solaris/tomcat.1m
components/tomcat/patches/env.patch
--- a/components/tomcat/Solaris/http-tomcat6	Tue Jul 09 21:40:08 2013 -0700
+++ b/components/tomcat/Solaris/http-tomcat6	Wed Jul 10 01:44:35 2013 -0700
@@ -27,7 +27,9 @@
 . /lib/svc/share/smf_include.sh
 
 CATALINA_HOME=/usr/tomcat6
-CATALINA_BASE=/var/tomcat6
+# We allow CATALINA_BASE setting from environment so that we can support
+# multiple Tomcat instances.
+CATALINA_BASE=${CATALINA_BASE:-/var/tomcat6}
 CATALINA_PID=$CATALINA_BASE/logs/pid
 JAVA_HOME=/usr/jdk/instances/jdk1.7.0
 export CATALINA_HOME CATALINA_BASE CATALINA_PID JAVA_HOME
--- a/components/tomcat/Solaris/tomcat.1m	Tue Jul 09 21:40:08 2013 -0700
+++ b/components/tomcat/Solaris/tomcat.1m	Wed Jul 10 01:44:35 2013 -0700
@@ -1,6 +1,6 @@
 '\" te
-.\" Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
-.TH tomcat 1M "April 2012" "SunOS 5.11" "System Administration Commands"
+.\" Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+.TH tomcat 1M "June 2013" "SunOS 5.12" "System Administration Commands"
 .SH NAME
 tomcat \- Apache Tomcat Version 6 overview
 .SH DESCRIPTION
@@ -29,6 +29,10 @@
 variable to path with his or her conf/, webapp/ and logs/ subdirectories
 (see Tomcat directory structure bellow).
 .sp
+Similarly it's possible to run multiple SMF Tomcat instances by setting
+CATALINA_BASE for both start and stop methods for newly created Tomcat
+FMRI.
+.sp
 .LP
 .SH FILES
 .sp
--- a/components/tomcat/patches/env.patch	Tue Jul 09 21:40:08 2013 -0700
+++ b/components/tomcat/patches/env.patch	Wed Jul 10 01:44:35 2013 -0700
@@ -1,5 +1,5 @@
---- apache-tomcat-6.0.35-src/bin/catalina.sh	Mon Nov 28 02:22:44 2011
-+++ apache-tomcat-6.0.35-src/bin/catalina.sh	Mon Apr 16 08:42:47 2012
+--- apache-tomcat-6.0.37-src/bin/catalina.sh	Mon Apr 29 02:36:52 2013
++++ apache-tomcat-6.0.37-src/bin/catalina.sh	Thu Jun 13 05:37:46 2013
 @@ -92,6 +92,7 @@
  CYGWIN*) cygwin=true;;
  OS400*) os400=true;;
@@ -8,29 +8,22 @@
  esac
  
  # resolve links - $0 may be a softlink
[email protected]@ -120,8 +121,19 @@
[email protected]@ -120,7 +121,13 @@
  # but allow them to be specified in setenv.sh, in rare case when it is needed.
  CLASSPATH=
  
 -if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
--  . "$CATALINA_BASE/bin/setenv.sh"
-+# On Solaris we want to allow running system Tomcat instance (where
-+# setenv.sh file is located in /var/tomcat6/conf) in parallel to Tomcat
-+# instances started by individual users. As it's expected that all will
-+# use the same copy of catalina.sh some extra logic needs to be added
-+# here:
-+if [ "$CATALINA_BASE" = "/var/tomcat6" ]; then
-+  SETENVDIR="conf"
-+else
-+  SETENVDIR="bin"
-+fi
-+
-+if [ -r "$CATALINA_BASE/$SETENVDIR/setenv.sh" ]; then
-+  . "$CATALINA_BASE/$SETENVDIR/setenv.sh"
++# On Solaris we install Tomcat into two different locations
++# (CATALINA_HOME, CATALINA_BASE). CATALINA_HOME can be on read only
++# location and CATALINA_BASE doesn't contain bin directory. Therefore we
++# will look for setenv.sh file in CATALINA_BASE/conf directory first.
++if [ -r "$CATALINA_BASE/conf/setenv.sh" ]; then
++  . "$CATALINA_BASE/conf/setenv.sh"
++elif [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
+   . "$CATALINA_BASE/bin/setenv.sh"
  elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
    . "$CATALINA_HOME/bin/setenv.sh"
- fi
[email protected]@ -147,6 +159,11 @@
[email protected]@ -147,6 +154,11 @@
    export QIBM_MULTI_THREADED=Y
  fi
  
@@ -42,8 +35,8 @@
  # Get standard Java environment variables
  if $os400; then
    # -r will Only work on the os400 if the files are:
---- apache-tomcat-6.0.35-src/bin/tool-wrapper.sh	Mon Nov 28 02:22:44 2011
-+++ apache-tomcat-6.0.35-src/bin/tool-wrapper.sh	Mon Apr 16 08:42:57 2012
+--- apache-tomcat-6.0.37-src/bin/tool-wrapper.sh	Mon Apr 29 02:36:52 2013
++++ apache-tomcat-6.0.37-src/bin/tool-wrapper.sh	Thu Jun 13 05:55:06 2013
 @@ -35,8 +35,10 @@
  
  # OS specific support.  $var _must_ be set to either true or false.
@@ -55,33 +48,26 @@
  esac
  
  # resolve links - $0 may be a softlink
[email protected]@ -60,10 +62,23 @@
[email protected]@ -60,8 +62,16 @@
  # but allow them to be specified in setenv.sh, in rare case when it is needed.
  CLASSPATH=
  
 -if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
 -  . "$CATALINA_HOME"/bin/setenv.sh
-+# On Solaris we want to allow running system Tomcat instance (where
-+# setenv.sh file is located in /var/tomcat6/conf) in parallel to Tomcat
-+# instances started by individual users. As it's expected that all will
-+# use the same copy of catalina.sh some extra logic needs to be added
-+# here:
-+if [ "$CATALINA_BASE" = "/var/tomcat6" ]; then
-+  SETENVDIR="conf"
-+else
-+  SETENVDIR="bin"
++# On Solaris we install Tomcat into two different locations
++# (CATALINA_HOME, CATALINA_BASE). CATALINA_HOME can be on read only
++# location and CATALINA_BASE doesn't contain bin directory. Therefore we
++# will look for setenv.sh file in CATALINA_BASE/conf directory first.
++if [ -r "$CATALINA_BASE/conf/setenv.sh" ]; then
++  . "$CATALINA_BASE/conf/setenv.sh"
++elif [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
++  . "$CATALINA_BASE/bin/setenv.sh"
++elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
++  . "$CATALINA_HOME/bin/setenv.sh"
  fi
  
-+if [ -r "$CATALINA_BASE/$SETENVDIR/setenv.sh" ]; then
-+  . "$CATALINA_BASE/$SETENVDIR/setenv.sh"
-+elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
-+  . "$CATALINA_HOME/bin/setenv.sh"
-+fi
-+
  # For Cygwin, ensure paths are in UNIX format before anything is touched
- if $cygwin; then
-   [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[email protected]@ -71,6 +86,11 @@
[email protected]@ -71,6 +81,11 @@
    [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
  fi