SgDotNet
Singapore Professional .NET User Group -For Cool Developers

Using Trac to improve the efficiency of product development and project management

This is rather applicable for either personal projects or projects involving small/medium teams for coherent product development. The main requirement of any agile process is to have

(1) clearly provide visibility into timeline, milestones, roadmaps
(2) facilitate version control of source codes or draft documents, and
(3) track the defects/change requests/tasks that pop up along the way
     (as always, listing them out make it happen faster!)
(4) The impact or overhead should be minimum!

With the same philosophy in design, it is found the open source Trac offers a rather compelling solution. It could be found more at http://trac.edgewall.org/. Trac does have their own wiki pages on installation and configuration, http://trac.edgewall.org/wiki/TracGuide but it could be overwhelming for who is new.

Wish they would release an automatic installer one day. But before that, the following is a tested step-by-step guide (with emphasis on Trac) on installation and configuration, with some details omited (such as Apache and Subversion which could be found elsewhere, mentioned in the guide) but the skeleton is accurate.


Install Subversion (http://subversion.tigris.org/)
   assumed at C:\svn
Install Python  (http://www.python.org/download/, note that the version must be matched with other required bindings or packages in the following paragraphs)
   assumed at C:/Python24, and put in PATH
Install Subversion Python binding (http://subversion.tigris.org/downloads/svn-python-1.4.2.win32-py2.4.exe)
Install docutils (optional)
   only required if you want to support Restructured text wiki markup
Install SQLite (optional)
   required if only need to peek into the db file used by Trac
Install SQLite python binding (http://initd.org/pub/software/pysqlite/releases/2.3/2.3.2/pysqlite-2.3.2.win32-py2.4.exe)
Install ClearSilver Python (http://www.clearsilver.net/downloads/win32/clearsilver-0.9.14.win32-py2.4.exe)
Install Apache2 (http://httpd.apache.org/, used Apache 2.0.59)

Finally, install trac itself, Unzip trac to a certain folder (eg C:/Trac)
 python ./setup.py install
 installed to \Python24\site-packages, \Python24\scripts
Go to C:\Python24\scripts
 python trac-admin path/to/project_enviroment initenv (initialize environment eg at D:\Repository\Trac\ProjectName, the corresponding Subversion repository is at D:\Repository\svn\ProjectName)
 python trac-admin path/to/project_enviroment permission add admin TRAC_ADMIN (add user named 'admin' as administrator, admin is an user authenticated by Apache, see later for more details, but authorized to be TRAC_ADMIN in Trac)
 It is also possible to call python trac-admin path/to/project_enviroment (eg D:\Repository\Trac\ProjectName )
 so that all the subsequent commands are directed towards the specified environment

Edit D:\Repository\Trac\ProjectName\conf\trac.ini for certain customization (eg MMI or when custom fields are required), details at http://trac.edgewall.org/wiki/TracTicketsCustomFields

Add users for authentication (for both Subversion and Trac), using the password file known to Apache web server. At \Apache folder in command line, add user admin (menetioned earlier),user1,user2 etc

.\bin\htpasswd -cm passwd admin
.\bin\htpasswd -m passwd user1
.\bin\htpasswd -m passwd user2

The next step is to add users for authorization of Subversion itself (ie reading the source control directory), create a file at Apache folder, named eg "svnacl" with the following content

[groups]
role1 = user1,user2
role2 = user3,user4
# 'r' 'w' 'rw' '<empty>' or not specified
# if not found, use the parent. child always overrides parent
[/]
* =
[project1:/]
@role1 = rw
@role2 = r
[project2:/]
@role1 = r
@role2 = rw

(The above is meaning role1 containing user1,user2; role2 containing user3,user4; at project1, role1 having rw rights, etc)


Edit httpd.conf of Apache to enable access to subversion (more info on Apache access of subversion is out of scope and could be found in tortoisesvn's help file (look for TortoiseSVN_en.chm) in the installation folder)

Uncomment (remove the '#' mark) the following lines to enable loading of required modules:

#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so

Add the following two lines to the end of the LoadModule section to load additional modules required by svn.

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Add the following directives to control access to /svn alias on the web server (meaning it is possible to access http://ip-address:8080/svn for the svn repository)

<Location /svn>
   DAV svn
   SVNParentPath D:\Repository\svn  # this is the Subversion repository at the file system
   AuthType Basic # basic authentication
   AuthName "Subversion Repositories"
   AuthUserFile passwd      # this is the password file we created before
   AuthzSVNAccessFile svnacl # this is the access control list file we created before
   Require valid-user
   Order deny,allow
   allow from 127.0.0.1
   allow from 192.168.1.xxx  # well, ip address of the proper LAN network
   deny from all
</Location>

You need a subversion client (eg Tortiese subversion http://tortoisesvn.tigris.org/). Tortiese has a very good Explorer integration, so you could perform checkin, checkout, diff, get latest commands easily.

At last, edit httpd.conf of Apache to enable access to trac (finally...), the below supports multiple projects (security of

Apache is out of scope of this guide). The below intends to put http://ip-address:8080/trac for the svn repository

Alias /trac "C:/Python24/share/trac/htdocs" # this allows the static document being served
<Directory "C:/Python24/share/trac/htdocs"> # from the trac installation
   Options Indexes MultiViews
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

<Location /tracs> # the top level url that hosts multiple projects
   SetHandler mod_python
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnvParentDir D:\Repository\Trac
   PythonOption TracUriRoot /tracs
   Order deny,allow
   allow from 127.0.0.1
   allow from 192.168.1.xxx (add more or ip restriction)
   deny from all
</Location>

<LocationMatch "/tracs/[^/]+/login">  # matches all the subprojects for login
   AuthType Basic
   AuthName "Trac"
   AuthUserFile passwd
   Require valid-user
   Order deny,allow
   allow from 127.0.0.1
   allow from 192.168.1.xxx (add more or ip restriction)
   deny from all
</LocationMatch>


To configure authorization of Trac, at the command line Python24\scripts

  python trac-admin /path/to/project_enviroment permission add role1 REPORT_ADMIN
  python trac-admin /path/to/project_enviroment permission add role1 TICKET_MODIFY
  python trac-admin /path/to/project_enviroment permission add user1 role1
  (etc)

It could be seen that permissions can be grouped together to form roles (see role1) above.

Trac uses a simple permission system to control what users can and can't access. Non-authenticated users accessing the system are assigned the name "anonymous". Assign permissions to the "anonymous" user to set privileges for anonymous/guest users. All logged in users belong to the virtual group "authenticated", which inherits permissions from "anonymous". To enable all privileges for a user, use the TRAC_ADMIN permission. Having TRAC_ADMIN is like being root on a unix/linux system, it will allow you perform any operation.

 At last, we should be able to nagivate to http://ip-address:8080/tracs/ProjectName for the project page!


Posted Dec 18 2006, 11:29 PM by blackinkbottle
Filed under: ,

Comments

kgx wrote re: Using Trac to improve the efficiency of product development and project management
on 10-29-2007 5:25 PM

Thanks...awesome guide :-)

Tommy Skaue wrote re: Using Trac to improve the efficiency of product development and project management
on 12-12-2007 5:15 PM

Great guide!!

How about upgrade this guide to include installation of VisualSVN server (free installer from visualsvn.com). That would make a complete installguide for SVN+trac on windows with a great GUI (yes, Graphical) to control the repositories! :D

Copyright SgDotNet 2004-2008
Powered by Community Server (Commercial Edition), by Telligent Systems