Julio Biason's notes

‹ TextMate | VIM ›

Trac

Conventions

  • Python should be installed;
  • Trac should be installed and properly set up (e.g., you should be able to access trac-admin);
  • I’m assuming this running in a Dreamhost box. I have my own Python and Trac installs on my home directory, inside the packages directory.

Git Plugin

To enable the Git plugin:

  • Copy the TracGitPlugin.egg to the plugins directory;

  • Make sure repository_dir points to the Git repository;

  • Make sure repository_type says git;

  • Add this:

    [git]
    persistent_cache = true
    shortrev_len = 6
    git_bin = /home/slowsloth/packages/bin/git
  • Enable the plugin:

    [components]
    tracext.git.* = enabled

Account Manager Plugin

To enabled the Account manager plugin:

  • Copy the TracAccountManager.egg to the plugins directory;

  • Add this in the [components] section:

    trac.web.auth.LoginModule = disabled
    acct_mgr.web_ui.LoginModule = enabled
    acct_mgr.web_ui.RegistrationModule = disabled
    
  • Add this:

    [account-manager]
    password_store = HtPasswdStore
    password_file = /home/slowsloth/trac-sites/trac.passwords

Theme Engine plugin

To enable the Theme Engine plugin:

  • Copy the TracThemeEngine.egg to the plugins directory;

  • Add this in the [components] section:

    themeengine.* = enabled
  • Select the theme with:

    [theme]
    theme = [Name]
    

PyDotOrg Theme Plugin

To enable the PyDotOrgTheme theme [*]:

  • Copy the TracPyDotOrgTheme.egg to the plugins directory;

  • Add this in the [components] section:

    pydotorgtheme.* = enabled
  • Change the theme inside the [theme] section to PyDotOrg.

Spam Filter Plugin

To enable the Spam Filter plugin plugin:

  • Copy the TracSpamFilter.egg to the plugins directory;

  • Add this in the [components] section:

    tracspamfilter.* = enabled
  • Add this:

    [spam-filter]
    max_posts_by_ip = 5
    reject_handler = CaptchaSystem
    

Making Trac available through FastCGI

Create a index.fcgi file with the following:

!/bin/bash
export TRAC_ENV="/home/slowsloth/trac-sites/configopt"

# If you get 500 errors maybe you need to set/export the LD_LIBRARY_PATH,
# just uncomment the following lines and make sure it points to the same place
# you used before (Environment Setup).
export LD_LIBRARY_PATH=/home/slowsloth/packages/lib
export PATH="/home/slowsloth/packages/bin:$PATH"

exec /home/slowsloth/packages/share/trac/cgi-bin/trac.fcgi

Removing “index.fcgi” from the URL

Create a .htaccess in the directory with:

DirectoryIndex wiki

# Make sure rewrites work
Options ExecCGI FollowSymLinks

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  RewriteCond $1 !^index.fcgi/(.*)
  # Allows direct access to documentation and files.
  RewriteCond $1 !^docs
  RewriteCond $1 !^files
  RewriteRule ^(.*)$ index.fcgi/$1 [L]
</IfModule>
[*]You’ll need that the Theme Engine Plugin is enable already.