Trac + SVN : The best shit ever for your software project

The company I came to work for knew I had some experience with subversion (back at LimeWire and with the migration of Frostwire’s CVS Repo no SourceForge.net to Subversion) so that’s one of the first things I did here.

Subversion is a pretty useful tool, specially if you play with the hooks, e.g., send emails to members of the teams on post-commit, or update a common sandbox on post-commit so that everyone can see how the trunk of your repository is at the moment (stable or not)…

But it’s not nearly as cool if you’re not using Trac to manage the project.

We needed a simple tool to handle Bug tracking, and this Tool has become my addiction ever since I finished configuring it, now I use it as a personal “post-it” tool, no more KDE Yellow post it notes (yeah, I quit a long time ago on the real post it notes), now I write everything down on Trac, and I pretty much have two geek addictions when it comes to work now:

  • Try to clean all my tickets
  • See how many commits and lines of code I added/removed throuout the day
  • The results are you’re being very productive and procastinate on crap like email, irc or IM.

    I stopped people comming to my desk, now they have to enter a ticket, and it seems people are liking the mix of svn+trac a lot. Even the graphic designers are using their command line on the macs to do their commits and we get all the diffs by mail. All this happened in like 3 weeks, pretty amazing acceptance to change where I work.

    but this post, is not to advertise or evangelize the tools I use for work (although so far I hope I got you pumped on using trac and subversion if you even know what I’m talking about), it’s to document how the hell I installed it.

    Installing trac was a painful process, I admit, and I’m still not done, just today I’m installing my first plugins, but so far, I have it set so that, we have ‘user accounts’, we can browse our repository and diffs through trac, and we can make references to revision changes on the wiki (cause yes, trac is also a wiki, so we’re also using it as our new intranet web page) just by putting something like ‘r35’ , and that will automatically make a link when you submit a ticket or save a wiki page to the diff on r35.

    So before you hate me, know in advanced something I hated.

    If you intend to use trac with subversion, trac must be on the same machine

    Yes, it still doesn’t support browsing a remote repository. So what did I do?

    I have a cronjob that rsyncs the repository every 5 minutes. You can also have it the other way if the server where the repository isn’t as loaded as ours, you can do the rsync to the machine where trac lives on the subversion hook for post-commit.

    So here is the entries I put on my apache2.conf on the machine that runs trac.

    #Mod python configuration
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnv /var/www/trac_projects/flycell
    PythonOption TracUriRoot /trac/flycell

    #Authentication configuration
    AuthType Basic
    AuthName "Trac at Flycell.com"

    #Our password file
    AuthUserFile /var/www/trac_projects/flycell/conf/auth_file

    Require valid-user

    #Authentication configuration
    AuthType Basic
    AuthName "Trac at Flycell.com"

    #Our password file
    AuthUserFile /var/www/trac_projects/flycell/conf/auth_file

    Require valid-user

    DAV svn
    SVNPath /flycell_rsynced_svn

    And here’s what’s on my trac.ini

    [wiki]
    ignore_missing_pages = false

    [changeset]
    max_diff_bytes = 10000000
    wiki_format_messages = true
    max_diff_files = 0

    [logging]
    log_file = trac.log
    log_level = DEBUG
    log_type = stderr

    [trac]
    default_charset = iso-8859-15
    ignore_auth_case = false
    permission_store = DefaultPermissionStore
    check_auth_ip = true
    database = sqlite:db/trac.db
    authz_module_name =
    templates_dir = /usr/share/trac/templates
    default_handler = WikiModule
    base_url = http://192.168.208.230/trac/flycell
    metanav = login,logout,settings,help,about
    htdocs_location =
    mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
    repository_type = svn
    repository_dir = /flycell_rsynced_svn/trunk/1.0/
    authz_file = /var/www/trac_projects/flycell/conf/auth_file
    authz_module_name = flycell_svn_repo

    [project]
    url = http://192.168.208.230:8000
    icon = common/trac.ico
    name = Flycell.com
    descr = Flycell.com Project Management
    footer = Visit the Trac open source project at
    http://trac.edgewall.com/

    [notification]
    always_notify_owner = true
    smtp_always_cc = true
    smtp_password =
    smtp_enabled = true
    smtp_replyto =
    smtp_port = 25
    always_notify_reporter = true
    smtp_from = trac-do-not-reply@flycell.com
    smtp_server = mail.flycell.com
    smtp_always_bcc = me@flycell.com someone@flycell.com
    mime_encoding = base64
    maxheaderlen = 160
    use_public_cc = true
    smtp_user =

    [header_logo]
    src = http://www.flycell.com/template/shared/images/logo.gif
    alt =
    height = 63
    link = ./
    width = 157

    [mimeviewer]
    php_path = php
    enscript_path = enscript
    tab_width = 8
    max_preview_size = 262144

    [attachment]
    render_unsafe_content = false
    max_size = 262144

    [timeline]
    changeset_show_files = 0
    ticket_show_details = false
    default_daysback = 30
    changeset_long_messages = false

    [ticket]
    default_version =
    default_component = flycell.com
    default_type = defect
    restrict_owner = false
    default_milestone =
    default_priority = major

    [browser]
    hide_properties = svk:merge
    downloadable_paths = ['/trunk', '/branches/*', '/tags/*']

    That trac ini took a long time to figure out, specially for the subversion repository, until I found out It couldn’t work remotely, then I had permission problems that I finally resolved after hours and hours of googling that I had to have this at the end of my authz_file….


    [auth]
    usernameHere:z6unzMUVK6s.o
    anotherUserHere:dkajsl22dsjkl

    [flycell_svn_repo:/]
    * = rw

    The [auth] section of that file, contains users and crypted passwords created with

    htpasswd2 -nb username passwordhere

    I basically copied and pasted the output on that file, and that served as my .htpasswd file for a while, until I knew that It had to have the name of the repository there… as specified on the trac.ini

    They should make all this more clear, thank god there are other geeks like me who like to document stuff.

    Hope you find this post useful in the future if configuring trac.

    I’m not gonna cover how to install the plugins cause I’m not done yet with that, but it’s going smooth, just know that you’ll need to install a script before hand. I actually installed already the TracWebAdmin cause I need to give people access to the management of trac and I don’t want to have them on the console cause they’ll get lost.

    Enjoy

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.