JMRI: Web Site
This page discusses technical aspects behind the JMRI web site at jmri.org and also providing parts of the help system in JMRI.
If you just want to know how to make a small change to a web or help page, please see the Updating JMRI Documentation instructions.
Structure of Information
We distinguish between three types of information on the main web site:
- User information which is useful at run time. This is made available both via our JavaHelp, and also directly by placing those files on the web.
- User information which is either not useful at run time, such as instructions for installing the software, or is too large for inclusion in releases, e.g. video clinics.
- Reference information from releases, such as decoder definitions, copies of scripts, JavaDocs, etc.
We provide these separately:
- Run-time user information is made available by putting the help system on the web site.
- Other user information is stored in our JMRI/website GitHub repository and placed directly on the web site.
- Reference information is put on the web site from their own repository locations, or created by automated Ant scripts during release builds.
Page formatting is done using CSS, originally set up by John Plocher. All pages should reference the CSS files for screen and printing from the "/css" directory. This also means that you should leave the formatting to the style sheets, and minimize the explicit formatting that you do in HTML directly.
Because we use our web pages in JavaHelp, there are some restrictions on use of tags. See our JavaHelp web page for more on this.
We are using server-side includes to provide consistent headers, sidebars and footers. This allows us to share HTML content between the web and the JavaHelp system used by the program itself. Each page will contain just content, plus includes for files named "Header", "Sidebar" and "Footer" which contain the navigation information. Eventually, all but a few index pages will have ".shtml" extensions. (The remaining index.html pages keep that name so that people who request just a directory URL will be served something useful).
We are using .htaccess files to do redirects when a web page is removed. This lets older bookmarks continue to work. The hardware/.htaccess file provides an example. For more information on the syntax, see the Apache mod_rewrite documentation.
The web site contains several separate areas:
- jython, resources, xml, web - these are taken directly from the directories of the same name in the JMRI/JMRI repository They are only occasionally referenced directly.
- help - also used for the JavaHelp system, this has the internal structure described below and on our JavaHelp page.
Another group are from the JMRI/website repository, and are checked out at the root of the web server.
- releasenotes - Specific information on each test and production release
- install - Information on how to install the JMRI software on various kinds of computers
- community - Clinics, web pages, and other community-contributed information
- images - (Images used by web pages)
- contact -
Finally, some of the site is generated from the JMRI source itself, as opposed to being contained in the source. The Javadoc is one such section, along with some of the human-readable information about defined decoders.
Updating the jmri.org site
Most of the web site contents is updated hourly from jobs running on one of the project's Jenkins build servers. The directories listed above constitute most of the site, and this content is updated from the JMRI repository without any additional work.
- static content from JMRI/JMRI repository, e.g. help, xml, etc in JMRI distributions
- static content from JMRI/website repository, e.g. website-only information
- static content from JMRI/website-legal repository, e.g. content around the JMRI-Katzer legal case
The regeneration of the Javadoc and xml content involves significantly more work than merely updating a directory, and so these are only done once per day, as needed, by the Generate Website job on the production Jenkins server.
Local Web Site: Mac OS X
If you want to host a copy of the JMRI web site on your local Mac OS X machine, follow these instructions to first configure the Apache server to do server-side includes, and then make a copy of the web site files available to the server.
A similar process may work for Linux (or even Windows) systems with Apache installed.
- To make sure that your local server has the right options enabled, edit the Apache web server's configuration file.
- On Mac OS X 10.4 (Tiger), this is the /etc/httpd/httpd.conf file
- On Mac OS X 10.5 (Leopard) and later, this is the /etc/apache2/httpd.conf file
To turn on server-side includes, find the section that
# This may also be "None", "All", or any combination of "Indexes", # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews". # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # Options Indexes FollowSymLinks MultiViewsAdd the word "Includes" to the last line so it looks like
Options Includes Indexes FollowSymLinks MultiViews
- Now, configure the server to handle files with ".shtml"
extensions. Find the section that looks like (the leading comment
may be different):
# # To use server-parsed HTML files # #AddType text/html .shtml #AddHandler server-parsed .shtmland un-comment the last two lines so that it looks like
# # To use server-parsed HTML files # AddType text/html .shtml AddHandler server-parsed .shtmlThen find the reference to the include_module and make sure it's loaded by a line like:
LoadModule include_module libexec/apache2/mod_include.soBy default, that's commented out with a leading # character.
- Finally, configure the server to allow .htaccess files to provide redirects.
We use this to allow people with old URLs in bookmarks to reach the right current pages.
Find a section that looks like:
DocumentRoot "/Library/WebServer/Documents" Directory "/Library/WebServer/Documents"There's an indented section directly below that. Find the part that looks like:
# # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride NoneChange the last line to allow overrides (which is what a .htaccess file does):
AllowOverride AllThen find the reference to the rewrite_module and make sure it's loaded by a line like:
LoadModule rewrite_module libexec/apache2/mod_rewrite.soBy default, that's commented out with a leading # character.
JMRI's web site uses index.shtml files as index pages. To make sure that those will display by default, e.g. if you use a partial URL like https://jmri.org/download, find the line containing "DirectoryIndex" and add "index.shtml" to the existing list of index-like file names.
We also want PHP turned on, so that the indices for the resources pages will work. Find the follow line and make sure it's not commented out:
LoadModule php5_module libexec/apache2/libphp5.so
- Install the JMRI files to be served:
- Check out both the JMRI/JMRI and JMRI/website repositories to somewhere on your computer. It's OK for these to be outside the web server's directory tree.
- Change to the web server directory
- Set symbolic links to bring in content from the two repositories:
~me/git/website/setSymLinks.sh ~me/git/JMRI ~me/git/websitewhere "~me/git/website" is the path to the JMRI/website repository that you just checked out, and "~me/git/JMRI" is the path to the JMRI/website repository. setSymLinks.sh sets up symbolic links that let your web server see the top of the JMRI web site as if the files were directly present.
- Restart your computer to reinitialize the web server.
- Test it by trying to display the URL http://localhost/index.shtml, which should get you a JMRI top-level page.
Installing a local XML catalogMany JMRI XML files contain XIncludes that reference other XML files with URLs like "http://jmri.org/xml/schema/types/turnouts-2-9-6.xsd". When a JMRI program encounters those, it automatically converts those to a local file reference. Other tools, like NetBeans and xmllint, don't know to do that.
Installing a local XML catalog, and then telling your tools to use it, can solve this.
- If you're not running a local webserver, you can provide a limited solution by copying the xml/catalog.xml file from your JMRI directory to an /etc/xml/catalog file. (Note that this is for Linux and Mac OS X and it's not clear what works for Windows; you might have to sudo to do this; that there's no .xml suffix on the resulting file; if there's already a file there you'll have to manually merge the contents; you'll have to update this periodically as JMRI continues to evolve)
Alternately, if you're running a local server as
you can provide a more generic solution by copying
the following to a /etc/xml/catalog file
(Note that this is for Linux and Mac OS X and it's not clear what works for Windows;
you might have to sudo to do this; that there's no .xml suffix on the
created file; and if there's already
a file there you'll have to manually merge the contents; but at least you won't
have to update this in the future!):
<?xml version='1.0'?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <rewriteURI uriStartString="http://jmri.org/xml/" rewritePrefix="http://localhost/xml/" /> </catalog>This catalog redirects all HTTP references to the "xml" directory at the JMRI website to the "xml" directory on your local web server.