Department of Chemistry

Murray-Rust Research Group

Virtual machines

These pages contain technical notes regarding the configuration and administration of the various VMs and web services run by the Murray-Rust group.

Contents

Installation

Jetty

Install sun-java6-jdk

sudo vi /etc/apt/sources.list

ADD LINE:

deb http://www-uxsup.csx.cam.ac.uk/pub/linux/debian lenny non-free
sudo apt-get update
sudo apt-get install sun-java6-jdk

sudo vi /etc/profile
JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME

Install Jetty

sudo apt-get install jetty

Fix broken jetty distribution

sudo vi /etc/jetty/jetty-shared-webapps.xml

CHANGE LINE:

<Set name="webAppDir">/usr/share/java/webapps</Set>

TO:

<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
sudo vi /etc/default/jetty

ADD LINES:

JAVA_HOME=/usr/lib/jvm/java-6-sun
JETTY_HOST=0.0.0.0

Restart jetty

sudo /etc/init.d/jetty stop
sudo /etc/init.d/jetty start


Forwarded addresses

To get jetty to log IP address for forwarded (proxied) requests edit /etc/jetty/jetty.xml and find:

<Call name="addConnector">
  <Arg>
    <New class="org.mortbay.jetty.nio.SelectChannelConnector">

add:

      <Set name="forwarded">true</Set>

Make public

Jetty runs as non-privileged user on port 8080.

Proxy forwards public:80 to private:80 (e.g. maven.ch.cam.ac.uk:80 >> maven.ch.private.cam.ac.uk:80)

Add iptables rule to redirect port 80 to port 8080: http://docs.codehaus.org/display/JETTY/port80

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080


To save iptables configuration so it is restored on reboot, see https://help.ubuntu.com/community/IptablesHowTo#Saving%20iptables

Troubleshooting

503: Service Unavailable

When services on the VMs fall over this usually manifests as the proxy handing requests to the public address returning 503: Service Unavailable.

The usual solution is to restart jetty:

$ sudo /etc/init.d/jetty stop
$ sudo /etc/init.d/jetty start
(NOTE: ---/jetty restart does not work!)

Alternatively you can just reboot the VM and jetty should come up automatically.

Depending on how the web app initialises itself, it can take a little while (a minute, or so) after jetty has started for some web apps (e.g. maven) to start responding to requests. Others start almost immediately.

Login problems

There have been intermittent problems logging into the VMs via SSH. The VMs authenticate against the active directory and occassionally seem to stop talking to the domain controllers. Usually things start working again after some (varying) period of time. Adam believes (27/1/11) that having rebuilt one of the DCs that was playing up, things should be more reliable.

VM Offline

If you can't get an ssh connection to the VM then there is nothing you can do... This is an issue for the COs.

Notes

maven.ch.cam.ac.uk

hudson.ch.cam.ac.uk

hudlin

hudwin

opsin.ch.cam.ac.uk

chemtagger.ch.cam.ac.uk

login to www-chemtagger.ch.private.cam.ac.uk copy the webapp war file to /var/lib/jetty/webapps/root.war $ sudo /etc/init.d/jetty stop $ sudo /etc/init.d/jetty start