Developer's Guide to the e-Lab Webapps
The e-Labs are JSP webapps, served by Tomcat from the
i2u2-prod VM, with a development backup on
i2u2-dev.
Tomcat
See entry:
Tomcat
Tomcat can be a complex installation. The "business" directory that the e-Lab files are served from, though, is
Ubuntu 14.04 /var/lib/tomcat{X}/
This is what we symlink
~quarkcat/sw/tomcat
to on the VMs and in the local development setup. Tomcat has a standard directory configuration where individual webapps are stored in self-contained folders within the
/var/lib/tomcat{X}/webapps/
directory. In our case,
webapps
├── css
├── elab
├── graphics
├── ilab
└── ROOT
[Online documentation often refers to .war
files within the webapps/
folder. This is an alternate way of packaging a webapp that we don't use.]
The name of a webapp's folder defines what's referred to as its "Context" for JSP code. Under normal configuration, Tomcat makes a directory
webapps/myapp/
available as www.domain.com/myapp/. In our case, the
elab/
and
ilab/
webapps are accessible as www.i2u2.org/elab/ and www.i2u2.org/ilab/, respectively. The
webapps/ROOT/
directory is Tomcat's pre-installed default webapp, what Tomcat returns when it receives a request like www.i2u2.org/ with no webapp directory given. By default, if no file is specified in the URL, Tomcat looks for an
index.html
or
index.jsp
file. Thus, requests for www.i2u2.org/ return
webapps/ROOT/index.html
, which is the e-Labs home page.
Our use of the
webapps/
directory is a bit idiosyncratic. We keep the front page of the site in the default
webapps/ROOT/index.html
, but we serve the rest from the
webapps/elab/
directory. In addition, the directories
webapps/css/
and
webapps/graphics/
are not webapps and are not directly web-accessible (a directory within
webapps/
must have a
WEB-INF/web.xml
file in order for Tomcat to recognize it as a webapp). I believe (Joel) that it's not standard practice to keep such resources directly in the
webapps/
folder.
Java
The e-Labs are, fundamentally, Java code. The source code includes our own package gov.fnal.elab, found in the repo at
common/src/java/gov/fnal/elab/
as well as several other libraries.
elab.properties
The
elab.properties
file contains parameters used by the e-Labs Java and JSP code. Its existence is meant to make the e-Labs more portable among servers and to facilitate making new e-Labs on an existing setup.
Unfortunately, searching the repostitory for "elab.properties" turns up multiple files, and
none of them are the actual properties file of the relevant server. To alter the properties of an e-Lab on a given server, you must edit
~quarkcat/sw/local-settings/common/resources/classes/elab.properties
This file
does not deploy with the rest of the code base. It must be manually placed on each new e-Lab server and edited
in situ.
-- Main.JoelG - 2017-03-09