CentOS 5.2 Trac Howto And SVN Install/Upgrade

15 Mar in CentOS, Linux, Trac

Introduction:

As everyone knows in the Linux world, sometimes upgrades can either be easy or a serious nightmare for the IT department. The problem being is the vast amounts of fundamental changes from one release to another, and those changes not only being limited to the software you want to update. The other two exciting challenges lie with the fact that more often than not, the software's documentation is sketchy if existent or lagging behind for beyond the current time line. Sometimes documentation can be complete or it could be sporadic in its coverage of the topics required/needed. This document is a work in progress, what works for me, might not work for you. There is no guarantee on the quality of its workmanship.

So what is Trac?

Tracs' website says it all in the below blurp: Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. Our mission is to help developers write great software while staying out of the way. Trac should impose as little as possible on a team's established development process and policies. It provides an interface to Subversion, an integrated Wiki and convenient reporting facilities. Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all project events in order, making the acquisition of an overview of the project and tracking progress very easy. -trac.edgewall.org

Objectives:

This documentation is to help install Trac, do an upgrade, install plugins and to save time/headaches. It also helps setup repositories for SVN access. If you find something isn't working for you move on to something else, or take a step back and research a problem from a different angle. I had intended to do an upgrade from Trac 0.10.3 to 0.11 on SuSE 10.2 to 10.3 and let me say it wasn't fun. In the end I set out to transfer the existing information to a new system running on CentOS 5.2 which was much easier.

There were bumps on the road such as missing, or hard to locate packages, but the new features such as peer code review were must haves. Also one word of warning: allocate alot of time if you are going to be taking the information from previous Trac installations. Trac takes forever to resync if your repos are huge!

Environment:

-VMware Server -#3 20GB IDE drives (hda system drive, hdc /var/trac, hdd /var/svn) -CentOS 5.2 -StaticIP **Repositories configured to use the EPEL and RPMforge repos.

Installation:

Very slim installation of CentOS with only any developer toolchains installed and their respective libraries. I prefer to install apache using yum, so its current when I go to use it. Install the following with yum:  

yum install httpd python mod_python sqlite mod_dav_svn subversion mod_authz_svn

Install this utility called ez_setup.py. It will greatly ease any python misgivings as far as streamlining the installation process.  

cd ~/python wget <a href="http://peak.telecommunity.com/dist/ez_setup.py" title="http://peak.telecommunity.com/dist/ez_setup.py">http://peak.telecommunity.com/dist/ez_setup.py</a> python ./ez_setup.py

Using easy_install install the following:

easy_install babel easy_install Genshi easy_install Pygments easy_install docutils easy_install textile

Now lets install Trac: easy_install trac Trac should now be installed, onto adding the SVN repositories:

Setting up the SVN repositories:

mkdir -p /var/svn/repos/projectNAME

mkdir -p /var/svn/ svnadmin create --fs-type fsfs /var/svn/repos/projectNAME

Initialise a Trac project for your new repository:

mkdir /var/trac/projectNAME

trac-admin /var/trac/projectNAME initenv

chown -R apache.apache /var/trac/tofino/

For the trac-admin command use the defaults if not sure, giving a descriptive name for the project. The `Path to repository` is: /var/svn/repos/projectNAME Set the correct file permissions for apache

chown -R apache.apache /var/svn/repos/projectNAME

chown -R apache.apache /var/svn/repos/projectNAME

Configure Apache:

In /etc/httpd/conf/httpd.conf add the following locations. Also make sure that mod_python is being loaded and any other needed modules. Also you could use virtual hosts, and like what I did below I used a single .htpasswd file for authentication to keep things simple for administration.

<Location /trac>

SetHandler mod_python

PythonHandler trac.web.modpython_frontend

PythonOption TracEnv /var/trac/projectNAME

PythonOption TracUriRoot /trac

</Location>

<Location "/trac/login">

AuthType Basic

AuthName "trac"

AuthUserFile /var/svn/user_access/.project_passwd

Require valid-user

</Location>

<Location "/svn/repos/projectNAME">

DAV svn

SVNPath /var/svn/repos/projectNAME

AuthType Basic AuthName "Authorization Realm"

AuthUserFile /var/svn/user_access/.project_passwd

Require valid-user

</Location>

Add a repository/Trac user:

touch /var/svn/user_access/.project_passwd

chown -R root.apache /var/svn/user_access/.project_passwd

htpasswd -m /var/svn/user_access/.project_passwd USERNAME

Give the new user Admin privileges to start with:

trac-admin /var/trac/projectNAME permission add USERNAME TRAC_ADMIN

Restart Apache or httpd

service httpd restart

Upgrade an Existing Environment:

For an existing Trac environment, just run these two upgrade commands in the parent directory: trac-admin yourenv upgrade trac-admin yourenv wiki upgrade NOTE: Sometimes when you install a new plugin you must do an update.

Installing Plugins:

Installing most plug-ins is dead simple, however, do the required reading first. I found that at the time of writing this, some plugins were broken. In 0.11 WebAdmin is integrated into trac too. There is another component, though, that integrates with WebAdmin and one would almost expect it to be a part of it: the AccountManager plug-in. easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk

