# Once all the packages are installed, from RHAPS or jpackage, we then # need a little bit configuration doing
echo "%Post: Configuring Jonas"
chkconfig --level 345 jonas on
# Comment out default HTTP Connector and uncomment AJP 1.3 Connector
if [ -f "/etc/jonas/server.xml" ]; then
mv /etc/jonas/server.xml /etc/jonas/server.xml-$VERSION
sed -e "s/\(port 9000\) -->$/\1/" \
-e "s/\(^ disableUploadTimeout=\"true\" \/>\)$/\1 -->/" \
-e "s/\(<Connector port=\"9009\"\)/--> \1/" \
-e "s/\(protocol=\"AJP\/1.3\" \/>\)$/\1 <\!--/" \
/etc/jonas/server.xml-$VERSION > /etc/jonas/server.xml
# EL4 has a config file that uses 8009 for its AJP connector, so we fix this
elif [ "$OS" == "rhel4" ]; then
sed -e "s/\(port 9000\) -->$/\1/" \
-e "s/\(\00\" disableUploadTimeout=\"true\" \/>\)$/\1 -->/" \
-e "s/8009$/9009 -->/" \
-e "s/\(<Connector port=\)\"8009\"/\1\"9009\"/" \
-e "s/\(protocol=\"AJP\/1.3\" \/>\)$/\1 <\!--/" \
/etc/jonas/server.xml-$VERSION > /etc/jonas/server.xml
fi
# On RHEL4 change the default db to be HSQL as it is on other platforms
if [ "$OS" == "rhel4" ]; then
mv /etc/jonas/jonas.properties /etc/jonas/jonas.properties-$VERSION
sed -e 's/PostgreSQL1$/HSQL1/' /etc/jonas/jonas.properties-$VERSION > /etc/jonas/jonas.properties
fi
echo "%Post: Configuring Tomcat5"
if [ "$OS" == "fc3" ]; then
mv /etc/tomcat5/server.xml /etc/tomcat5/server.xml-$VERSION
cp /mnt/source/kickstart/rpms/mod_jk2/conf/server.xml /etc/tomcat5/server.xml
fi
# Base config file for placing apps in /$SAMBADOMAIN/opt/java
cat > /etc/tomcat5/Catalina/localhost/$SAMBADOMAIN.xml <<EOF
<?xml version='1.0' encoding='utf-8'?>
<Context path="/java" debug="2" reloadable="true"
docBase="/$SAMBADOMAIN/opt/java/">
<!-- this allows us to use the current->version_number symlink -->
<Resources className="org.apache.naming.resources.FileDirContext"
allowLinking="true"/>
</Context>
EOF
# Ensure Tomcat starts on boot
chkconfig --level 345 tomcat5 on
if [ "$OS" == "fc3" ]; then
echo "%Post: Configuring mod_jk2"
# Need to set this file for both Tomcat5 and JOnAS
# Tomcat5: port=8009
# JOnAS: port=9008
for CONTAINER in "tomcat5 8009" "jonas 9008"
do
set -- $CONTAINER
mv /etc/$1/jk2.properties /etc/$1/jk2.properties-$VERSION
cat > /etc/$1/jk2.properties <<EOF
#---- jk2.properties
# list of needed handlers.
handler.list=apr,channelSocket,channelUnix,request
# Set the default port for the channelSocket
channelSocket.port=$2
# State where the UNIX domain socket is located
channelUnix.file=/usr/share/$1/work/jk2.socket
# Dynamic library
serverRoot=/etc/httpd/
apr.NativeSo=/usr/lib/httpd/modules/libjkjni.so
#---- end of jk2.properties
EOF
done
# Make apache load the module
cat > /etc/httpd/conf.d/jk2.conf <<EOF
#
# Mod_jk2 allows the Apache Web server to connect to application
# servers using the AJP protocol. This allows web applications to
# be integrated seamlessly into your Apache server's URI space and
# utilize Apache features such as SSL processing.
#
LoadModule jk2_module modules/mod_jk2.so
#
# Mod_jk2 is configured in /etc/httpd/conf/workers2.properties
#
EOF
# Configure access to Tomcat and JOnAS via mod_jk2
cat > /etc/httpd/conf/workers2.properties <<EOF
#---- workers2.properties
# Shared memory handling. Needs to be set.
[shm]
file=\${serverRoot}/logs/shm.file
size=1048576
# Tomcat domain socket
[channel.un:/usr/share/tomcat5/work/jk2.socket]
tomcatId=localhost:8009
debug=0
# JOnAS domain socket
[channel.un:/usr/share/jonas/work/jk2.socket]
tomcatId=localhost:9008
debug=0
# define the workers
[ajp13:localhost:8009]
channel=channel.un:/usr/share/tomcat5/work/jk2.socket
[ajp13:localhost:9008]
channel=channel.un:/usr/share/jonas/work/jk2.socket
# Announce a "status" worker
[status:status]
# Uri mapping
[uri:$/jsp-examples/*]
worker=ajp13:/usr/share/tomcat5/work/jk2.socket
[uri:$/servlets-examples/*]
worker=ajp13:/usr/share/tomcat5/work/jk2.socket
[uri:$/manager/*]
worker=ajp13:/usr/share/tomcat5/work/jk2.socket
[uri:$/*.jsp]
worker=ajp13:/usr/share/tomcat5/work/jk2.socket
[uri:$/status/*]
worker=status:status
[uri:$/jonasAdmin/*]
worker=ajp13:/usr/share/jonas/work/jk2.socket
# Configuration for davenport
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
#---- end of workers2.properties
EOF
else
echo "%Post: Configuring mod_jk"
# Need to set this file for both Tomcat5 and JOnAS
# Tomcat5: port=8009
# JOnAS: port=9008
cat > /etc/httpd/conf/workers.properties <<EOF
workers.tomcat_home=/usr/share/tomcat5
workers.java_home=$JAVA_HOME
ps=/
worker.list=default,jonas,jkstatus
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.jonas.port=9009
worker.jonas.host=localhost
worker.jonas.type=ajp13
EOF
cat > /etc/httpd/conf.d/jk.conf <<EOF
#
# Mod_jk allows the Apache Web server to connect to application
# servers using the AJP protocol. This allows web applications to
# be integrated seamlessly into your Apache server's URI space and
# utilize Apache features such as SSL processing.
#
LoadModule jk_module modules/mod_jk.so
# mod_jk settings
JkWorkersFile "conf/workers.properties"
JKLogFile "logs/mod_jk.log"
JkLogLevel error
# Link in the tomcat 5 jsp example
JkMount /jsp-examples default
JkMount /jsp-examples/* default
# Link in the tomcat 5 java servlet examples
JkMount /servlets-examples default
JkMount /servlets-examples/* default
EOF
cat > /etc/httpd/conf.d/jonas.conf <<EOF
# configuring jonas access via mod_jk
JkMount /jonasAdmin jonas
JkMount /jonasAdmin/* jonas
JkMount /earsample/* jonas
EOF
fi
Marked up in XHTML - ©2005 Thoughtful Solutions Ltd.