Fosm API server

fosm API server is a machine running Debian GNU/Linux 5.0. The API is implemented using GT.M 5.5 database. HTTP requests are handled by apache 2.2. The hard drives are part of a multi-disk array.

Instructions for installing the server on Debian/Ubuntu/Mint are available

File systems
Oct 2016: Filesystem            Size  Used Avail Use% Mounted on /dev/md1              924G  751G  127G  86% / tmpfs                 3.9G     0  3.9G   0% /lib/init/rw udev                   10M  660K  9.4M   7% /dev tmpfs                 3.9G  4.0K  3.9G   1% /dev/shm /dev/md0              856M   36M  778M   5% /boot

Components by folder
Most of the API code is in the /fosm folder.
 * data - storage of database. Approx 700Gb (Oct 2016).
 * fosm.conf - configuration information
 * gtm - symlink to gtm54
 * gtm54 - database executables
 * gtmx - provides the ability to have a GT.M process run with an arbitrary process name
 * journal - GT.M journaling files. Approx 2Gb (Oct 2016)
 * log - ?
 * planet - downloads and minutely updates. Accessible at http://fosm.org/planet/
 * scripts - scripts to handle queries and updates from the public website. Implemented mostly in M script.
 * serenji - M debugging tool
 * temp - Usually empty
 * tools - Usually empty
 * www - Public website http://fosm.org/planet/, available on github, /var/www/xapi symlinks to here

Services
xapi

Apache 2 Configuration
Fairly standard stuff. /etc/apache2/sites-enabled/fosm

It defines environment variables to specify the TCP port M server is using:
 * SERVER_LINK_IP = IP address of M server
 * SERVER_LINK_PORT = Port number on which M server is listening
 * SERVER_LINK_PASSPHRASE = ServerLink's passphrase

Scripts
The main API accesses the perl script /fosm/scripts/serverLink.cgi which passes the relevant environment variables and any POST data to the M server using a TCP connection. The results are passed back to the HTTP client.

serverLink.m is the main entry point for API requests.

xapi.gld maps from M global variables to database files.