Netbooting JBoss?

When it is distributed at SourceForge, JBoss is configured to load all of its services from the local machine. However, it is possible to produce a low-footprint installation where just a bootstrap loader needs to be installed on a local machine and the rest of the the configuration is loaded across the network. This is useful for:

  • Server farm configurations, where the workload is distributed to many individual machines
  • Cluster configurations, where a homogeneous configuration can simplify administration

Preparing a Configuration

In the base JBoss distribution, certain services are shipped as expanded archives. This is desirable when running on a local machine as it avoids the need to unpack the archive into the tmp directory to process its deployment. However, when these are hosted on a boot server, having to access the individual files in the archive over the network can impose substantial overhead. To avoid this, it is more efficient to copy the files locally inside a single archive and unpack them to a temporary for deployment. To achieve this, all unpacked directories should be converted to the equivalent archive.

This is the list of unpacked archives in the "all" configuration of JBoss 3.2.1:

  • http-invoker.sar
  • jboss-net.sar
  • jbossha-httpsession.sar
  • jbossweb-jetty.sar
  • jmx-console.war
  • jmx-invoker-adaptor-server.sar
  • jmx-rmi-adaptor.sar
  • jms/jbossmq-httpil.sar

To avoid unnecessary overhead, both on the network and the running instance, only the services that are actually required should be included in the configuration.

Preparing a boot host

The boot host can be configured in two ways:

  1. As a simple web server, which requires the URLs of every JAR and deployment to be explicitly defined in the hosted configuration.
  2. As a WebDAV enabled server, which allows the netboot client to scan locations on the server in the same way is scans filesystems on the local host.

Configuring a Simple Web Server

To boot from a simple web server, two entries in /conf/jboss-service.xml must be converted from scan locations to complete lists of URLs:

  • The "*" in the element must be replaced with a comma-separated list of the names of all the libraries needed from the /lib directory.
  • The deploy/ entry in the URLDeploymentScanner must be replaced with a comma-separated list of all the URLs that should be deployed.

Configuring Tomcat 4.1 as a WebDAV Server

If the boot host is using Apache Tomcat 4.1.X as a web server, WebDAV can be enabled simply by changing the default servlet for the web application containing the configuration to Tomcat's built-in WebDAV server. This can be done by adding the following servlet definition to web.xml:

  

webdav
org.apache.catalina.servlets.WebdavServlet

debug
0


listings
true


readonly
true




webdav
/

Configuring Jetty 4.2.9 as a WebDAV Server

Unlike Tomcat, Jetty does not have a built in WebDAV servlet. Instead a basic filter that implements just enough WebDAV functionality to act as a netboot host is included in the standard distribution; this can be found in the docs/examples/netboot/netboot.war application.

This filter lies over the top of the normal application content, intercepts WebDAV PROPFIND requests and returns listings of the relevant directories. This can be enabled using the following filter definition in web.xml:

  

DavFilter
org.jboss.netboot.TrivialDavFilter


DavFilter
/netboot/server/*

The TrivialDavFilter class should also be added to the classes directory of the host web application.

Preparing the Bootstrap

The bootstrap configuration comprises:

  • The run.jar from the bin directory of the version you wish to boot
  • The run.sh or run.bat script used to start JBoss

An archive containing the necessary files for JBoss V3.2.1 can be downloaded from https://coredevelopers.net/netboot/boot.zip

Booting from a Web Server

To boot from a Web Server, the --netboot option should be specified on the command line:

$ ./run.sh --netboot http://server/path/to/dist

Coming soon: a live netboot host at https://coredevelopers.net/netboot