Setting up Jetty for Upgrades

Plan for change.

Note: this article refers to Jetty-7

If you set up a lot of Jetty sandboxes, here is a sample structure to make it easy to upgrade to a new version of Jetty without having to reinstall all applications. The trick is to have a number of Jetty sandboxes pointing to a symbolic link, which in turn points to the latest version of Jetty.

Download Jetty

Get latest version of Jetty from http://www.eclipse.org/jetty/downloads.php Check signature. Decompress. Untar.

Now create a symbolic link to this latest version

Create a sandbox

A sandbox refers to a directory where you are testing a web application. Portions of the sandbox are linked back to the latest version of Jetty. Other portions are copied from the latest Jetty. Finally, some portions of the sandbox are original to it.

At this point, we must configure the sandbox. There are two steps to adding a WAR file:

  1. Copy WAR file to jetty.sandbox/webapps
  2. Create a context file (.xml) located in jetty.sandbox/contexts to enable application. Look at jetty-7-latest/contexts for inspiration.

Finally, start jetty.

Obviously, there is more to configuring and running Jetty. You can get more information by starting at the Jetty Homepage.

Upgrading

When a new version of Jetty becomes available, repeat the first step. Download, verify, decompress and untar the latest version, alongside the first version. Then, change the symbolic link of latest Jetty distribution to the new one.

Now, all sandboxes are pointing at the latest libraries. Restart all sandboxes.

Unless major changes have occurred in configuration files, this trick should let you upgrade painlessly.

Leave a Reply

Your email address will not be published. Required fields are marked *