Wednesday, January 25

Non-root Trac installation on Textdrive

I've been using Textdrive for hosting for a while now. Almost all I use it for is to have a Trac instance (and a subversion repo to go with it).

I'd long had been annoyed that the Trac installation was on the 0.8.x branch. 0.9 has brought major changes to the plugin architecture and deployment model (go eggs!). I liked the new stuff so much I'd already gotten Trac Tags ported over to the new plugin architecture and stopped backporting changes to the old macros. But I couldn't even use the new features.

Last week, my Trac install stopped working altogether (apparently, I wasn't the only textdrive customer to suffer these problems). My students also use the wiki to get course materials, assignments, sample code, in-class presentations.

To make matters more frustrating, Textdrive was upgrading their ticket system over the weekend, so I couldn't even really complain. By Tuesday (5 days of downtime), I'd had enough, I was determined to run my own trac installation, in my own directory (so that I could even run branches of Trac if I wanted to).

It took me a couple of hours, but I eventually got it working. Here's what I did:

  1. Compile and install my own trac installation. This was very easy (though it took me forever to figure out where to specify the prefix flag):
    ./setup.py install --prefix=/users/home/muness/trac-install
  2. From that install, run the steps necessary to upgrade my db from 0.8 to 0.9.
  3. Recreate the trac.ini file from the trac.ini.sample.
  4. Test with tracd to make sure everything was working properly.
  5. Update my beloved tags, this time installed as an egg. (Don't forget to replace wiki.cs)
  6. Turn off tracd.
  7. Copy trac.cgi from /users/home/muness/trac-install/share/trac/cgi-bin/ to /users/home/muness/my-cgi/
  8. Add entries to the virtual server config in httpd.conf (via the frustrating webmin>Apache Webserver>CGI Programs) to direct requests to /trac (and /trac.cgi to maintain the old links) to /users/home/muness/my-cgi/trac.cgi .
  9. (webmin>Apache Webserver>Aliases and Redirects) Add entries to alias requests to /trac/chrome/common to /users/home/muness/trac-install/share/trac/htdocs.
  10. Create a .htpasswd file for authentication.
  11. (webmin>Apache Webserver) Add entries to add authentication for location /trac/login (and /trac.cgi/login).
  12. (webmin>Apache Webserver>CGI Programs) Try to set the necessary environment variables (TRAC_ENV to /users/home/muness/tracenv , for your trac instance and PYTHONPATH to /users/home/muness/trac-install/lib/python2.4/site-packages to use my own version of trac). Realize that doesn't work (it should).
  13. Give up on any good solution to the environment variables not being set problem. Hack my copy of trac.cgi and add the following at the top:
    import os
    os.environ['TRAC_ENV']='/users/home/muness/tracenv'
    import sys
    sys.path.insert(1,'/users/home/muness/trac-install/lib/python2.4/site-packages')
    
  14. http://muness.textdriven.com/trac/. Be Happy!
  15. (Next day)Realize that old links (http://dev.muness.textdriven.com/trac.cgi) don't work. Send an email to the trac folks begging them to remove whatever configuration they had for dev.muness.textdriven.com. (Since they have *.muness.textdriven.com map to muness.textdriven.com). Wait a few hours. http://dev.muness.textdriven.com/trac.cgi. Be happy.

Now I can go back to working on the tags to take advantage of Alec's patches that refactor Trac tags and provide a generic tagging API Trac plugins can use (more on this later). I am looking to write a del.icio.us tag provider so I can access bookmarks from wiki entries!

0 comments: