[EMAIL PROTECTED] wrote:
> 
> To clarify - this is not a replacement or an 'exclusive' mechanism.
> The 'ajp14' based config, where tomcat sends notifications to apache
> remains.

Seems like I was reinventing the wheel there for a while. So AJP14 knows
how configure itself from the running Tomcat... Pretty cool in my book!

> The problems with 'tomcat sending config info to apache' ( and why I
> would not make that the 'default' simple config ):
> 
> 1. It requires a strict startup sequence ( tomcat before apache ).
> Otherwise, if tomcat is not started apache will respond '404' for
> what it doesn't recognize, instead of 'temporary unavailable' or 'context
> is down'. This can be very problematic for users ( who'll assume the url
> is wrong instead of try again later ).

This is easily achieved (that's how I run my boxes) through the startup
script when both Apache and Tomcat are on the same box. I call this
thing 'was' -> Web Application Server. Here is the sample (RH Linux
7.0):

-------------------------------
#!/bin/sh
#
# Web Application Server
# Apache and Tomcat Control Script
#
# chkconfig: 345 86 14
# description: Web Application Server
# 

TMCTLOC=/usr/local/tomcat

TOMCATSH="$TMCTLOC/bin/tomcat.sh"
TOMCATER="/var/tomcat/logs/tomcat_error.log"
APACHESH="/usr/sbin/apachectl"
APACHEUS="apache"
SLEEPTM="2"

if [ -z "`echo $PATH | grep '/usr/local/jdk/bin'`" ]; then
  export PATH=$PATH:/usr/local/jdk/bin
fi

case "$1" in
start)
    su - $APACHEUS -c "$TOMCATSH $1" >>$TOMCATER 2>&1
    $APACHESH $1
    touch /var/lock/subsys/was
    ;;
stop)
    su - $APACHEUS -c "$TOMCATSH $1" >>$TOMCATER 2>&1
    $APACHESH $1
    rm -f /var/lock/subsys/was
    ;;
restart)
    su - $APACHEUS -c "$TOMCATSH stop" >>$TOMCATER 2>&1
    su - $APACHEUS -c "$TOMCATSH start" >>$TOMCATER 2>&1
    /bin/sleep $SLEEPTM
    $APACHESH graceful
    touch /var/lock/subsys/was
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac
-------------------------------

It would probably require a bit or work when those are on different
machines. Little bit of OpenSSH and it'd all work out just fine...

> 2. Apache ( or server ) configs will be located on the server machine
> anyway. I prefer keeping it centralized, and maybe have a mechanism to
> rsync the webapps directory from the master to the workers instead of reverse.

It would just be a different kind of script. I kind of like the idea of
having things in one place only.

Bojan

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to