NOTE:: At the time of this writing, 0.11 is using Genshi, not all plugins are compatible with it yet so ClearSilver might have to be installed or you have to use a DEV package for a plugin. More plugins can be located at: http://trac-hacks.org

The Admin Interface:

Now when you visit your Trac in a browser, you should be prompted for login credentials. Log in with a user that you gave the TRAC_ADMIN privilege to just a moment ago, and you should see a new 'Admin' button on the far side of the navigation bar.

At this point I'd suggest that you browse the admin interface on your own to get acquainted with the settings available there. These cover a great number of configuration options that used to require trac-admin commands or editing of the trac.ini file.

Under the General >> Plugins section of the Admin tab, you should see the TracAccountManager plug-in listed with a disclosure triangle. Click the triangle to list the components of the plug-in, and enable the following:

  • AccountManagerAdminPage
  • AccountManager
  • SessionStore
  • AbstractPasswordFileStore
  • HTDigestStoreHTDigestHashMethod

The homepage for AccountManager at trac-hacks.org gives a breakdown of what each component does. You can also hover over the items for tooltips. To quickly summarize, the AccountManager component is the plug-in core and is required for use. The AdminPage component naturally provides a configuration page in the web interface.

The others relate to password management: SessionStore interfaces with Trac's database for session management and is required for any of AccountManager's password mechanisms. Similarly, AbstractPasswordFileStore allows the plug-in to work with htpasswd or htdigest password files. Since we're already working with htdigest, we've enabled the components to support this, and we don't need the others. We'll revisit a few of them in a little while.

Restart apache again.

Go to Accounts >> Configuration and click the HtPasswordStore radio button. In the filename field, enter the full path to your password file (e.g. /var/svn/user_access/.project_passwd). For realm, enter your domain name as specified when you ran the htpasswd command. Click Save, and you can now view and add users in Accounts >> Users. Unfortunately the interface doesn't allow you to edit users at this time -- full name and email are set on each user's individual Preferences page.

AccountManager has a few more nice features that we'll take advantage of: using an HTML login form instead of the pop-up you've seen thus far, and allowing users to change their password or delete their account. To use these features, we'll need to enable two more components for TracAccountManager under General >> Plugins: * AccountModule * LoginModule Then expand the entry for Trac itself, disable the LoginModule there, and click Apply. We're supplanting the built-in login module with AccountManager's. You can also enable AccountManager's RegistrationModule, which will allow anyone to register for an account by visiting the Login page.

Email Notifications:

Users may want to be notified of a ticket change or even managers may want to be kept in the loop. If you have your own SMTP server great, however, if your ISP is Shaw or Telus this might be troublesome for you. Here I opted to use a gmail account. In /var/trac/projectName/conf/trac.ini in the [notification] directive do the following:  

[notification] admit_domains = always_notify_owner = true always_notify_reporter = false always_notify_updater = true ignore_domains = mime_encoding = base64 smtp_always_bcc = smtp_always_cc = <a href="mailto:[email protected]">joe@gmail.com</a> smtp_default_domain = smtp_enabled = true smtp_from = <a href="mailto:[email protected]">trac@ficticiousDomain.com</a> smtp_from_name = smtp_password = gmailPasswrdHere smtp_port = 587 smtp_replyto = <a href="mailto:[email protected]">trac@ficticiousDomain.com</a> smtp_server = smtp.gmail.com smtp_subject_prefix = __default__ smtp_user = gmailUserNAME ticket_subject_template = $prefix #$ticket.id: $summary use_public_cc = false use_short_addr = false use_tls = true

Transfer From Old To New:

Back to my original goal here, restoring my old Trac to my new Trac I did a couple things. First things first, to separate my system from the svn and trac I mounted those directories on separate hard drives. If you don't know how to do that, refer to google ;P Next, transfer the Trac db from the old machine to the new one located in projectNAME/db. You will have to do an upgrade. *Transfer your attachments located in the attachments directory. *Transfer SVN (you might not need to do this) -If you do a transfer, delete the contents of the directory and then paste them in. Trac will "know" of this change and ask for a resync. Use the command trac-admin /var/trac/projectName resync *Check/compare your trac.ini for any specific changes. *Compare plugins and update accordingly if needed. -Some plugins are now a part of the Trac core.

Conclusion:

Ultimately, this Trac adventure was interesting. It wasn't surprising that its documentation fell by the wayside like alot of OpenSource projects, however, careful research and good problem solving skills are a must. Trac is fairly solid once you get rid of the initial kinks, but be forewarned that upgrades in the future might be horrendous. As a bug tracker, Trac offers many great features and the ability to be highly customizable provided extended periods of time must be allotted to do so.

Resources:

I personally thought that the offical trac wiki was incomplete and out of date. Use it sparingly or with discretion. http://trac.edgewall.org/wiki http://trac.edgewall.org/wiki/TracPlugins http://www.daniel-skinner.co.uk/setup-subversion-and-trac-on-centos-5/06... http://wiki.kartbuilding.net/index.php/Trac_and_SVN

Comments

Post new comment

By submitting this form, you accept the Mollom privacy policy.

Pacific Simplicity 2011 All rights reserved. Contact