AllegroServe at gw.sm6vyf.ampr.org

de SM6VYF/Arne.

gw.sm6vyf.ampr.org

This, gw.sm6vyf.ampr.org, old computer is dedicated to the task of being an interesting object for contacts via IEEE 802.11b. It is, however, also available via a tunnelled link from rupert.sk0bu.ampr.org and thus available to the rest of the net-44.ampr.org network.

XML

As can be read in another place the original source of the web pages is coded in XML, they therefore strictly comply to a simple grammar. The graphic layout is controlled by a couple of CSS files.

When creating the delivered HTML code the XML code is parsed by the XML parser and then the corresponding HTML code is generated through the lisp functions and the web server.

Some of the pages have a dynamic character and where I usually use PHP I now have the pleasure of using Lisp. Frankly, all of the pages are generated dynamically, which is a waste of what little server capacity there is...

Lisp

The Lisp I'm using is Allegro CL, of which one can download one of the trial editions that are available for a couple of different operating systems. The documentation is available on the net, but also comes with the trial edition. Included are also the web server AllegroServe and a XML/HTML parser. Everything installs easily. The user interface is usually through ELI in EMACS (c.f. this introduction of ELI).

The following files make up the system itself (the last three are for whatever server is used):

xslt.asd      ;system definition
main.cl       ;the file holding everything together
xslt.cl       ;XSLT functionality
addenda.cl    ;functions for dynamic pages
aserve.cl
portable.cl
modlisp.cl

When downloading will be made possible, all the files will be put amongst the other source code files.

To hold all the pieces together, I've chosen to use ASDF. This is a library to automate the compilation and loading of systems, i.e. Lisp programs which are usually composed of a couple of files which have to be compiled and loaded in a certain order - a similar system is the Unix make program. After the installation of ASDF the init file for ACL (~/.clinit.cl) should contain something like this:

;; -*- mode: common-lisp; package: cl-user -*-
;; 10.V.04 SM6VYF/Arne Stahre
(load "/lisppath/asdf/asdf")
(setf asdf:*central-registry* '("/lisppath/cl-library/"))

Also there should exist a link in cl-library to the systems definition file. After this the system is loaded using the following line:

(asdf:operate 'asdf:load-op 'xslt)

To speed up the start of the web server the created Lisp enviroment is dumped:

(dumplisp :name "xslt.dxl")

Accompanying this dump is a little file that states if logging is to be done and where to put this. Further it starts and keeps the server running:

;; -*- mode: common-lisp; package: cl-user -*-
;; 10.V.04 SM6VYF/Arne Stahre
;; Start server
(xslt:xslt :start t :log t :logfile "/logpath/aserve.log")
;; Hang in there...
(loop (sleep 100000))

When all this is done, it's time to go on to the operating system level.

Linux

The system is run under Linux, more precisely the SuSE distribution. Thus the following applies mainly to this distribution and some differencies compared to other distributions can occur.

Any way, when the Lisp part is done the web server is started using the following command:

/usr/local/acl62_trial/alisp -I /path/xslt.dxl -q -L /path/run.cl >/dev/null &

To be able to use port 80 it should be started as root. The server will then change to a different uid.

To make the starting automatic and occur at boot a script is needed (/etc/init.d/aserve) in SuSE Linux. There is a skeleton (/etc/init.d/skeleton) helping the composition of such a script. When the script is ready one creates a link in /usr/sbin: /usr/sbin/rcaserve -> ../../etc/init.d/aserve .

#!/bin/sh
# 10.V.04
# /etc/init.d/aserve
#
### BEGIN INIT INFO
# Provides:		aserve httpd
# Required-Start:	$local_fs $network 
# Required-Stop:	$local_fs $network
# Default-Start:	3 5
# Default-Stop:		0 1 2 6
# Short-Description:	Aserve httpd
# Description:		Start the Aserve httpd daemon
### END INIT INFO

LISP=/usr/local/acl62_trial/alisp

. /etc/rc.status

rc_reset

case "$1" in
  start)
    echo "Starting Aserve (httpd)"
    if /sbin/checkproc $LISP; then
      echo -n "-Warning: Aserve (lisp) is already running."
      rc_status -v
      exit
    fi
    /usr/local/acl62_trial/alisp -I /path/xslt.dxl -q -L /path/run.cl >/dev/null &
    sleep 8
    rc_status -v
    echo
    ;;
  stop)
    echo "Shutting down Aserve (httpd)"
    /sbin/killproc -TERM $LISP > /dev/null
    rc_status -v
    echo
    ;;
  restart)
    $0 stop
    $0 start
    rc_status
    ;;
  status)
    echo -n "Aserve (httpd) status: "
    /sbin/checkproc $LISP
    rc_status -v
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 1
    ;;
esac

rc_exit

Don't forget to make links in the suitable /etc/init.d/rc*.d directories, e.g. 3 and 5. In SuSE Linux this is easily done using the runlevel editor of Yast2.

After this the server starts at boot and visitors are welcome...

To do...

Some sort of cache for those files that have dynamic content. There is a cache in AllegroServe, but this is mainly for proxy.

So far the log files grow without bounds, at least if the server is visited, so some kind of handling, archiving, of log files is needed.

This page was created from XML using libxslt.

Validate me!

CVS: $Date: 2004/05/22 09:15:07 $