CUCC Expedition Handbook: Server

The Expo server

Troggle is the software which runs the the expo cave survey data management and website. It is not the only thing running on the expo server.

Server configuration: directory structure

This is the folder structure of the repo :expoweb: which is also the root of the website. Note that the webserver (apache) presents many more apparent folders, such as expofiles, than there are folders because that's what it and troggle do.

In the list below only the handbook folder has been expanded. The years folder includes 42 subfolders from 1976 to 2022.

The handbook illustrates the i/t/l idiom whereby an image file (i) is displayed with a paragraph of text as an HTML file (l) and there is a thumbnail image (t) which is included in another document, e.g. see the photographic guide to the walk from the toll road car park.

CSS and HTML

The expoweb repo contains all the HTML files and basic CSS files. The troggle repo contains the HTML templates, CSS for the troggle report pages generated dynamically and a copy of the CSS, thumbnail images and javascript for the Django admin package which has to be available under the url '/site_media/' (which resolves to expo/troggle/media/) for the admin system to work.

See the live report on which urls resolve to which actual folders at pathsreport.

Server configuration: software

* These are essential to make troggle work at all.

You will also need everythingto run Django, as documented in troggle laptop including all the python modules listed there and installed using pip.


Now, if you don't know your wsgi from your asgi, read this article first on how to generically configure a Django server in the simplest possible way.


The server configuration scripts are in the file troggle/debian/serversetup and are also documented with notes in troggle/README.txt. It is intended that the full documentation will be copied here in due course.

It is hoped that we will develop fully automated server setup scripts (such as are used by CUYC for their Django system)

Apache needs to run as user 'expo', not 'www-data' as standard. This is due to a basic incompatibility in permissions between apache and git: git does not honour existing permissions exactly. See How to run apache as an alternate user.

Although troggle will appear to work with sqlite database, it needs a proper concurrrent access database to manage multiple users. sqlite is single-user (effectively a separate instance of django is created for each page access, so even one person looking at several pages at once is "multi-user").

The folder structure on the server is as shown below. It is all in the user folder for the user expo i.e. in
/home/user/expo:

expofiles

expofiles contains ~40GB of files which are published by the webserver but which are not parsed by troggle. 28GB of these are photographs in /expofiles/photos/ and there are over 4GB of scanned images of surveys in /expofiles/surveyscans/. There is a cleaned, complete copy of the documentation for the tunnelX cave plan drawing package in /expofiles/tunnelwiki/.

Javascript

There are javascript packages installed directly on the operating system on the server, i.e. in
/usr/share/javascript which are used by some expoweb pages: These javascript packages are not documented but some are mentioned in the soft dev laptop configuration.

Currently installed on the server (October 2021) are the following javascript packages which are not used at all by troggle or any of the expo website:

Presumably these are used by something else hosted on the server ? Anyway, if you are setting up a new troggle sever you don't need them.

Search: xapian

Installed independently of troggle simply with apt install xapian-omega and then configured into the troggle-generated menus in css/main2.css. You can see it at the bottom of the top-left menu on this page and on nearly all pages of the handbook. The function is connected with an apache configuration ScriptAlias /search /usr/lib/cgi-bin/omega/omega in ~expo/config/apache/expo.conf. Installed by Wookey in May 2020.

Planning: kanboard

This is installed on the server and accessed at /kanboard It is an open source equivalent of the Trello kanban card task planning system. The 2022 expo uses Trello itself (separate login required) but we intend to move to our own kanboard from 2023.

boe

This is a perl script, and served by the webserver using the url apache configuration

#bank of expo
#current expedition
ScriptAlias /boe /home/expo/boe/boc/boc.pl
<Directory /home/expo/boe/boc>
        AddHandler cgi-script .pl
        SetHandler cgi-script
        Options +ExecCGI
        Require all granted
</Directory>
in ~expo/config/apache/expo.conf.

Handbook documentation for its use is at The Bank of Expo.

cgit - web interface to server git repos

This is a compiled executable written in C which, like boe, is installed as an Apache CGI redirection. The installation instructions are at https://git.zx2c4.com/cgit/tree/README but we use the Debian package https://packages.debian.org/stable/cgit.

cron - automatically run tasks to schedule

This is currently disabled in Feb. 2022. If you need anything that would be done frequently (e.g. bins) you currently have to run it manually.

The server runs it's hourly, daily and weekly scripts using the anacron system. In ~expo/config/cron/ on the server, there are expo.hourly and expo.daily scripts and these are (or should be) launched at the appropriate times by the server root from /etc/crontab. This is not obviously working on the server at present.

Running a test Troggle server

For high volume use, Troggle should be run using a web server like apache. However, a quick way to get started is to use the development server built into Django. This is limited though: directory redirection needs apache so CodeMirror and CaveView won't work as the url /javascript/ will not exist.

To do this, run $ python manage.py runserver 8000 -v 3 from the troggle directory. This runs it on port 8000 so you see the website at http://localhost:8000/

gunicorn also works. This runs with 9 workers (suitable for a 4-core processor, -w takes n+1 where n is the number of cores of your processor): $ gunicorn --reload -w 9 -b :8000 wsgi


Return to: Troggle design and future implementations
Return to: Troggle intro
Troggle index: Index of all troggle documents