Apache Rivet Installation

## Apache Rivet Installation

Rivet 2.1 runs with the Apache 2.2.x and 2.4.x HTTP web server. It is known to build and run on various Linux distributions (Debian & Ubuntu, Redhat, SuSE and CentOS), FreeBSD and OpenBSD. For some of these Unix-like operative systems binary packages are already available for download.

Currently there is no way to run Apache Rivet 2.1 on Windows© because Rivet currently requires the prefork, which is supported only on Unix/Linux systems. Efforts are under way to extend the support to the worker and the winnt MPMs. Check our development mailing list for the latests updates about Rivet development

If you need to compile Apache Rivet yourself this is the procedure to follow

1. Install Tcl

   Installing Rivet is about endowing the Apache HTTP webserver with the ability of running scripts written with the Tcl programming language. Therefore the Tcl shell (tclsh), its runtime and development libraries (≥8.5.10) have to be installed. Building Rivet you will have to tell the scripts where the Tcl libraries are located via the --with-tcl option to configure (see below).

2. Get Rivet

   Download the sources at http://tcl.apache.org/rivet/static/download.html.

3. Get and Install Apache Sources

   Rivet needs some of the include (.h) files shipped with the webserver source code. The easiest way to get them is to download the Apache source. If can build Rivet either statically (compiled into the Apache web server instead of loaded dynamically) or dynamically (as a loadable shared library). We recommend that you build Rivet as a shared library, for maximum flexibility, meaning that you also build Apache to be able to load modules. Other than that, the default Apache install is fine. We will tell Rivet where it is located via the --with-apxs option to configure (see below).

   The source code for the Apache web server may be found by following the links here: http://httpd.apache.org/.

4. Uncompress Sources

   We will assume that you have Apache installed at this point. You must uncompress the Rivet sources in the directory where you wish to compile them.

       gunzip rivet-X.X.X.tar.gz
       tar -xvf rivet-X.X.X.tar.gz

5. Building Rivet

   1. On Linux or Unix systems, Rivet uses the standard ./configure ; make ; make install (; make install-packages) sequence.

      There are several rivet specific options to configure that might be useful (or needed):

      --with-tcl
        This points to the directory where the `tclConfig.sh` file is located.
      --with-tclsh
        This points to the location of the `tclsh` executable.
      --with-apxs
        The location of the `apxs` program that provides information about the configuration and compilation options of Apache modules.
      --with-apache-version=[1|2]
        This option tells the build scripts whether you want to build Rivet for the Apache 1.x or Apache 2.x server. (Obsolete: Apache 1.x is no longer supported)
      --with-apache-include[=DIR]
        Locates the Apache include files on your computer, if they're not in standard directory.
      --enable-version-display=[yes|no]
        This option enables Rivet to display its version in the logfiles when Apache is started. The default is to keep Rivet version hidden.
      --with-rivet-target-dir=DIR
        This option tells the install script where Rivet's Tcl packages have to be copied.
      --with-upload-dir=DIR
        Configures Rivet's default upload directory
      --enable-head-requests
        By default HEAD requests don't go through the usual request processing which leads to script execution and therefore resource consumption and Rivet returns a standard hardcoded HTML header to save CPU time. --enable-head-requests changes this default (see also Rivet Directives)
      --disable-rivet-commands-export
        By default Rivet's commands are put on the export list of the `::rivet` namespace. With this option you may prevent it thus forcing the programmer to fully qualify these commands
      --disable-import-rivet-commands
        Likewise commands in the Rivet's namespace when exported are then by default imported into the global namespace for compatibility with previous version of Rivet. (Enabling the import of Rivet's commands overrides the switch --disable-rivet-commands-export and forces the export from `::rivet`). This switch overrides the default and prevents the import into the global namespace

      Example: configuring the build system to compile Rivet for an apache 2.x server, using tcl8.5 and specifying a custom name for the apxs program.

          ./configure --with-tcl=/usr/lib/tcl8.5/ --with-tclsh=/usr/bin/tclsh8.5 \
          	    --with-apxs=/usr/bin/apxs2 --with-apache=/usr --with-apache-version=2

   2. Run make

      At this point, you are ready to run make, which should run to completion without any errors (a warning or two is ok, generally).

   3. Install

      Now, you are ready to run the

          make install

      to install the resulting files. The `install` target actually fires the `install-binaries` and `install-packages` targets which in turn copy the binary modules and Tcl packages to their destination directories. This commands create a functional Rivet environment with its core language.

6. Apache Configuration Files

   Rivet is relatively easy to configure - we start off by adding the module itself:

       LoadModule rivet_module	/usr/lib/apache2/modules/mod_rivet.so

   This tells Apache to load the Rivet shared object, wherever it happens to reside on your file system. Now we have to tell Apache what kind of files are "Rivet" files and how to process them:

       AddType application/x-httpd-rivet .rvt
       AddType application/x-rivet-tcl .tcl

   These tell Apache to process files with the `.rvt` and `.tcl` extensions as Rivet files.

   The characters encoding can be changed using the header type command, but you can also change the default charset for the whole site:

       AddType 'application/x-httpd-rivet;charset=utf-8' rvt

   All the pages generated by Rivet on this site will be sent with a Content-Type:'text/html;charset=utf-8' header.

   You may also wish to use Rivet files as index files for directories. In that case, you would do the following:

       DirectoryIndex index.html index.htm index.shtml index.cgi index.tcl index.rvt

   For other directives that Rivet provides for Apache configuration, please see the section called “Rivet Apache Directives”.

Apache Rivet |  | Apache Child Processes Lifecycle and Request Processing