
	$Id: INSTALL-servers,v 1.9.2.7 2004/07/07 16:56:55 jimg Exp $

PREFACE

  This is a general guide to installing DODS/OPeNDAP data servers. Some
  servers may have specific requirements beyond these; look for an
  INSTALL-<server> document in this directory or in the source code directory
  if you down-loaded the source code.

  Though not absolutely essential, it will be useful to understand the
  structure of the software. You can find general descriptions of the system
  and how the pieces fit together in the User's Guide, available from the
  OPeNDAP home page: http://www.opendap.org/.

  Updated for version 3.4 of the OPeNDAP software.

-----------------------------------------------------------------------------

CONTENTS

Recent Changes

About WWW Servers

Setting Up a Data Server
Quick Instructions
Serving Compressed Files 
More Sophisticated Installation
  Usage information
  Logging accesses

Server Installation Tips
  Tip 1: Which directory is the cgi-bin directory?
  Tip 2: Which directory is used by your WWW server as the document root?
  Tip 3: How can I avoid copying all my data into the document root?
  Tip 4: How do I write a URL for some archive's data?
  Tip 5: How do I add additional descriptive information about my dataset?
  Tip 6: How do I set up a server that limits access to only a few people?
  Tip 7: Is there a registry of datasets?
  Tip 8: Customizing the DODS Directory response (from Joe McLean)

More Questions

-----------------------------------------------------------------------------

Recent Changes

The server configuration file dods.ini is now called dods.rc. This name
change brings the file in line with the other configuration files used by
OPeNDAP software. Previously the configuration file was just used to match
'handler' programs to data source (usually files). However, with the 3.4
release we've migrated all the configuration information into this file
(except for the experimental statistics software). The dods.rc file has
comments which explain the various paramters.

We've reduced our dependence on some Perl modules by replacing them with a
compiled (C++) program called 'curl.' If you're upgrading a server, make sure
you get this or features like ASCII and HTML responses will not work.

We have had some issues in the past with serving data from files that are
compressed using UNIX compress or gzip. See the special section below about
serving these types of files for important configuration information!

-----------------------------------------------------------------------------

About WWW Servers

  We have extensively tested the servers Apache HTTP daemon (httpd). Other
  servers will work as along as they support CGI 1.1 standard. However, the
  installation instructions will be slightly different. Don't let this
  dissuade you from installing the servers with another httpd - the process
  is very simple. Other groups have used the NCSA, CERN and Netscape web
  servers successfully.

  If you do not have a World Wide Web server running on the machine you want
  to use as your data server machine, you can The Apache daemon can be found
  at http://www.apache.org/.

-----------------------------------------------------------------------------

Setting Up a Data Server

