diff options
author | Sean Mackrory <mackrorysd@apache.org> | 2014-02-20 10:02:24 -0800 |
---|---|---|
committer | Sean Mackrory <mackrorysd@apache.org> | 2014-02-24 13:46:50 -0800 |
commit | 1f92b84a8dcbc72020251fc428a394cc080b4dca (patch) | |
tree | 46b8b5ec76cc174b0e97c61cbcbd65aa37a2d9e2 | |
parent | 44b1f096537c61faefaeaf45ad80b68705132ac9 (diff) |
BIGTOP-1215. Refactor Tomcat deployment
25 files changed, 226 insertions, 126 deletions
diff --git a/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc b/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc index 13125f35..1abda2cd 100644 --- a/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc +++ b/bigtop-packages/src/common/hadoop/hadoop-httpfs.svc @@ -25,23 +25,6 @@ PIDFILE="/var/run/$DAEMON/hadoop-$SVC_USER-$HADOOP_NAME.pid" CHKCONFIG=${CHKCONFIG:-"2345 90 10"} CHKCONFIG="${CHKCONFIG%% *} 90 10" -generate_functions() { - -cat <<'__EOT__' -tomcat_deployment() { - DEPLOYMENT_SOURCE=`readlink -e /etc/hadoop-httpfs/tomcat-deployment` - DEPLOYMENT_TARGET=/var/lib/hadoop-httpfs/tomcat-deployment - - rm -rf ${DEPLOYMENT_TARGET} - cp -r ${DEPLOYMENT_SOURCE} ${DEPLOYMENT_TARGET} - ln -s /usr/lib/hadoop-httpfs/webapps ${DEPLOYMENT_TARGET}/ - chown -R ${SVC_USER}:${SVC_USER} ${DEPLOYMENT_TARGET} - chmod -R 755 ${DEPLOYMENT_TARGET} -} -__EOT__ - -} - generate_start() { cat <<'__EOT__' @@ -59,7 +42,7 @@ start() { export CATALINA_PID="$PIDFILE" export CATALINA_TMPDIR="$HTTPFS_TEMP" - tomcat_deployment + . /usr/lib/hadoop-httpfs/tomcat-deployment.sh su -s /bin/bash -c "${EXEC_PATH} start $DAEMON_FLAGS" $HTTPFS_USER diff --git a/bigtop-packages/src/common/hadoop/httpfs-tomcat-deployment.sh b/bigtop-packages/src/common/hadoop/httpfs-tomcat-deployment.sh new file mode 100644 index 00000000..0b965a02 --- /dev/null +++ b/bigtop-packages/src/common/hadoop/httpfs-tomcat-deployment.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script must be sourced so that it can set CATALINA_BASE for the parent process + +TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/hadoop-httpfs/tomcat-conf`} +TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/hadoop-httpfs/tomcat-deployment} +HTTPFS_HOME=${HTTPFS_HOME:-/usr/lib/hadoop-httpfs} + +rm -rf ${TOMCAT_DEPLOYMENT} +mkdir ${TOMCAT_DEPLOYMENT} +cp -r ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT}/ +cp -r ${HTTPFS_HOME}/webapps ${TOMCAT_DEPLOYMENT}/ +cp -r ${TOMCAT_CONF}/WEB-INF/* ${TOMCAT_DEPLOYMENT}/webapps/webhdfs/WEB-INF/ + +if [ -n "${BIGTOP_CLASSPATH}" ] ; then + sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties +fi + +chown -R httpfs:httpfs ${TOMCAT_DEPLOYMENT} +chmod -R 755 ${TOMCAT_DEPLOYMENT} + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + diff --git a/bigtop-packages/src/common/hadoop/install_hadoop.sh b/bigtop-packages/src/common/hadoop/install_hadoop.sh index fe004a10..89c480b0 100755 --- a/bigtop-packages/src/common/hadoop/install_hadoop.sh +++ b/bigtop-packages/src/common/hadoop/install_hadoop.sh @@ -318,9 +318,14 @@ cp ${BUILD_DIR}/sbin/httpfs.sh ${HTTPFS_DIR}/sbin/ cp -r ${BUILD_DIR}/share/hadoop/httpfs/tomcat/webapps ${HTTPFS_DIR}/webapps install -d -m 0755 ${PREFIX}/var/lib/hadoop-httpfs install -d -m 0755 $HTTPFS_ETC_DIR/conf.empty -install -d -m 0755 $HTTPFS_ETC_DIR/tomcat-deployment.dist -cp -r ${BUILD_DIR}/share/hadoop/httpfs/tomcat/conf $HTTPFS_ETC_DIR/tomcat-deployment.dist/ -chmod 644 $HTTPFS_ETC_DIR/tomcat-deployment.dist/conf/* + +install -m 0755 ${DISTRO_DIR}/httpfs-tomcat-deployment.sh ${HTTPFS_DIR}/tomcat-deployment.sh +install -d -m 0755 $HTTPFS_ETC_DIR/tomcat-conf.dist +cp -r ${BUILD_DIR}/share/hadoop/httpfs/tomcat/conf $HTTPFS_ETC_DIR/tomcat-conf.dist/ +chmod 644 $HTTPFS_ETC_DIR/tomcat-conf.dist/conf/* +install -d -m 0755 $HTTPFS_ETC_DIR/tomcat-conf.dist/WEB-INF +mv ${HTTPFS_DIR}/webapps/webhdfs/WEB-INF/*.xml $HTTPFS_ETC_DIR/tomcat-conf.dist/WEB-INF/ + mv $HADOOP_ETC_DIR/conf.empty/httpfs* $HTTPFS_ETC_DIR/conf.empty sed -i -e '/<\/configuration>/i\ <!-- HUE proxy user setting -->\ diff --git a/bigtop-packages/src/common/oozie/install_oozie.sh b/bigtop-packages/src/common/oozie/install_oozie.sh index efddce08..7ce2086b 100755 --- a/bigtop-packages/src/common/oozie/install_oozie.sh +++ b/bigtop-packages/src/common/oozie/install_oozie.sh @@ -213,21 +213,21 @@ mkdir ${WEBAPP_DIR} mv -f ${WEBAPP_DIR}/WEB-INF/lib ${SERVER_LIB_DIR}/libserver touch ${SERVER_LIB_DIR}/webapps/oozie.war -HTTP_DIRECTORY=${ETC_DIR}/tomcat-deployment.http +install -m 0755 ${EXTRA_DIR}/tomcat-deployment.sh ${SERVER_LIB_DIR}/tomcat-deployment.sh + +HTTP_DIRECTORY=${ETC_DIR}/tomcat-conf.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 +install -d -m 0755 ${HTTP_DIRECTORY}/WEB-INF +mv ${SERVER_LIB_DIR}/webapps/oozie/WEB-INF/*.xml ${HTTP_DIRECTORY}/WEB-INF -HTTPS_DIRECTORY=${ETC_DIR}/tomcat-deployment.https +HTTPS_DIRECTORY=${ETC_DIR}/tomcat-conf.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 ${ETC_DIR}/tomcat-deployment.http/ -ln -s /usr/lib/oozie/webapps ${ETC_DIR}/tomcat-deployment.https/ -ln -s /var/lib/oozie/tomcat-deployment/WEB-INF ${SERVER_LIB_DIR}/webapps/oozie/ +mv ${HTTPS_DIRECTORY}/conf/ssl/ssl-server.xml ${HTTPS_DIRECTORY}/conf/server.xml +mv ${HTTPS_DIRECTORY}/conf/ssl/ssl-web.xml ${HTTPS_DIRECTORY}/WEB-INF/web.xml +rm -r ${HTTP_DIRECTORY}/conf/ssl # Create all the jars needed for tools execution install -d -m 0755 ${SERVER_LIB_DIR}/libtools diff --git a/bigtop-packages/src/common/oozie/oozie.init b/bigtop-packages/src/common/oozie/oozie.init index d5a8dc9d..43cec26d 100644 --- a/bigtop-packages/src/common/oozie/oozie.init +++ b/bigtop-packages/src/common/oozie/oozie.init @@ -48,22 +48,8 @@ is_oozie_alive() { fi } -tomcat_deployment() { - DEPLOYMENT_SOURCE=`readlink -e /etc/oozie/tomcat-deployment` - DEPLOYMENT_TARGET=/var/lib/oozie/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} -} - start_oozie() { - tomcat_deployment + . /usr/lib/oozie/tomcat-deployment.sh install -d -o oozie -g oozie /var/run/oozie install -d -o oozie -g oozie /var/log/oozie install -d -o oozie -g oozie /var/tmp/oozie diff --git a/bigtop-packages/src/common/oozie/tomcat-deployment.sh b/bigtop-packages/src/common/oozie/tomcat-deployment.sh new file mode 100644 index 00000000..c25bc729 --- /dev/null +++ b/bigtop-packages/src/common/oozie/tomcat-deployment.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script must be sourced so that it can set CATALINA_BASE for the parent process + +TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/oozie/tomcat-conf`} +TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/oozie/tomcat-deployment} +OOZIE_HOME=${OOZIE_HOME:-/usr/lib/oozie} + +rm -rf ${TOMCAT_DEPLOYMENT} +mkdir ${TOMCAT_DEPLOYMENT} +cp -r ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT} +cp -r ${OOZIE_HOME}/webapps ${TOMCAT_DEPLOYMENT}/webapps +cp -r ${TOMCAT_CONF}/WEB-INF/* ${TOMCAT_DEPLOYMENT}/webapps/oozie/WEB-INF/ + +if [ -n "${BIGTOP_CLASSPATH}" ] ; then + sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties +fi + +chown -R oozie:oozie ${TOMCAT_DEPLOYMENT} + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + diff --git a/bigtop-packages/src/common/solr/install_solr.sh b/bigtop-packages/src/common/solr/install_solr.sh index 28350fc4..4ebb0376 100644 --- a/bigtop-packages/src/common/solr/install_solr.sh +++ b/bigtop-packages/src/common/solr/install_solr.sh @@ -128,10 +128,15 @@ cat > $PREFIX/$LIB_DIR/server/webapps/ROOT/index.html <<__EOT__ <html><head><meta http-equiv="refresh" content="0;url=./solr"></head><body><a href="/solr">Solr Console</a></body></html> __EOT__ -install -d -m 0755 $PREFIX/etc/solr/tomcat-deployment.dist/conf -cp $DISTRO_DIR/web.xml $PREFIX/etc/solr/tomcat-deployment.dist/conf -cp $DISTRO_DIR/server.xml $PREFIX/etc/solr/tomcat-deployment.dist/conf -cp $DISTRO_DIR/logging.properties $PREFIX/etc/solr/tomcat-deployment.dist/conf +install -m 0755 ${DISTRO_DIR}/tomcat-deployment.sh ${PREFIX}/${LIB_DIR}/tomcat-deployment.sh + +install -d -m 0755 $PREFIX/etc/solr/tomcat-conf.dist/conf +cp $DISTRO_DIR/web.xml $PREFIX/etc/solr/tomcat-conf.dist/conf +cp $DISTRO_DIR/server.xml $PREFIX/etc/solr/tomcat-conf.dist/conf +cp $DISTRO_DIR/logging.properties $PREFIX/etc/solr/tomcat-conf.dist/conf + +install -d -m 0755 $PREFIX/etc/solr/tomcat-conf.dist/WEB-INF +mv $PREFIX/$LIB_DIR/webapps/solr/WEB-INF/*.xml $PREFIX/etc/solr/tomcat-conf.dist/WEB-INF/ || : cp -ra ${BUILD_DIR}/dist/*.*ar $PREFIX/$LIB_DIR cp -ra ${BUILD_DIR}/dist/solrj-lib $PREFIX/$LIB_DIR/lib diff --git a/bigtop-packages/src/common/solr/solr-server.init.debian b/bigtop-packages/src/common/solr/solr-server.init.debian index f24dd396..0684032f 100644 --- a/bigtop-packages/src/common/solr/solr-server.init.debian +++ b/bigtop-packages/src/common/solr/solr-server.init.debian @@ -64,16 +64,6 @@ done SOLR_SHUTDOWN_TIMEOUT=${SOLR_SHUTDOWN_TIMEOUT:-60} -tomcat_deployment() { - DEPLOYMENT_SOURCE=`readlink -e /etc/solr/tomcat-deployment` - DEPLOYMENT_TARGET=/var/lib/solr/tomcat-deployment - - rm -rf ${DEPLOYMENT_TARGET} - cp -r ${DEPLOYMENT_SOURCE} ${DEPLOYMENT_TARGET} - ln -s ${SOLR_HOME}/server/webapps ${DEPLOYMENT_TARGET}/ - chown -R ${SOLR_USER}:${SOLR_USER} ${DEPLOYMENT_TARGET} -} - start() { [ -x $exec ] || exit $ERROR_PROGRAM_NOT_INSTALLED @@ -84,7 +74,7 @@ start() { fi log_success_msg "Starting $desc: " - tomcat_deployment + . /usr/lib/solr/tomcat-deployment.sh /bin/su -s /bin/bash -c "${EXEC_PATH} start" $SOLR_USER RETVAL=$? [ $RETVAL -eq 0 ] && touch $LOCKFILE diff --git a/bigtop-packages/src/common/solr/tomcat-deployment.sh b/bigtop-packages/src/common/solr/tomcat-deployment.sh new file mode 100644 index 00000000..b73caccc --- /dev/null +++ b/bigtop-packages/src/common/solr/tomcat-deployment.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script must be sourced so that it can set CATALINA_BASE for the parent process + +TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/solr/tomcat-conf`} +TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/solr/tomcat-deployment} +SOLR_HOME=${SOLR_HOME:-/usr/lib/solr} + +rm -rf ${TOMCAT_DEPLOYMENT} +mkdir ${TOMCAT_DEPLOYMENT} +cp -r ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT} +cp -r ${SOLR_HOME}/webapps ${TOMCAT_DEPLOYMENT}/webapps +cp -r ${TOMCAT_CONF}/WEB-INF/* ${TOMCAT_DEPLOYMENT}/webapps/solr/WEB-INF/ + +if [ -n "${BIGTOP_CLASSPATH}" ] ; then + sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties +fi + +chown -R solr:solr ${TOMCAT_DEPLOYMENT} + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + diff --git a/bigtop-packages/src/common/sqoop/install_sqoop.sh b/bigtop-packages/src/common/sqoop/install_sqoop.sh index 19468fbe..683d1ec4 100755 --- a/bigtop-packages/src/common/sqoop/install_sqoop.sh +++ b/bigtop-packages/src/common/sqoop/install_sqoop.sh @@ -120,7 +120,7 @@ MAN_DIR=${MAN_DIR:-/usr/share/man/man1} CONF_DIR=${CONF_DIR:-${ETC_DIR}/conf.dist} INITD_DIR=${INITD_DIR:-/etc/init.d} DIST_DIR=${DIST_DIR:-dist/target/sqoop-*} -TOMCAT_DEPLOYMENT_DIR=${ETC_DIR}/tomcat-deployment +TOMCAT_CONF_DIR=${ETC_DIR}/tomcat-conf install -d -m 0755 ${PREFIX}/${LIB_DIR} install -d -m 0755 ${PREFIX}/${LIB_DIR}/client-lib @@ -146,15 +146,19 @@ SQOOP_WEBAPPS=${PREFIX}/${LIB_DIR}/webapps cp -r ${DIST_DIR}/server/webapps $SQOOP_WEBAPPS unzip -d $SQOOP_WEBAPPS/sqoop $SQOOP_WEBAPPS/sqoop.war +install -m 0755 ${EXTRA_DIR}/tomcat-deployment.sh ${PREFIX}/${LIB_DIR}/tomcat-deployment.sh + # Create MR2 configuration -install -d -m 0755 ${PREFIX}/${TOMCAT_DEPLOYMENT_DIR}.dist/conf +install -d -m 0755 ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf for conf in web.xml tomcat-users.xml server.xml logging.properties context.xml catalina.policy do - install -m 0644 ${DIST_DIR}/server/conf/$conf ${PREFIX}/${TOMCAT_DEPLOYMENT_DIR}.dist/conf/ + install -m 0644 ${DIST_DIR}/server/conf/$conf ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/ done -sed -i -e "s|<Host |<Host workDir=\"/var/tmp/sqoop\" |" ${PREFIX}/${TOMCAT_DEPLOYMENT_DIR}.dist/conf/server.xml -sed -i -e "s|\${catalina\.base}/logs|/var/log/sqoop|" ${PREFIX}/${TOMCAT_DEPLOYMENT_DIR}.dist/conf/logging.properties -cp -f ${EXTRA_DIR}/catalina.properties ${PREFIX}/${TOMCAT_DEPLOYMENT_DIR}.dist/conf/catalina.properties +sed -i -e "s|<Host |<Host workDir=\"/var/tmp/sqoop\" |" ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/server.xml +sed -i -e "s|\${catalina\.base}/logs|/var/log/sqoop|" ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/logging.properties +cp -f ${EXTRA_DIR}/catalina.properties ${PREFIX}/${TOMCAT_CONF_DIR}.dist/conf/catalina.properties +install -d -m 0755 ${PREFIX}/${TOMCAT_CONF_DIR}.dist/WEB-INF +mv ${SQOOP_WEBAPPS}/sqoop/WEB-INF/*.xml ${PREFIX}/${TOMCAT_CONF_DIR}.dist/WEB-INF # Create wrapper scripts for the client and server client_wrapper=$PREFIX/usr/bin/sqoop diff --git a/bigtop-packages/src/common/sqoop/sqoop-server.sh b/bigtop-packages/src/common/sqoop/sqoop-server.sh index d7bf00b2..a332ce85 100644 --- a/bigtop-packages/src/common/sqoop/sqoop-server.sh +++ b/bigtop-packages/src/common/sqoop/sqoop-server.sh @@ -15,22 +15,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -tomcat_deployment() { - DEPLOYMENT_SOURCE=`readlink -e /etc/sqoop/tomcat-deployment` - DEPLOYMENT_TARGET=/var/lib/sqoop/tomcat-deployment - - rm -rf ${DEPLOYMENT_TARGET} - 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 @@ -40,7 +24,7 @@ LIB_DIR=${LIB_DIR:-/usr/lib} SQOOP_HOME=${LIB_DIR}/sqoop TOMCAT_HOME=${LIB_DIR}/bigtop-tomcat -tomcat_deployment +. /usr/lib/sqoop/tomcat-deployment.sh export CATALINA_BIN=${CATALINA_BIN:-${TOMCAT_HOME}/bin} export CATALINA_BASE=${CATALINA_BASE:-${DEPLOYMENT_TARGET}} diff --git a/bigtop-packages/src/common/sqoop/tomcat-deployment.sh b/bigtop-packages/src/common/sqoop/tomcat-deployment.sh new file mode 100644 index 00000000..19a907ac --- /dev/null +++ b/bigtop-packages/src/common/sqoop/tomcat-deployment.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script must be sourced so that it can set CATALINA_BASE for the parent process + +TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/sqoop/tomcat-conf`} +TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/sqoop/tomcat-deployment} +SQOOP_HOME=${SQOOP_HOME:-/usr/lib/sqoop} + +rm -rf ${TOMCAT_DEPLOYMENT} +mkdir ${TOMCAT_DEPLOYMENT} +cp -r ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT} +cp -r ${SQOOP_HOME}/webapps ${TOMCAT_DEPLOYMENT}/webapps +cp -r ${TOMCAT_CONF}/WEB-INF/* ${TOMCAT_DEPLOYMENT}/webapps/sqoop/WEB-INF/ +cp -r ${SQOOP_HOME}/bin ${TOMCAT_DEPLOYMENT}/ + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + +if [ -n "${BIGTOP_CLASSPATH}" ] ; then + sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties +fi + +chown -R sqoop:sqoop ${TOMCAT_DEPLOYMENT} + +export CATALINA_BASE=${TOMCAT_DEPLOYMENT} + diff --git a/bigtop-packages/src/deb/hadoop/hadoop-httpfs.postinst b/bigtop-packages/src/deb/hadoop/hadoop-httpfs.postinst index ed9a9cdb..0066dfc6 100644 --- a/bigtop-packages/src/deb/hadoop/hadoop-httpfs.postinst +++ b/bigtop-packages/src/deb/hadoop/hadoop-httpfs.postinst @@ -23,7 +23,7 @@ case "$1" in configure) chown httpfs:httpfs /var/run/hadoop-httpfs /var/log/hadoop-httpfs update-alternatives --install /etc/hadoop-httpfs/conf hadoop-httpfs-conf /etc/hadoop-httpfs/conf.empty 10 - update-alternatives --install /etc/hadoop-httpfs/tomcat-deployment hadoop-httpfs-tomcat-deployment /etc/hadoop-httpfs/tomcat-deployment.dist 10 + update-alternatives --install /etc/hadoop-httpfs/tomcat-conf hadoop-httpfs-tomcat-conf /etc/hadoop-httpfs/tomcat-conf.dist 10 ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/bigtop-packages/src/deb/hadoop/hadoop-httpfs.prerm b/bigtop-packages/src/deb/hadoop/hadoop-httpfs.prerm index 2f4cf101..383214cb 100644 --- a/bigtop-packages/src/deb/hadoop/hadoop-httpfs.prerm +++ b/bigtop-packages/src/deb/hadoop/hadoop-httpfs.prerm @@ -36,7 +36,7 @@ set -e case "$1" in remove|upgrade|deconfigure) update-alternatives --remove hadoop-httpfs-conf /etc/hadoop-httpfs/conf.empty || : - update-alternatives --remove hadoop-httpfs-tomcat-deployment /etc/hadoop-httpfs/tomcat-deployment.dist || : + update-alternatives --remove hadoop-httpfs-tomcat-conf /etc/hadoop-httpfs/tomcat-conf.dist || : ;; failed-upgrade) diff --git a/bigtop-packages/src/deb/oozie/oozie.postinst b/bigtop-packages/src/deb/oozie/oozie.postinst index 5bd0dd1f..bd602454 100644 --- a/bigtop-packages/src/deb/oozie/oozie.postinst +++ b/bigtop-packages/src/deb/oozie/oozie.postinst @@ -41,7 +41,7 @@ case "$1" in update-alternatives --install /etc/oozie/conf oozie-conf /etc/oozie/conf.dist 30 - conf_tomcat=/etc/oozie/tomcat-deployment + conf_tomcat=/etc/oozie/tomcat-conf update-alternatives --install ${conf_tomcat} oozie-tomcat-conf ${conf_tomcat}.http 30 update-alternatives --install ${conf_tomcat} oozie-tomcat-conf ${conf_tomcat}.https 20 ;; diff --git a/bigtop-packages/src/deb/solr/solr.postinst b/bigtop-packages/src/deb/solr/solr.postinst index 7b768d8d..be8ba30c 100644 --- a/bigtop-packages/src/deb/solr/solr.postinst +++ b/bigtop-packages/src/deb/solr/solr.postinst @@ -20,7 +20,7 @@ case "$1" in configure) # Install config alternatives update-alternatives --install /etc/solr/conf solr-conf /etc/solr/conf.dist 30 - update-alternatives --install /etc/solr/tomcat-deployment solr-tomcat-deployment /etc/solr/tomcat-deployment.dist 30 + update-alternatives --install /etc/solr/tomcat-conf solr-tomcat-conf /etc/solr/tomcat-conf.dist 30 chown solr:solr /var/log/solr /var/lib/solr /var/run/solr ;; diff --git a/bigtop-packages/src/deb/solr/solr.prerm b/bigtop-packages/src/deb/solr/solr.prerm index 2c9053b5..d9742ad2 100644 --- a/bigtop-packages/src/deb/solr/solr.prerm +++ b/bigtop-packages/src/deb/solr/solr.prerm @@ -19,7 +19,7 @@ set -e case "$1" in remove|upgrade|deconfigure) update-alternatives --remove solr-conf /etc/solr/conf.dist || : - update-alternatives --remove solr-tomcat-deployment /etc/solr/tomcat-deployment.dist || : + update-alternatives --remove solr-tomcat-conf /etc/solr/tomcat-conf.dist || : ;; failed-upgrade) diff --git a/bigtop-packages/src/deb/sqoop/sqoop.install b/bigtop-packages/src/deb/sqoop/sqoop.install index a235d847..935887fe 100644 --- a/bigtop-packages/src/deb/sqoop/sqoop.install +++ b/bigtop-packages/src/deb/sqoop/sqoop.install @@ -1,7 +1,7 @@ /usr/bin/sqoop-server -/etc/sqoop/conf.dist -/etc/sqoop/tomcat-deployment.dist +/etc/sqoop /etc/default/sqoop-server /usr/lib/sqoop/bin/setenv.sh /usr/lib/sqoop/webapps +/usr/lib/sqoop/tomcat-deployment.sh /var/lib/sqoop diff --git a/bigtop-packages/src/deb/sqoop/sqoop.postinst b/bigtop-packages/src/deb/sqoop/sqoop.postinst index 2af541db..c86139a8 100644 --- a/bigtop-packages/src/deb/sqoop/sqoop.postinst +++ b/bigtop-packages/src/deb/sqoop/sqoop.postinst @@ -17,5 +17,5 @@ set -e update-alternatives --install /etc/sqoop/conf sqoop-conf /etc/sqoop/conf.dist 30 -update-alternatives --install /etc/sqoop/tomcat-deployment sqoop-tomcat-deployment /etc/sqoop/tomcat-deployment.dist 30 +update-alternatives --install /etc/sqoop/tomcat-conf sqoop-tomcat-conf /etc/sqoop/tomcat-conf.dist 30 diff --git a/bigtop-packages/src/deb/sqoop/sqoop.prerm b/bigtop-packages/src/deb/sqoop/sqoop.prerm index d4a25b9a..8ca557d3 100644 --- a/bigtop-packages/src/deb/sqoop/sqoop.prerm +++ b/bigtop-packages/src/deb/sqoop/sqoop.prerm @@ -24,7 +24,7 @@ set -e case "$1" in remove|upgrade|deconfigure) update-alternatives --remove sqoop-conf /etc/sqoop/conf.dist || : - update-alternatives --remove sqoop-tomcat-deployment /etc/sqoop/tomcat-deployment.dist || : + update-alternatives --remove sqoop-tomcat-conf /etc/sqoop/tomcat-conf.dist || : ;; failed-upgrade) diff --git a/bigtop-packages/src/rpm/hadoop/SPECS/hadoop.spec b/bigtop-packages/src/rpm/hadoop/SPECS/hadoop.spec index 158d0905..47d98253 100644 --- a/bigtop-packages/src/rpm/hadoop/SPECS/hadoop.spec +++ b/bigtop-packages/src/rpm/hadoop/SPECS/hadoop.spec @@ -28,7 +28,7 @@ %define config_hadoop %{etc_hadoop}/conf %define config_yarn %{etc_yarn}/conf %define config_httpfs %{etc_httpfs}/conf -%define tomcat_deployment_httpfs %{etc_httpfs}/tomcat-deployment +%define tomcat_deployment_httpfs %{etc_httpfs}/tomcat-conf %define lib_hadoop_dirname /usr/lib %define lib_hadoop %{lib_hadoop_dirname}/%{name} %define lib_httpfs %{lib_hadoop_dirname}/%{name}-httpfs @@ -164,6 +164,7 @@ Source21: yarn.default Source22: hadoop-layout.sh Source23: hadoop-hdfs-zkfc.svc Source24: hadoop-hdfs-journalnode.svc +Source25: httpfs-tomcat-deployment.sh Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id} -u -n) BuildRequires: fuse-devel, fuse, cmake Requires: coreutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, /sbin/service, bigtop-utils >= 0.7, zookeeper >= 3.4.0 @@ -551,7 +552,7 @@ getent passwd mapred >/dev/null || /usr/sbin/useradd --comment "Hadoop MapReduce %post httpfs %{alternatives_cmd} --install %{config_httpfs} %{name}-httpfs-conf %{etc_httpfs}/conf.empty 10 -%{alternatives_cmd} --install %{tomcat_deployment_httpfs} %{name}-tomcat-deployment %{etc_httpfs}/tomcat-deployment.dist 10 +%{alternatives_cmd} --install %{tomcat_deployment_httpfs} %{name}-tomcat-conf %{etc_httpfs}/tomcat-conf.dist 10 chkconfig --add %{name}-httpfs %preun @@ -564,7 +565,7 @@ if [ $1 = 0 ]; then service %{name}-httpfs stop > /dev/null 2>&1 chkconfig --del %{name}-httpfs %{alternatives_cmd} --remove %{name}-httpfs-conf %{etc_httpfs}/conf.empty || : - %{alternatives_cmd} --remove %{name}-tomcat-deployment %{etc_httpfs}/tomcat-deployment.dist || : + %{alternatives_cmd} --remove %{name}-tomcat-conf %{etc_httpfs}/tomcat-conf.dist || : fi %postun httpfs @@ -651,8 +652,7 @@ fi %files httpfs %defattr(-,root,root) -%config(noreplace) %{etc_httpfs}/conf.empty -%config(noreplace) %{etc_httpfs}/tomcat-deployment.dist +%config(noreplace) %{etc_httpfs} %config(noreplace) /etc/default/%{name}-httpfs %{lib_hadoop}/libexec/httpfs-config.sh %{initd_dir}/%{name}-httpfs diff --git a/bigtop-packages/src/rpm/oozie/SPECS/oozie.spec b/bigtop-packages/src/rpm/oozie/SPECS/oozie.spec index 35e7824d..f6fff4e9 100644 --- a/bigtop-packages/src/rpm/oozie/SPECS/oozie.spec +++ b/bigtop-packages/src/rpm/oozie/SPECS/oozie.spec @@ -17,7 +17,7 @@ %define man_dir /usr/share/man %define conf_oozie %{_sysconfdir}/%{name}/conf %define conf_oozie_dist %{conf_oozie}.dist -%define tomcat_deployment_oozie %{_sysconfdir}/%{name}/tomcat-deployment +%define tomcat_conf_oozie %{_sysconfdir}/%{name}/tomcat-conf %define data_oozie /var/lib/oozie %if %{!?suse_version:1}0 @@ -63,6 +63,7 @@ Source5: oozie.init Source6: catalina.properties Source7: context.xml Source8: hive.xml +Source9: tomcat-deployment.sh Requires(pre): /usr/sbin/groupadd, /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig, /sbin/service @@ -149,28 +150,24 @@ 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/%{tomcat_deployment_oozie}.http/webapps -%__ln_s -f %{lib_oozie}/webapps $RPM_BUILD_ROOT/%{tomcat_deployment_oozie}.https/webapps -%__ln_s -f %{data_oozie}/tomcat-deployment/WEB-INF $RPM_BUILD_ROOT/%{lib_oozie}/webapps/oozie/WEB-INF - %pre getent group oozie >/dev/null || /usr/sbin/groupadd -r oozie >/dev/null getent passwd oozie >/dev/null || /usr/sbin/useradd --comment "Oozie User" --shell /bin/false -M -r -g oozie --home %{data_oozie} oozie >/dev/null %post %{alternatives_cmd} --install %{conf_oozie} %{name}-conf %{conf_oozie_dist} 30 -%{alternatives_cmd} --install %{tomcat_deployment_oozie} %{name}-tomcat-conf %{tomcat_deployment_oozie}.http 30 -%{alternatives_cmd} --install %{tomcat_deployment_oozie} %{name}-tomcat-conf %{tomcat_deployment_oozie}.https 20 +%{alternatives_cmd} --install %{tomcat_conf_oozie} %{name}-tomcat-conf %{tomcat_conf_oozie}.http 30 +%{alternatives_cmd} --install %{tomcat_conf_oozie} %{name}-tomcat-conf %{tomcat_conf_oozie}.https 20 /sbin/chkconfig --add oozie %preun if [ "$1" = 0 ]; then - rm -r /etc/oozie/conf/tomcat-deployment + rm -r /etc/oozie/conf/tomcat-conf /sbin/service oozie stop > /dev/null /sbin/chkconfig --del oozie - %{alternatives_cmd} --remove %{name}-tomcat-conf %{tomcat_deployment_oozie}.http || : - %{alternatives_cmd} --remove %{name}-tomcat-conf %{tomcat_deployment_oozie}.https || : + %{alternatives_cmd} --remove %{name}-tomcat-conf %{tomcat_conf_oozie}.http || : + %{alternatives_cmd} --remove %{name}-tomcat-conf %{tomcat_conf_oozie}.https || : %{alternatives_cmd} --remove %{name}-conf %{conf_oozie_dist} || : fi @@ -182,7 +179,7 @@ fi %files %defattr(-,root,root) %config(noreplace) %{conf_oozie_dist} -%config(noreplace) %{tomcat_deployment_oozie}.* +%config(noreplace) %{tomcat_conf_oozie}.* %{usr_bin}/oozie-setup %{lib_oozie}/bin/oozie-sys.sh %{lib_oozie}/bin/oozie-env.sh @@ -194,6 +191,7 @@ fi %{lib_oozie}/libserver %{lib_oozie}/oozie-sharelib.tar.gz %{lib_oozie}/libext +%{lib_oozie}/tomcat-deployment.sh %{initd_dir}/oozie %defattr(-, oozie, oozie) %dir %{_sysconfdir}/%{name} diff --git a/bigtop-packages/src/rpm/solr/SOURCES/solr-server.init b/bigtop-packages/src/rpm/solr/SOURCES/solr-server.init index ff4654b8..6fbaf822 100644 --- a/bigtop-packages/src/rpm/solr/SOURCES/solr-server.init +++ b/bigtop-packages/src/rpm/solr/SOURCES/solr-server.init @@ -64,16 +64,6 @@ done SOLR_SHUTDOWN_TIMEOUT=${SOLR_SHUTDOWN_TIMEOUT:-60} -tomcat_deployment() { - DEPLOYMENT_SOURCE=`readlink -e /etc/solr/tomcat-deployment` - DEPLOYMENT_TARGET=/var/lib/solr/tomcat-deployment - - rm -rf ${DEPLOYMENT_TARGET} - cp -r ${DEPLOYMENT_SOURCE} ${DEPLOYMENT_TARGET} - ln -s ${SOLR_HOME}/server/webapps ${DEPLOYMENT_TARGET}/ - chown -R ${SOLR_USER}:${SOLR_USER} ${DEPLOYMENT_TARGET} -} - start() { [ -x $exec ] || exit $ERROR_PROGRAM_NOT_INSTALLED @@ -84,7 +74,7 @@ start() { fi log_success_msg "Starting $desc: " - tomcat_deployment + . /usr/lib/solr/tomcat-deployment.sh /bin/su -s /bin/bash -c "${EXEC_PATH} start" $SOLR_USER RETVAL=$? [ $RETVAL -eq 0 ] && touch $LOCKFILE diff --git a/bigtop-packages/src/rpm/solr/SPECS/solr.spec b/bigtop-packages/src/rpm/solr/SPECS/solr.spec index d7b0e686..38c4a406 100644 --- a/bigtop-packages/src/rpm/solr/SPECS/solr.spec +++ b/bigtop-packages/src/rpm/solr/SPECS/solr.spec @@ -17,7 +17,7 @@ %define lib_solr /usr/lib/%{solr_name} %define etc_solr /etc/%{solr_name} %define config_solr %{etc_solr}/conf -%define tomcat_deployment_solr %{etc_solr}/tomcat-deployment +%define tomcat_deployment_solr %{etc_solr}/tomcat-conf %define log_solr /var/log/%{solr_name} %define bin_solr /usr/bin %define man_dir /usr/share/man @@ -61,6 +61,7 @@ Source7: solr-server.init Source8: schema.xml Source9: solrconfig.xml Source10: solrctl.sh +Source11: tomcat-deployment.sh Requires: bigtop-utils >= 0.7, bigtop-tomcat # CentOS 5 does not have any dist macro @@ -132,12 +133,12 @@ getent passwd solr > /dev/null || useradd -c "Solr" -s /sbin/nologin -g solr -r %post %{alternatives_cmd} --install %{config_solr} %{solr_name}-conf %{config_solr}.dist 30 -%{alternatives_cmd} --install %{tomcat_deployment_solr} %{solr_name}-tomcat-deployment %{tomcat_deployment_solr}.dist 30 +%{alternatives_cmd} --install %{tomcat_deployment_solr} %{solr_name}-tomcat-conf %{tomcat_deployment_solr}.dist 30 %preun if [ "$1" = 0 ]; then %{alternatives_cmd} --remove %{solr_name}-conf %{config_solr}.dist || : - %{alternatives_cmd} --remove %{solr_name}-tomcat-deployment %{tomcat_deployment_solr}.dist || : + %{alternatives_cmd} --remove %{solr_name}-tomcat-conf %{tomcat_deployment_solr}.dist || : fi %post server diff --git a/bigtop-packages/src/rpm/sqoop/SPECS/sqoop.spec b/bigtop-packages/src/rpm/sqoop/SPECS/sqoop.spec index a2d02bb6..3e118b2d 100644 --- a/bigtop-packages/src/rpm/sqoop/SPECS/sqoop.spec +++ b/bigtop-packages/src/rpm/sqoop/SPECS/sqoop.spec @@ -16,7 +16,7 @@ %define lib_sqoop /usr/lib/sqoop %define conf_sqoop %{_sysconfdir}/sqoop/conf %define conf_sqoop_dist %{conf_sqoop}.dist -%define tomcat_deployment_sqoop %{_sysconfdir}/sqoop/tomcat-deployment +%define tomcat_deployment_sqoop %{_sysconfdir}/sqoop/tomcat-conf %define tomcat_deployment_sqoop_dist %{tomcat_deployment_sqoop}.dist %define run_sqoop /var/run/sqoop @@ -67,6 +67,7 @@ Source7: sqoop.default Source8: init.d.tmpl Source9: sqoop-server.svc Source10: sqoop-server.sh +Source11: tomcat-deployment.sh Buildarch: noarch BuildRequires: asciidoc Requires: hadoop-client, bigtop-utils >= 0.7, bigtop-tomcat, %{name}-client = %{version}-%{release} @@ -147,7 +148,7 @@ getent passwd sqoop >/dev/null || useradd -c "Sqoop User" -s /sbin/nologin -g sq %post %{alternatives_cmd} --install %{conf_sqoop} sqoop-conf %{conf_sqoop_dist} 30 -%{alternatives_cmd} --install %{tomcat_deployment_sqoop} sqoop-tomcat-deployment %{tomcat_deployment_sqoop_dist} 30 +%{alternatives_cmd} --install %{tomcat_deployment_sqoop} sqoop-tomcat-conf %{tomcat_deployment_sqoop_dist} 30 %post server chkconfig --add sqoop-server @@ -155,7 +156,7 @@ chkconfig --add sqoop-server %preun if [ "$1" = "0" ] ; then %{alternatives_cmd} --remove sqoop-conf %{conf_sqoop_dist} || : - %{alternatives_cmd} --remove sqoop-tomcat-deployment %{tomcat_deployment_sqoop_dist} || : + %{alternatives_cmd} --remove sqoop-tomcat-conf %{tomcat_deployment_sqoop_dist} || : fi %preun server @@ -173,10 +174,11 @@ fi %defattr(0755,root,root) /usr/bin/sqoop-server %config(noreplace) /etc/sqoop/conf.dist -%config(noreplace) /etc/sqoop/tomcat-deployment.dist +%config(noreplace) /etc/sqoop/tomcat-conf.dist %config(noreplace) /etc/default/sqoop-server %{lib_sqoop}/webapps %{lib_sqoop}/bin/setenv.sh +%{lib_sqoop}/tomcat-deployment.sh %defattr(0755,sqoop,sqoop) /var/lib/sqoop |