Headless Swiki HOWTO

or,
How a complete Smalltalk and Squeak novice
set up a headless Swiki Server

A Swiki is a Squeak Wiki, Web Server implemented in the Squeak implementation of Smalltalk that allows all its users to update its web pages and add new web pages easily through their web browsers.

A headless Swiki is one running in a headless Squeak; that is, a Squeak that does not have a connection to an X server. This allows the Swiki to run in the background, on a server without an X display, or be started up automatically when the server boots.

I did this under Linux, but the procedure should be extremely similar for other Unix systems. The procedure looks long and complicated, but onlybecause I've specified a lot of the details that should be obvious. It is actually pretty simple.

  1. Download the necessary files.
    Start looking at http://www.squeak.org/ for the necessary files.
    1. Download the 2.4c Squeak Sources, image, and changes, and Squeak VM source.
      I dowloaded them from the master squeak site: http://www-sor.inria.fr/~piumarta/squeak/.
      I got:
    2. Download the PWS server templates for Swikis. Start looking at the Pluggable Web Server page, http://www.cc.gatech.edu/fac/mark.guzdial/squeak/pws/ .
      I got:
  2. Extract Squeak files.
    1. Create directory. In this example we'll use /home/jrandom/SwikiSqueak/ and we'll call it our SwikiSqueak directory.
    2. Copy the Squeak sources, image, and changes files into that directory.
    3. Gunzip the Squeak sources, image, and changes files.
    4. Extract the VM Source in that directory.
      I did:
      tar -xzvf download-directory/Squeak-2.4c-src.tar.gz
      This creates a directory like 2.4c in the directory.
  3. Build the normal and headless Squeak Virtual Machines.
    1. cd into VM Source directory.
    2. Build the normal Squeak VM.
      Execute the following command (modify for non-bash shells):
      $ (time make) 2>&1 | tee Log.make
    3. Copy the resulting VM executable and dynamic load libraries (*.so) to your SwikiSqueak directory.
    4. Build the headless Squeak VM.
      Execute the following command (modify for non-bash shells):
      $ make clean; (time make CFLAGS='-DHEADLESS') 2>&1 | tee Log.make-headless
    5. Copy the headless VM executable to your SwikiSqueak directory.
  4. Create a squeak shell script to execute the proper executable.
    Here is what ours looks like:
    #! /bin/bash
    cd /home/jrandom/SwikiSqueak
    if [ "$1" = "x" ]
    then # Start up with an X display
    H=
    shift 1
    else # Start up without any display
    H=h
    fi
    ./SqueakVM-2.4c${H}-i386-linux-2.2.5-15 -m64m Squeak2.4c.image "$@"
  5. Set up the Swikis.
    1. Extract server.tar in your SwikiSqueak, creating the Server subdirrectory.
    2. Create subdirectorys for each swiki you want in the Server subdirectory.
      We'll create two:
      $ mkdir Server/FOO-Swiki
      $ mkdir Server/BAR-Swiki
    3. Create a file called ChangeMethods.cs that contains code to change the serverDirectory method to your SwikiSqueak Server subdirectory. Here are the contents of ours:
      !ServerAction class methodsFor: 'System Services' stamp: 'tk 1/19/98 12:52'!
      serverDirectory ^ '/home/jrandom/SwikiSqueak/Server/'
      ! !
      !ServerAction class methodsFor: 'System Services' stamp: 'tk 1/19/98 12:52'!
      defaultFile ^ 'index.html'
      ! !
    4. Create a file CreateSwikis.st to create the Swikis.
      Here are the contents of ours:
      PWS initializeAll.
      SwikiAction setUp: 'FOO-Swiki'.
      SwikiAction setUp: BAR-Swiki'.
      PWS stopServer.
    5. Create a file called SnapSwikis.st to contain the code to create a snapshot that will automatically start the Swiki servers.
      Here are the contents of ours:
      Smalltalk snapshot: true andQuit: true.
      PWS initializeAll.
      SwikiAction new restore: 'FOO-Swiki'.
      SwikiAction new restore: 'BAR-Swiki'.
      PWS serveOnPort: 8080 loggingTo: 'log.txt'.
    6. Start squeak up with an X display so you can interact with it.
      Execute the following command:
      $ ./squeak x
    7. Open a file list
      Click the left button on the squeak root window, select the open menu option, and select the file list menu option.
    8. Select the ChangeMethods.cs file in the file list.
    9. Select the fileIn window menu item.
      Move the cursor into the scrollbar of the filenames pane, click the left button when the cursor changes to a minature menu, and select the fileIn menu option.
    10. Open a workspace.
      Click the left button on the squeak root window, select the open menu option, and select the workspace menu option.
    11. Select the CreateSwikis.st file in the file list.
      This will display the contents of the file.
    12. Copy and paste contents of CreateSwikis.st from the file list file display pane into the workspace.
      Select all the text in the file list file display pane by dragging with the left mouse button, copy using Alt-C, select the workspace window by clicking the left mouse button in it, and paste using Alt-V.
    13. Execute the contents of workspace.
      Select all the text of the workspace and press Alt-D.
    14. Delete contents of workspace.
      Select all the text of the workspace and press the appropriate delete key, which may vary depending on your X setup. I used the backspace.
    15. Select the SnapSwikis.st file in the file list.
      This will display the contents of the file.
    16. Copy and paste contents of SnapSwikis.st into the workspace.
    17. Execute the contents of workspace.
      At this point the running X squeak exits.
  6. Start up the headless Swiki server
    Execute the following command:
    $ ./squeak
    At this point the headless swiki servers start!


Back to TKB's Home Page.

T. Kurt Bond, tkb@access.mountain.net
Last modified Thursday, 29 July 1999 at 11:15 pm by tkb@access.mountain.net