For a while at $WORK in our Development and QA environments we were running multiple apps within one Jetty6 container. This works well, but isn’t always convenient – when restarting the container, the other apps in the container are obviously down. So here are the steps we’re using to setup separate containers on one server on Ubuntu 8.04 Server.
- Install Jetty6 using the Debian packages from mortbay.org and enable it by changing
NO_STARTin /etc/default/jetty6 to
- Copy /usr/share/jetty6 to /usr/share/jetty6-[project]; this is now $JETTY_HOME for this container
- Delete the symlinks to directories in the new $JETTY_HOME and replace them with directories; if existing directory has contents (ie /etc/jetty6 linked to /usr/share/jetty6/etc) then copy the contents as well
- Update the line defining jetty.home in $JETTY_HOME/etc/start.config to the new $JETTY_HOME
- Update the line defining jetty.port in $JETTY_HOME/etc/jetty.xml to an unused port
- Update $JETTY_HOME/jetty.conf to use $JETTY_HOME/etc/ for loading config files instead of /etc/jetty6/
- Deploy a test app into $JETTY_HOME/webapps
- Try starting the new container, we do it like this:
sudo JETTY_HOME=/usr/share/jetty6-[project] /etc/init.d/jetty6 start
- If everything is working (and I haven’t forgotten any steps in this description), your app should start and you should have request and stderrout logs in $JETTY_HOME/logs
There’s a significant drawback to this setup for a Production environment, in that the default container will start on reboot but the additional containers will not, unless you create separate startup scripts (or kludge them into /etc/rc.local). As we’re only using this for Development and QA this isn’t a big deal for us – our Production servers use the default Jetty setup.
[Update - forgot to include that you need to specify a different PID file as well, otherwise you’ll have colliding /var/run/jetty.pid files. The /etc/init.d/jetty6 script uses JETTY_PID for this setting, so you can override just like JETTY_HOME]