Skip to content

Instantly share code, notes, and snippets.

@jhrcz
Created May 23, 2013 14:49
Show Gist options
  • Save jhrcz/5636620 to your computer and use it in GitHub Desktop.
Save jhrcz/5636620 to your computer and use it in GitHub Desktop.

apache-tomcat-packages-testing-notes

rctc init-user tomcat55
rctc init-user tomcat60
rctc init-user tomcat70

rctc kill tomcat55
rctc kill tomcat60
rctc kill tomcat70

rm -rf /srv/tc/tomcat55
rm -rf /srv/tc/tomcat60
rm -rf /srv/tc/tomcat70

BASEPORT=8550 TCVER=5.5 rctc init tomcat55
BASEPORT=8600 TCVER=6.0 rctc init tomcat60
BASEPORT=8700 TCVER=7.0 rctc init tomcat70

for i in 55 60 70
do
mkdir -p /srv/tc/tomcat$i/webapps/test/
echo "test-string-$i" > /srv/tc/tomcat$i/webapps/test/testfile.html
done

for i in 55 60 70
do
rm -f /srv/tc/tomcat$i/conf/Catalina/localhost/ROOT.xml
done

rm /etc/httpd/sites-enabled/000-default.conf
for i in 55 60 70
do
echo "
<VirtualHost *:80>
ServerName $i
ProxyPass   /                    ajp://127.0.0.1:8${i}9/ retry=0
</VirtualHost>
" > /etc/httpd/sites-enabled/$i.conf
done

apachectl configtest
apachectl restart

rctc start ALL

sleep 10

rctc status tomcat55 | grep 'tomcat up' && echo OK || echo FAIL
rctc status tomcat60 | grep 'tomcat up' && echo OK || echo FAIL
rctc status tomcat70 | grep 'tomcat up' && echo OK || echo FAIL

curl -s -H Host:55 http://127.0.0.1/test/testfile.html | grep test-string-55 && echo OK || echo FAIL
curl -s -H Host:60 http://127.0.0.1/test/testfile.html | grep test-string-60 && echo OK || echo FAIL
curl -s -H Host:70 http://127.0.0.1/test/testfile.html | grep test-string-70 && echo OK || echo FAIL

curl -s -H Host:70 http://127.0.0.1/probe/ | grep -q 'HTTP Status 401' && echo OK || echo FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment