ViewVC with mod_python, up and running

14 Nov 2006

12/20/2006 update: I had to disable ViewVC diffs; bots were running complicated diffs and killing RubyForge - load averages over 100 and all that. But all the other ViewVC functionality - including CVSGraph and such - should work fine.

After an epic struggle I've gotten ViewVC working under mod_python, so I can finally close this bug. More importantly, browsing Subversion and CVS repositories on RubyForge should be much faster now that we're no longer using CGI for this. Go ahead, click around a bit!

A few notes on the configuration involved to get this going:

  • Here are the directives I used to point things to ViewVC:
  • Alias /viewvc /usr/local/viewvc-1.1-dev/bin/mod_python/viewvc.py
    <Location /viewvc>
    SetHandler mod_python
    PythonHandler handler
    <Location>
  • ViewVC wasn't on the Python library path, so I had to add it somehow. I couldn't figure out how to get the PythonPath directive working, so I ended up adding these two lines to the end of site.py:
  • sys.path.append('/usr/local/viewvc-1.1-dev/lib/')
    sys.path.append('/usr/local/viewvc-1.1-dev/bin/mod_python/')
  • At one point I was getting an error Can't set position pointer in file '/var/svn/support/db/revs/471': Invalid argument", 22). This caused me great pain until I ran across a post on the Subversion mailing list suggesting that it was an Apache Portable Runtime (APR) conflict. I ran ldd on mod_dav_svn and httpd and yup, they were using different versions of APR. So I uninstalled the APR RPM, recompiled Subversion and Apache, copied the new shared object libraries into place, and got past that.
  • Here's the autoconf invocation I used for compiling Subversion. Note the APR flags:
  • ./configure --without-berkeley-db \
      --with-zlib \
      --with-apxs=/usr/local/apache2/bin/apxs \
      --with-apr=/usr/local/apache2/ \
      --with-apr-util=/usr/local/apache2/
  • These modules need to be loaded in this order, not the reverse:
  • LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so
  • I wanted to preserve any old links, so I added this RedirectMatch direction:
  • RedirectMatch /cgi-bin/viewvc.cgi(.*) /viewvc$1

Thanks to the folks on the #viewvc IRC channel (cmpilato especially) for their help in getting things set up!