Quick Instructions

  Run the program `installServers' which is found in the $(DODS_ROOT)/etc/
  directory.  It will ask you which servers you want installed, where the
  CGI bin directory of your WWW server is located, and whether to install
  the files that are used by all servers.  See below if you don't know the
  answers to these questions. 

  The 'OPeNDAP server' we provide is actually broken into several components,
  each of which is currently (version 3.4) implemented as a separate file.
  There are several Perl modules and binary executables that form the common
  code of the server. In addition, for each different format the server
  supports there is a separate 'handler' executable. The server uses a
  configuration file named dods.rc'. Once the server is installed, you
  should check over this file and ensure the values make sense for your site.
  The file is not long.

  You must put your data into your server's `DocumentRoot' directory, or you
  must provide a link from that directory to the directory containing your
  data.  If you choose the latter, make sure your server can follow symbolic
  links.  (For the Apache server, this means turning on the `FollowSymLinks'
  attribute in the access.conf file.)

  See the SERVER INSTALLATION TIPS section below for information on how to
  locate your web servers cgi-bin and document root directories and also how
  to allow for linking your data directory into the document root.  For more
  details on server installation, see the SIMPLE INSTALLATION section below.

The dods.rc Configuration File

  The dods.rc configuration file is used to tailor the server to your site.
  The file contains a handful of parameters plus the mappings between
  different data sources (typically files, although that doesn't have to be
  the case) and hander-programs. The format of the configuration files is:
  
     <parameter> <value> ... <value>

  The configuration file is line-oriented, with each parameter appearing on
  its own line. Blank lines are ignored and the '#' character is used to
  begin comment lines. Comments have to appear on lines by themselves (you
  cannot tack a comment on to the end of a line that contains a parameter).

  The parameters recognized are:

  timeout <seconds>

  This sets the OPeNDAP server timeout value, in seconds. This is different
  from the httpd timeout. OPeNDAP servers run independently of httpd once the
  initial work of httpd is complete. This ensures that your OPeNDAP server
  does not continue indefinitely if something goes wrong (i.e., a user makes
  a huge request to a database). Default is 0 which means no time out.

  cache_dir <directory>

  When data files are stored in a compressed format such as gzip or UNIX
  compress, the OPeNDAP server first decompresses them and then serves the
  decompressed file. The files are cached as they are decompressed. This
  parameter tells the server where to put that cache. Default: /usr/tmp.

  cache_size <size in MB>

  How much space can the cached files occupy? This value is given in
  MegaBytes. When the total size of all the decompressed files exceeds this
  value, the oldest remaining file will be removed until the size drops below
  the parameter value. If you are serving large files, make *sure* this value
  is at least as large as the largest file. 

  maintainer <email address>

  The email address of the person responsible for this server. This email
  address will be included in many error messages returned by the server.
  Default: support@unidata.ucar.edu.

  exclude <handler> ... <handler>

  This is a list of handlers whose regular expressions should *not* be used
  when building the HTML form interface for this server. In general, this
  list should be empty. However, if you have a handler that is bound to a
  regular expression that is very general (such as .* which will match all
  files), then you should list that handler here, enclosing the name in
  double quotes. See the next item about the 'handler' parameter. Default: by
  default, no handlers are excluded.

  handler <regular expression> <handler name>

  The handler parameter is used to match data sources with particular handler
  programs used by the server. In a typical OPeNDAP server setup, the data
  sources are files and the regular expressions choose handlers based on the
  data file's extension. However, this need not be that case. The OPeNDAP
  server actually matches the entire pathname (starting at the HTTP Document
  Root) of the data source when searching for the correct handler to use. The
  regular expressions are Perl regular expressions; the examples in the
  sample dods.rc file should get you going. If you need something ore complex,
  consult a good book on Perl or contact us at support@unidata.ucar.edu.

Serving Compressed Files 

  Here is some important configuration information for people serving data
  from compressed files. If your server is not handling compressed files
  correctly, changing the options as described here will likely fix the
  problem.

  When the OPeNDAP software is used to serve compressed files (e.g. files
  compressed using gzip), the files are first decompressed and then stored in
  a cache; data served are read from those cached files. The location of the
  cache directory is /usr/tmp by default. This can be changed by editing
  nph-dods and changing the value of $cache_dir. The software is set by
  default to limit the size of this directory to 50 MB. However, if you're
  serving large files, or are experiencing a large volume of traffic, you
  should increase this. To do so, edit the value of of the second parameter
  to 'purge_cache()' on line 125 of nph-dods. The cache size is given in MB,
  so changing the 50 to 100 would increase the cache size from 50MB to 100MB.
  Finally, the decompression software uses the gzip program to do its work.
  If your computer does not have the gzip program in its /bin directory
  you'll need to edit the DODS_Cache.pm so that the correct version of gzip
  is used. Look in that file for "/bin/gzip" and replace that text with the
  correct pathname. To figure out where gzip is on you computer, type 'which
  gzip' in a shell.

More Sophisticated Installation (But Just A Tiny Bit)

  Usage information

  The `usage' program, placed in the directory with the rest of your server's
  helpers, provides a way for you to supply additional information about your
  dataset that others can browse - it generates HTML output. See the User
  Guide for more information about the usage service, including how to add
  custom information to the returned usage message.

  Logging accesses

  Since an HTTP daemon logs all accesses, every access to data through your
  OPeNDAP server is logged. However, to collect information about
  project-wide data use, that information needs to be collated. We have built
  an optional module that scans your daemon's local access and error logs for
  just the information about OPeNDAP activity. This optional module provides
  for remote access top this OPeNDAP-only information. That is, the
  information can be accessed by your computer and some computers at Unidata,
  URI and OPeNDAP, using tools like a browser or wget. The installServers
  script will ask if you're willing to allow us access to this information
  (and it only asks if you've chosen to register you server with us).

  However, you can configure the remote stat access module by hand fairly
  easily. In the distributions etc directory, edit the file called
  DODS_STATISTICS. This file holds the pathname to you server's access and
  error logs as well as its name. Once you have edited DODS_STATISTICS, copy
  that file to the directory that contains the OPeNDAP server.

  If you are using virtual hosts with the web deamon that runs the OPeNDAP
  server, the remote stats access module can only be configured to provide
  access to one set of log files.

Server Installation Tips

  The following tips are mostly specific to the Apache server.  The NCSA web
  server shares some of the same configuration options, and the advice is
  often transferable.  For other web servers, this advice may be only of
  general, or possibly little, help.

Tip 1: Which directory is the cgi-bin directory?

  Look in the server's `httpd.conf' file for a line like:

    ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/

  For both the NCSA and Apache servers, the option ScriptAlias defines where
  CGI (Common Interface Gateway) programs may reside.  In this case they are
  in the directory /usr/local/etc/httpd/cgi-bin.  With this script alias in
  effect, URLs with `cgi-bin' in their path will automatically refer to
  programs in the specified directory.

Tip 2: Which directory is used by your WWW server as the document root?

  Look in the http.conf file for a line like:

    DocumentRoot /usr/local/spool/http

  This says that the document root directory is /usr/local/spool/http.  URLs
  that contain only the machine name and a file name, such as:
  
    http://dods.gso.uri.edu/info.txt

  refer to files in the document root directory.  For example, with the
  above DocumentRoot declaration, and the above URL, the file specified is:

    /usr/local/spool/http/info.txt

Tip 3: How can I avoid copying all my data into the document root?  Can't I
  link to it?

  By default many servers disable soft (symbolic) links that point out of
  the directories that fall under the web server's document root.  This is
  not done for inconvenience, it is a security feature (really).  To disable
  this feature, and allow links to other directories, you'll have to edit
  the httpd.conf file, and add the `FollowSymLinks' option to the directory
  trees which will contain the links to data. This sounds more complex than
  it is.

  For example, suppose that you have a large dataset stored in a directory
  named `/archive1'. Under that directory are many files and taken together
  they are far too large to copy into the WWW server's document root. First
  look in access.conf and see that FollowSymLinks is set for the WWW server's
  document root. It will look like:

    <Directory /usr/local/spool/http>
    Options Indexes FollowSymLinks

  There may be some blank lines and comments between the two.  If
  `FollowSymLinks' is not on the `Options' line, add it, just like in the
  example above. Once that is done, create a symbolic link from within your
  WWW server's document root to `/archive1' (use `ln -s'). You're done.

Tip 4: How do I write a URL for some archive's data?

  One question about your server you will likely be asked is "How do I
  write one of those URLs for your data?". Here's how to answer that
  question. The URLs have the form:

    http://<machine name>/<cgi dir name>/<pathname>

  Suppose that you have copied the HDF server to /usr/local/etc/httpd/cgi-bin
  and soft linked a set of files in /usr/local/spool/http/data on the machine
  `dods.gso.uri.edu'. A partial directory listing of that is:

    S2000414.HDF   S2000436.HDF   S2000458.HDF   S2000480.HDF   S2000502.HDF
    S2000415.HDF   S2000437.HDF   S2000459.HDF   S2000481.HDF   S2000503.HDF
    S2000416.HDF   S2000438.HDF   S2000460.HDF   S2000482.HDF   S2000504.HDF
        .              .              .              .              .
        .              .              .              .              .
        .              .              .              .              .

  A URL that references the first file would be:
  
    http://dods.gso.uri.edu/cgi-bin/nph-dods/data/S2000414.HDF

  The part of the URL that reads `cgi-bin/nph-dods' selects the server and
  the section `data/S2000414.HDF' chooses the file. Note that the WWW
  server's document root is /usr/local/spool/httpd and the files are stored
  in a subdirectory within that named `data'. On the Web URLs are rooted at
  the DocumentRoot directory so the `/usr/local/spool/http' part of the
  pathname is implicit and should not be part of the URL. Since the directory
  `data' is under the document root directory it *is* included in the URL.

Tip 5: How do I add additional descriptive information about my dataset?

  The best way is to use the `usage' service.  This service returns
  information to the client about the server, but it can also return an HTML
  document you write to describe your server or any dataset served.

  To describe any special features of a particular data server, write an
  HTML document describing that server, and put it in a file named
  <root>.html in the cgi-bin directory that holds the server programs. The
  only special thing about this file is that you should include only those
  HTML tags that would fall between the <body> and </body> tags. Thus it
  should not contain the <html> <head> <body> or their matching
  counterparts.

  To provide HTML for a class of files you'd create an HTML file whose name
  is based on the names of the data files you want to describe. For example,
  a file that would be used for all the HDF files used in the previous
  section's example would be S.html. This file should be located in the
  directory where the data is located.  You could also create an S20004.html
  and an S20005.html to distinguish between the different sets of HDF files.

  Users access this information by appending `.html' to a URL. For example to
  get the HTML page for the URL used in the previous section, you'd type:

    http://dods.gso.uri.edu/cgi-bin/nph-hdf/data/S2000414.HDF.html

  Note: the Usage server will return important information about your data
    set even if you do not write custom HTML files for it. IF you do write
    those files they will be concatenated with the default information
    returned by the usage server.

Tip 6: How do I set up a server that limits access to only a few people?

  Briefly, it is easy in practice to set up servers so that only a particular
  group can access data using them. The specific mechanisms you have at your
  disposal will depend on the WWW server you use. See the file
  README-security (found in the DODS/etc directory) for information on
  installing `secure'servers with Apache.

Tip 7: Is there a registry of datasets?

  You can register your data set(s) with the us using our web page. Goto
  http://www.opendap.org/data/addtolist.html. Our list of available datasets
  can be found under the 'support' heading of our web page by following the
  'Sources of data' link in the left-hand panel. There's also a link to the
  list of data sources on the front-page left-hand panel.

  You can also register your dataset with the Global Change Master Directory
  (http://gcmd.gsfc.nasa.gov/); they maintain a list registered
  DODS/NVODS/OPeNDAP data sets.

  The GCMD has a special portal dedicated to datasets accessible using OPeNDAP
  servers at http://gcmd.gsfc.nasa.gov/Data/portals/dods/.

Tip 8: Customizing the Directory response (from Joe McLean)

  After messing around with Apache for a few hours, I have found some
  configuration directives that may be of use in beautifying the
  appearance of a directory on your user's Browser.

  example: http://ferret.pmel.noaa.gov/cgi-bin/nph-dods/data/PMEL/

  In your Apache httpd.conf file add the following:

  <Directory /path-to-dods(without cgi-bin or nph-dods)/data>
      Options +Indexes +FollowSymLinks
      IndexOptions FancyIndexing
      IndexOptions +FoldersFirst +NameWidth=* +IgnoreCase
      IndexOptions +SuppressDescription
      DefaultIcon /path-to-icons/dods.gif
      IndexOptions +IconHeight=20 +IconWidth=20
  </Directory>

  I copied the dods logo from upper left hand corner of
  http://www.unidata.ucar.edu/packages/dods/home/getStarted/
  called it dods.gif and stuck it in my apache icons directory
  (in httpd.conf grep for Icon - something should show you the path)

  Information for Apache
  IndexOptions: http://httpd.apache.org/docs/mod/mod_autoindex.html#indexoptions

  Options: http://httpd.apache.org/docs/mod/core.html#options

  DefaultIcon: http://httpd.apache.org/docs/mod/mod_autoindex.html#defaulticon

More Questions

  There are several sources of further information about DODS/NVODS/OPeNDAP:

    o The OPeNDAP home page: http://www.opendap.org/.

    o The users manual, available in HTML, PDF, and Postscript, on the
      home page.

    o User support by email: support@unidata.ucar.edu

