BIGTOP-1070. Add BIGTOP_CLASSPATH functionality to tomcat deployment
authorSean Mackrory <mackrorysd@gmail.com>
Thu, 17 Oct 2013 22:27:05 +0000 (15:27 -0700)
committerSean Mackrory <mackrorysd@gmail.com>
Thu, 17 Oct 2013 22:27:05 +0000 (15:27 -0700)
bigtop-packages/src/common/oozie/catalina.properties
bigtop-packages/src/common/oozie/install_oozie.sh
bigtop-packages/src/common/oozie/oozie.init
bigtop-packages/src/common/sqoop/catalina.properties
bigtop-packages/src/common/sqoop/sqoop-server.sh
bigtop-packages/src/deb/oozie/oozie.postinst
bigtop-packages/src/deb/oozie/oozie.prerm
bigtop-packages/src/deb/oozie/rules
bigtop-packages/src/rpm/oozie/SPECS/oozie.spec

index 6fd5d14..21d7acb 100755 (executable)
@@ -44,7 +44,7 @@ package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache
 #     "foo/*.jar": Add all the JARs of the specified folder as class 
 #                  repositories
 #     "foo/bar.jar": Add bar.jar as a class repository
-common.loader=/var/lib/oozie/*.jar,/usr/lib/hadoop/client/*.jar,/usr/lib/oozie/libserver/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/bigtop/*.jar
+common.loader=/var/lib/oozie/*.jar,/usr/lib/hadoop/client/*.jar,/usr/lib/oozie/libserver/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
 
 #
 # List of comma-separated paths defining the contents of the "server" 
index 8ccdc43..1f769a0 100755 (executable)
@@ -181,17 +181,21 @@ mkdir ${WEBAPP_DIR}
 mv -f ${WEBAPP_DIR}/WEB-INF/lib ${SERVER_LIB_DIR}/libserver
 touch ${SERVER_LIB_DIR}/webapps/oozie.war
 
-DEFAULT_DIRECTORY=${CONF_DIR}/tomcat-deployment.default
-install -d -m 0755 ${DEFAULT_DIRECTORY}
-cp -R ${BUILD_DIR}/oozie-server/conf ${DEFAULT_DIRECTORY}/conf
-cp ${EXTRA_DIR}/context.xml ${DEFAULT_DIRECTORY}/conf/
-cp ${EXTRA_DIR}/catalina.properties ${DEFAULT_DIRECTORY}/conf/
-mv ${SERVER_LIB_DIR}/webapps/oozie/WEB-INF ${DEFAULT_DIRECTORY}/WEB-INF
-
-SECURE_DIRECTORY=${CONF_DIR}/tomcat-deployment.secure
-cp -r ${DEFAULT_DIRECTORY} ${SECURE_DIRECTORY}
-cp ${SECURE_DIRECTORY}/conf/ssl/ssl-server.xml ${SECURE_DIRECTORY}/conf/server.xml
-cp ${BUILD_DIR}/oozie-server/conf/ssl/ssl-web.xml ${SECURE_DIRECTORY}/WEB-INF/web.xml
+HTTP_DIRECTORY=${CONF_DIR}/tomcat-deployment.http
+install -d -m 0755 ${HTTP_DIRECTORY}
+cp -R ${BUILD_DIR}/oozie-server/conf ${HTTP_DIRECTORY}/conf
+cp ${EXTRA_DIR}/context.xml ${HTTP_DIRECTORY}/conf/
+cp ${EXTRA_DIR}/catalina.properties ${HTTP_DIRECTORY}/conf/
+mv ${SERVER_LIB_DIR}/webapps/oozie/WEB-INF ${HTTP_DIRECTORY}/WEB-INF
+
+HTTPS_DIRECTORY=${CONF_DIR}/tomcat-deployment.https
+cp -r ${HTTP_DIRECTORY} ${HTTPS_DIRECTORY}
+cp ${HTTPS_DIRECTORY}/conf/ssl/ssl-server.xml ${HTTPS_DIRECTORY}/conf/server.xml
+cp ${BUILD_DIR}/oozie-server/conf/ssl/ssl-web.xml ${HTTPS_DIRECTORY}/WEB-INF/web.xml
+
+ln -s /usr/lib/oozie/webapps ${CONF_DIR}/tomcat-deployment.http/
+ln -s /usr/lib/oozie/webapps ${CONF_DIR}/tomcat-deployment.https/
+ln -s /var/lib/oozie/tomcat-deployment/WEB-INF ${SERVER_LIB_DIR}/webapps/oozie/
 
 # Create all the jars needed for tools execution
 install -d -m 0755 ${SERVER_LIB_DIR}/libtools
index 321c4e6..56111d1 100644 (file)
@@ -33,6 +33,7 @@
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome
+. /usr/lib/bigtop-utils/bigtop-detect-classpath
 
 is_oozie_alive() {
   if [ ! -f "$OOZIE_PID" ]; then
@@ -53,6 +54,11 @@ tomcat_deployment() {
 
   rm -rf ${DEPLOYMENT_TARGET}
   cp -r ${DEPLOYMENT_SOURCE} ${DEPLOYMENT_TARGET}
+
+  if [ -n "${BIGTOP_CLASSPATH}" ] ; then
+    sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${DEPLOYMENT_TARGET}/conf/catalina.properties
+  fi
+
   chown -R oozie:oozie ${DEPLOYMENT_TARGET}
 }
 
index 2cd6138..9db1e56 100644 (file)
@@ -44,7 +44,7 @@ package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache
 #     "foo/*.jar": Add all the JARs of the specified folder as class
 #                  repositories
 #     "foo/bar.jar": Add bar.jar as a class repository
-common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/sqoop/*.jar,/usr/lib/hadoop/client/*.jar,/var/lib/bigtop/*.jar
+common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/sqoop/*.jar,/usr/lib/hadoop/client/*.jar
 #
 # List of comma-separated paths defining the contents of the "server"
 # classloader. Prefixes should be used to define what is the repository type.
index 7124dc6..59f6a5d 100644 (file)
@@ -23,11 +23,17 @@ tomcat_deployment() {
   cp -r ${DEPLOYMENT_SOURCE} ${DEPLOYMENT_TARGET}
   ln -s ${SQOOP_HOME}/webapps ${DEPLOYMENT_TARGET}/
   ln -s ${SQOOP_HOME}/bin ${DEPLOYMENT_TARGET}/
+
+  if [ -n "${BIGTOP_CLASSPATH}" ] ; then
+    sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${DEPLOYMENT_TARGET}/conf/catalina.properties
+  fi
+
   chown -R sqoop:sqoop ${DEPLOYMENT_TARGET}
 }
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome
+. /usr/lib/bigtop-utils/bigtop-detect-classpath
 
 LIB_DIR=${LIB_DIR:-/usr/lib}
 
index c572ded..6c482e3 100644 (file)
@@ -42,8 +42,8 @@ case "$1" in
         update-alternatives --install /etc/oozie/conf oozie-conf /etc/oozie/conf.dist 30
 
         conf_tomcat=/etc/oozie/conf/tomcat-deployment
-        update-alternatives --install ${conf_tomcat} oozie-tomcat-conf ${conf_tomcat}.default 30
-        update-alternatives --install ${conf_tomcat} oozie-tomcat-conf ${conf_tomcat}.secure 20
+        update-alternatives --install ${conf_tomcat} oozie-tomcat-conf ${conf_tomcat}.http 30
+        update-alternatives --install ${conf_tomcat} oozie-tomcat-conf ${conf_tomcat}.https 20
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
index 59a0b31..c013108 100644 (file)
@@ -39,9 +39,11 @@ set -e
 
 case "$1" in
     remove|upgrade|deconfigure)
-      update-alternatives --remove oozie-tomcat-conf /etc/oozie/conf/tomcat-deployment.default || :
-      update-alternatives --remove oozie-tomcat-conf /etc/oozie/conf/tomcat-deployment.secure || :
+      conf_tomcat=/etc/oozie/conf/tomcat-deployment
+
       update-alternatives --remove oozie-conf /etc/oozie/conf.dist || :
+      update-alternatives --remove oozie-tomcat-conf ${conf_tomcat}.http || :
+      update-alternatives --remove oozie-tomcat-conf ${conf_tomcat}.https || :
     ;;
 
     failed-upgrade)
index 4d74add..cb6d268 100755 (executable)
@@ -40,6 +40,6 @@ override_dh_auto_install:
        ln -s -f /var/lib/oozie/ext-2.2 debian/oozie/usr/lib/oozie/webapps/oozie/ext-2.2
        rm -rf                        debian/oozie/usr/lib/oozie/webapps/oozie/docs
        ln -s -f /usr/share/doc/oozie debian/oozie/usr/lib/oozie/webapps/oozie/docs
-       ln -s /usr/lib/oozie/webapps debian/oozie/etc/oozie/conf.dist/tomcat-deployment.default
-       ln -s /usr/lib/oozie/webapps debian/oozie/etc/oozie/conf.dist/tomcat-deployment.secure
+       ln -s /usr/lib/oozie/webapps debian/oozie/etc/oozie/conf.dist/tomcat-deployment.http
+       ln -s /usr/lib/oozie/webapps debian/oozie/etc/oozie/conf.dist/tomcat-deployment.https
        ln -s /var/lib/oozie/tomcat-deployment/WEB-INF debian/oozie/usr/lib/oozie/webapps/oozie/WEB-INF
index 67049af..2fcfe3b 100644 (file)
@@ -150,8 +150,8 @@ Requires: bigtop-utils >= 0.7
 %__install -d  -m 0755  %{buildroot}/%{_localstatedir}/log/oozie
 %__install -d  -m 0755  %{buildroot}/%{_localstatedir}/run/oozie
 
-%__ln_s -f %{lib_oozie}/webapps $RPM_BUILD_ROOT/%{conf_tomcat_dist}.default/webapps
-%__ln_s -f %{lib_oozie}/webapps $RPM_BUILD_ROOT/%{conf_tomcat_dist}.secure/webapps
+%__ln_s -f %{lib_oozie}/webapps $RPM_BUILD_ROOT/%{conf_tomcat_dist}.http/webapps
+%__ln_s -f %{lib_oozie}/webapps $RPM_BUILD_ROOT/%{conf_tomcat_dist}.https/webapps
 %__ln_s -f %{data_oozie}/tomcat-deployment/WEB-INF $RPM_BUILD_ROOT/%{lib_oozie}/webapps/oozie/WEB-INF
 
 %pre
@@ -160,18 +160,18 @@ getent passwd oozie >/dev/null || /usr/sbin/useradd --comment "Oozie User" --she
 
 %post 
 %{alternatives_cmd} --install %{conf_oozie} %{name}-conf %{conf_oozie_dist} 30
-%{alternatives_cmd} --install %{conf_tomcat} %{name}-tomcat-conf %{conf_tomcat}.default 30
-%{alternatives_cmd} --install %{conf_tomcat} %{name}-tomcat-conf %{conf_tomcat}.secure 20
+%{alternatives_cmd} --install %{conf_tomcat} %{name}-tomcat-conf %{conf_tomcat}.http 30
+%{alternatives_cmd} --install %{conf_tomcat} %{name}-tomcat-conf %{conf_tomcat}.https 20
 
 /sbin/chkconfig --add oozie 
 
 %preun
 if [ "$1" = 0 ]; then
-  rm /etc/oozie/conf/tomcat-deployment
+  rm -r /etc/oozie/conf/tomcat-deployment
   /sbin/service oozie stop > /dev/null
   /sbin/chkconfig --del oozie
-  %{alternatives_cmd} --remove %{name}-tomcat-conf %{conf_tomcat}.default || :
-  %{alternatives_cmd} --remove %{name}-tomcat-conf %{conf_tomcat}.secure || :
+  %{alternatives_cmd} --remove %{name}-tomcat-conf %{conf_tomcat}.http || :
+  %{alternatives_cmd} --remove %{name}-tomcat-conf %{conf_tomcat}.https || :
   %{alternatives_cmd} --remove %{name}-conf %{conf_oozie_dist} || :
 fi