Sweating the Details

Icon

A Compulsively Obsessing Blog

Setting up Trac on Dreamhost

Trac is one of the preferred free solutions for project management and issue tracking, and has some really slick SVN integration as well. However, the downside to installing Trac can be substantial, as the installation process is potentially error prone, especially with a shared host such as Dreamhost. This article describes my installation process on DH, and may work for other shared hosts as well.

A very sensible shortcut

Petar Maric has put together a fantastic google-code project that tackles much of this issue head-on, and can be downloaded from his blog.

Afterwards

Having executed the scripts above, I was most of the way there. Trac was up and running, everything was visible, and my SVN commits were catalogued nicely. However, there was one problem: I couldn’t log in no matter what I tried.

The scripts will create a file called <projectname>.passwd in your trac_projects folder, which is a standard htpasswd-style file. Using the htpasswd command, you can add new users for your trac here. Make sure you have a username in the .passwd file that matches the admin username you specified when creating the trac project (the first entry by default). However, none of these users can log in until some changes are made to the .htaccess file in the webroot of your Trac setup. Specifically, it should look something like this:

DirectoryIndex index.fcgi
 
Options ExecCGI FollowSymLinks
 
AuthType Basic
AuthName "Trac"
AuthUserFile /home/<username>/trac_projects/<projectname>/<projectname>.passwd
Require valid-user
 
<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.fcgi/$1 [L]
</ifModule>

Another pitfall

After this, I was confident things were working, but a few days later another user was seeing a string of error messages in the SVN post commit hook revolving around “[Errno 13]Permission denied: ‘/home/<username>/trac_projects/<projectname>/.egg-cache’ “. Python needs this egg cache to be server-writeable, and a quick CHMOD fixed the problem.

Enhancements

Of course, if you are using HTTP rather than HTTPS, you’re going to want to use digest authentication instead of the standard htpasswd. The authentication segment in the .htaccess file is going to look more like this:

AuthType Digest
AuthName "Trac"
AuthDigestFile /home/<username>/trac_projects/<projectname>/<projectname>.passwd
Require valid-user

and you will need to generate your .passwd file using htdigest instead of htpasswd.
That should be all it takes to get Trac going on Dreamhost. Let me know if you have any issues, I’d love to hear about it.

Thanks

Thanks to Volker Schoenefeld for tips with Trac!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • Technorati
  • Tumblr
  • Twitter

Category: Software Development, Web Design

Tagged: ,

2 Responses

  1. Sean says:

    Thanks for this!

    I was having the exact same problem and this helped me immensely. I create a Trac instance automatically from the Dreamhost panel while creating a new SVN repositiory. For me, the service did not automatically create a password file. I just made one in the trac directory (not the web site one) and put the appropriate path in the .htaccess.

  2. Bill says:

    Likewise – thanks very much for this. I’m a Trac newbie, and was somewhat flummoxed by the installation DH did.

Leave a Reply

About

Arash Keshmirian is a co-founder of Limbic Software, developers of TowerMadness for the iPhone. In this blog, he writes about issues facing software developers, entrepreneurs, and his generation as a whole...
...or he'll just post some random art.

Twitter: @akgfx

Email:

Flickr Photos

Weird Tropical Fruit

Spot the Monkeys!

On the road to Arenal Volcano

More Photos