How The CVSTrac Website Is Configured

<h2>Background</h2>

CVS is legacy.  Nobody uses it for new work any more.  And the same is true
of CVSTrac.  We continue to maintain it for the sake of sites that
continue to use it, and to continue to be able to display historical tickets
and wiki pages that where entered years ago when CVS and CVSTrac where still
in active use.  But the world has move on.  Projects should transition to
newer and better systems that are now available.  CVSTrac has become an
historical artifact.

We recently upgraded the server that hosts and as part of
that upgrade, we purposely did <u>not</u> install CVS, since it is a security
risk.  All of the CVSTrac source code is now on
| Fossil] - a distributed version control system
that incorporates many of the features originally developed for CVSTrac.
In other words, CVSTrac is no longer self-hosting.  It has been moved into
a retirement home.

<h2>Server Configuration</h2>

CVSTrac is still run in order to provide access to historical tickets and
wiki pages.  The current manifestation of
CVSTrac runs as a stand-alone CGI process inside a chroot jail.  No other
software is necessary for CVSTrac to run.  Formerly, we needed and
But those executables are a security risk and so CVSTrac has
been enhanced to no longer require them.

The HTTP server on the website is
| althttpd.c].
This server is implemented as a single file of ANSI-C code.  Documentation
on how to configure althttpd.c is found in a comment in the first 50
or 60 lines of the source code file.  A separate
instance of the server is launched for each inbound TCP/IP connection via
xinetd.  xinetd is configured using the file which
looks like this:

<blockquote><pre>
service http
{
  port = 80
  socket_type = stream
  wait = no
  user = root
  server =
  server_args = -logfile -root -user www-data
}


This same HTTP server also servers site and
and several other domains.  The HOST parameter
on the HTTP header determines which content is served.  Everything runs
on a single low-power | Linode] virtual machine.

You can infer from the "server_args" line above that althttpd.c puts itself
in a chroot jail at and changes to the www-data user before doing
anything else.  This chroot jail contains no shared libraries and a minimal
number of executables (fossil and cvstrac, for example).  Note in particular
that this chroot jail does not contain or which limits
the functionality of CVSTrac somewhat.

There is a file on the website named "cvstrac".  That file has
its execute permission bit set (rwxr-xr-x) so that althttpd.c will run it as
CGI whenever it is specified on the URL path.  The file is a script, as
follows:

<blockquote><pre>

directory: /cvstrac
project: cvstrac


The executable is really found in but
the is omitted because of the chroot jail.
is compiled with
-static so that it uses no shared libraries.  The CVSTrac database for the
CVSTrac project is located in the directory "/cvstrac" (relative to the
chroot jail, or in reality) and the name of the CVSTrac
database is "cvstrac.db".  Note that the ".db" suffix is added automatically.

<h2>Building The CVSTrac Executable</h2>

The cvstrac executable found in (or relative
to the chroot jail) is built as follows:

  1.  Checkout the CVSTrac source tree into a subdirectory named "cvstrac".
      This involves cloning the repository if necessary, then doing
      "mkdir cvstrac; cd cvstrac" and finally
      "fossil open ../cvstrac.fossil".

  2.  Create a sibling directory "bld".  Copy "linux-gcc.mk" from the source
      directory into "makefile" in the "bld" directory.

  3.  Edit "makefile":  (a)  Set SRCDIR to "../cvstrac".  (b) Change
      TCC to "gcc -Os -static -I. -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION".  (c) Change LIBSQLITE to "./sqlite3.c -lcrypt -lm".

  4.  Move a copy of the SQLite amalgamation and header into the build
      directory.

  5.  Type "make".

The steps above build a statically linked binary that can then be copied into
Not all features of
CVSTrac are supported by this build, but enough features are support to
provide access to legacy wiki pages and tickets in the CVSTrac database
files.