Setting up a Web Server daemon for SDDAS


written by Joey Mukherjee - joey@swri.org
Last Updated - 01/08/01

Table of contents

  1. Overview
  2. Getting Started
  3. SDDAS required CGI commands
    1. Hello
    2. FileGet
    3. EntriesGet
    4. ShareProjects
  4. Appendix A - configuring Apache for SDDAS
  5. Appendix B - converting the old promotion way to the web

Overview

SDDAS is able to make use of a web daemon for server sites. This document will go through the process of setting up a server site for SDDAS, using a web server such as Apache.

Knowledge of a scripting language and system administration of a web server are assumed. We use PERL and Apache which work well.

Getting Started...

You must have a machine outside a firewall which can serve the web port 80. It does not have to serve web pages, but it must be able to run CGI-BIN programs. Furthermore, you must designate a directory to hold CGI programs which are to be run via the alias "sddas". In the past, this was hardcoded as the "ServerCmds" directory.

Being a server site requires administration on the server end. You must tailor the scripts included (or write your own) to handle the requests sent by clients.

The scripts provided are merely examples and WILL NOT WORK!!!

We have included csh scripts, but you made need a stronger scripting language like PERL or Tcl/Tk to really do the stuff you need to do.

SDDAS required CGI programs

Currently, these commands are required to serve data:

  1. Hello.cgi - describes the server.
  2. FileGet.cgi - This will produce a file given a hierarchy and a time.
  3. EntriesGet.cgi - This will produce the meta data given a hierachy and a time.

Hello

This is a nice test program which just tests the server. We wish to use it a document which describes the server being used. We will eventually have a "Server Browser" program which can go through and use this information to describe the various servers to the user.

For now, simply write some text describing the server and the type of data served out to standard output.

FileGet

FileGet.cgi will receive commands in this format :

<type> <P> <S> <E> <I> <V> <Year> <Day> <Millisecond> <Pre-Processing Flag> <Post-Processing Flag> <Label>

With this information (and only this information from the client), FileGet.cgi needs to know enough of your own system of where to get the data from. This can be as simple as going to a directory on the hard disk and then "cat"ting the file to stdout. For some of our servers, the file is kept on mag-optical disks and the server determines which mag-optical the file is on and retrieves it from there.

Before sending the file, you must tell the web client that the file being sent is a binary file and the file size of that file. To do that, simply print:

Content-type: binary
Content-length: <filesize>
<blank line>

before sending the file.

EntriesGet

EntriesGet.cgi will receive commands in this format :

<P> <S> <E> <I> <V> <Start Time> <Stop Time>

EntriesGet.cgi must look at your master databases and return the meta data available in that range. Some example source code is available for this.

ShareProjects

ShareProjects is used by the ProjCfg program to promote new projects into local databases. This is possibly the simplest command of all since all it has to do is list the projects it holds in the same format as the PROJECTS.cfg file. This can be done by just "cat"ting the PROJECTS.cfg file to stdout.

Appendix A - setting up Apache to serve SDDAS data

Apache is very easy to set up for CGI-BIN scripting. This is done through the ScriptAlias directive. Simply add a line into the httpd.conf file in the ScriptAlias section that says:

ScriptAlias /sddas/ <scripts directory>

Appendix B - converting the old way to the new way

After you have the web server setup, and the script directory pointing to the right place, you need to change your scripts. Every CGI program has to send out a header telling the web server what type of file you are about to send. For the FileGet, its a binary file, so add the lines as described above. All other scripts send plain text, so add the line:

Content-type: text/plain

before executing the rest of the script.

I believe that's it!