Skip to content

update to java 8 and tomcat 8.5 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<artifactId>tomcat8-maven-plugin</artifactId>
<version>3.0-r1655215</version>
<configuration>
<path>/</path>
</configuration>
Expand Down
48 changes: 28 additions & 20 deletions scripts/install_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

set -e

CATALINA_HOME=/usr/share/tomcat7-codedeploy
CATALINA_HOME=/usr/share/tomcat-codedeploy

# Tar file name
TOMCAT7_CORE_TAR_FILENAME='apache-tomcat-7.0.72.tar.gz'
# Download URL for Tomcat7 core
TOMCAT7_CORE_DOWNLOAD_URL="http://mirror.olnevhost.net/pub/apache/tomcat/tomcat-7/v7.0.72/bin/$TOMCAT7_CORE_TAR_FILENAME"
TOMCAT_CORE_TAR_FILENAME='apache-tomcat-8.5.11.tar.gz'
# Download URL for Tomcat core
TOMCAT_CORE_DOWNLOAD_URL="http://apache.mirror.digitalpacific.com.au/tomcat/tomcat-8/v8.5.11/bin/$TOMCAT_CORE_TAR_FILENAME"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the URL "http://apache.mirror.digitalpacific.com.au/tomcat/tomcat-8/v8.5.11/bin/apache-tomcat-8.5.11.tar.gz" is broken. Also lets stick to the ones listed in the official Apache mirrors.

# The top-level directory after unpacking the tar file
TOMCAT7_CORE_UNPACKED_DIRNAME='apache-tomcat-7.0.72'
TOMCAT_CORE_UNPACKED_DIRNAME='apache-tomcat-8.5.11'


# Check whether there exists a valid instance
# of Tomcat7 installed at the specified directory
[[ -d $CATALINA_HOME ]] && { service tomcat7 status; } && {
echo "Tomcat7 is already installed at $CATALINA_HOME. Skip reinstalling it."
# of Tomcat installed at the specified directory
[[ -d $CATALINA_HOME ]] && { service tomcat status; } && {
echo "Tomcat is already installed at $CATALINA_HOME. Skip reinstalling it."
exit 0
}

Expand All @@ -25,29 +25,37 @@ if [ -d $CATALINA_HOME ]; then
fi
mkdir -p $CATALINA_HOME

# Download the latest Tomcat7 version
# Download the latest Tomcat version
cd /tmp
{ which wget; } || { yum install wget; }
wget $TOMCAT7_CORE_DOWNLOAD_URL
if [[ -d /tmp/$TOMCAT7_CORE_UNPACKED_DIRNAME ]]; then
rm -rf /tmp/$TOMCAT7_CORE_UNPACKED_DIRNAME
wget $TOMCAT_CORE_DOWNLOAD_URL
if [[ -d /tmp/$TOMCAT_CORE_UNPACKED_DIRNAME ]]; then
rm -rf /tmp/$TOMCAT_CORE_UNPACKED_DIRNAME
fi
tar xzf $TOMCAT7_CORE_TAR_FILENAME
tar xzf $TOMCAT_CORE_TAR_FILENAME

# Copy over to the CATALINA_HOME
cp -r /tmp/$TOMCAT7_CORE_UNPACKED_DIRNAME/* $CATALINA_HOME
cp -r /tmp/$TOMCAT_CORE_UNPACKED_DIRNAME/* $CATALINA_HOME

# Install Java if not yet installed
{ which java; } || { yum install java; }
{ which java; } || { yum install java-1.8.0 -y; }

#Check Java 8 is installed
TMP_JAVA=java;
TMP_JAVA_VERSION=$("$TMP_JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$TMP_JAVA_VERSION" < "1.8" ]]; then
yum remove java -y;
yum install java-1.8.0 -y;
fi

# Create the service init.d script
cat > /etc/init.d/tomcat7 <<'EOF'
cat > /etc/init.d/tomcat <<'EOF'
#!/bin/bash
# description: Tomcat7 Start Stop Restart
# processname: tomcat7
# description: Tomcat Start Stop Restart
# processname: tomcat
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME='/usr/share/tomcat7-codedeploy'
CATALINA_HOME='/usr/share/tomcat-codedeploy'

case $1 in
start)
Expand All @@ -65,5 +73,5 @@ exit 0
EOF

# Change permission mode for the service script
chmod 755 /etc/init.d/tomcat7
chmod 755 /etc/init.d/tomcat

4 changes: 2 additions & 2 deletions scripts/start_application
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

CATALINA_HOME='/usr/share/tomcat7-codedeploy'
CATALINA_HOME='/usr/share/tomcat-codedeploy'
DEPLOY_TO_ROOT='true'
#CONTEXT_PATH='##CONTEXT_PATH##'
SERVER_HTTP_PORT='80'
Expand Down Expand Up @@ -32,4 +32,4 @@ cp $WAR_STAGED_LOCATION $CATALINA_HOME/webapps/$CONTEXT_PATH.war
cp $CATALINA_HOME/conf/server.xml $CATALINA_HOME/conf/server.xml.bak
xsltproc $HTTP_PORT_CONFIG_XSL_LOCATION $CATALINA_HOME/conf/server.xml.bak > $CATALINA_HOME/conf/server.xml

service tomcat7 start
service tomcat start
2 changes: 1 addition & 1 deletion scripts/stop_application
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

service tomcat7 stop
service tomcat stop