auf.kante
Gunnar macht sich selbststaendig und fliegt auf
die Schnauze
wird erfolgreich. Wer mag darf zuschauen.
Gunnar is starting his business. He will certainly
fail succeed. You may watch.
auf.kante
Website sections
Home
Trac
Status: Matches my current trac installations
Last changed: 2006-02-11 [00:10]
Content:

Some notes on using trac
 
Back to Personal Wiki
Table of contents
Installing and configuring trac-0.9.3
Overlays in trac

Installing and configuring trac-0.9.3

This will install trac for use with apache and mod_python.

Emerge trac with the sqlite and the silvercity useflags enabled:

echo "www-apps/trac sqlite silvercity" >> /etc/portage/package.use

In addition I activated zlib and python support for the clearsilver package:

echo "dev-libs/clearsilver zlib python" >> /etc/portage/package.use

Now trac can be emerged.

emerge www-apps/trac

While the Gentoo trac ebuild is actually based on the webapp.eclass there is no reason to actually run webapp-config if you use mod_python to run trac.

Now let's create the subversion repositories:

svnadmin create /var/svn/repos/myrepo
chown -R apache\: /var/svn/repos/myrepo

And the corresponding trac environment:

trac-admin /var/lib/trac/myrepo initenv

This will initiate a short dialog that should look similar to this one:

Creating a new Trac environment at /var/lib/trac/myrepo

Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> My repository

 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]>

 Please specify the absolute path to the project Subversion repository.
 Repository must be local, and trac-admin requires read+write
 permission to initialize the Trac database.

Path to repository [/var/svn/test]> /var/svn/repos/myrepo

 Please enter location of Trac page templates.
 Default is the location of the site-wide templates installed with Trac.

Templates directory [/usr/share/trac/templates]>

...

Since the trac project will be published via Apache, the internal trac database needs to be write accessible to the apache user:

chown -R apache /var/lib/trac/myrepo/db

Now emerge mod_python:

emerge mod_python

Add -D PYTHON to /etc/conf.d/apache2:

APACHE2_OPTS="-D SSL -D PHP5 -D PHP4CGI -D DAV -D DAV_FS -D SVN -D LDAP -D AUTH_LDAP -D SVN_AUTHZ -D PYTHON"

Create a new virtual host with /etc/apache2/vhosts.d/25-projects.conf:

<VirtualHost *:80>

  ServerName projects.mysite.de
  DocumentRoot /var/www/projects.mysite.de
  ErrorLog logs/projects-mysite-de_error_log
  CustomLog logs/projects-mysite-de_access_log combined

  <Location />
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnvParentDir /var/lib/trac/
    PythonOption TracUriRoot /
 </Location>

  <LocationMatch "/[^/]+/login">
    AuthType Basic
    AuthName "My trac projects"
    AuthUserFile /var/svn/conf/developers
    Require valid-user
  </LocationMatch>

  <IfDefine SVN>
    <IfModule !mod_dav_svn.c>
      LoadModule dav_svn_module	modules/mod_dav_svn.so
    </IfModule>
    <Location /svn>
      DAV svn
      SVNPath /var/svn/repos/myrepo
      AuthType Basic
      AuthName "My trac projects"
      AuthUserFile /var/svn/conf/developers
      Require valid-user
    </Location>
  </IfDefine>

</VirtualHost>

Finally create a first user:

htpasswd2 -c /var/svn/conf/developers wrobel

Overlays in trac

There are a number of Gentoo overlays managed with trac now. While the trac wiki allows you to generate a page that lists the overlay contents this is somewhat redundant. The ebuilds present in the tree could be read from the subversion repository directly.

Luckily trac allows you to create short macros that can be used within the wiki system. I wrote such a macro to generate an overview of the overlay contents.

You can download it here. Simply add it to the wiki-macros sub directory within your trac site:

wget http://www.gunnarwrobel.de/downloads/lay2wiki.py
mv lay2wiki.py /var/lib/trac/myrepo/wiki-macros/

Now you can use the following macro within the wiki to publish a content listing:

[[lay2wiki()]]

This only works if your overlay at the root node. If the overlay is somewhere in a sub directory, you can specify the path to it as an argument to the macro:

[[lay2wiki(/trunk/overlay)]]

This will automatically provide the following information for each ebuild in the overlay:

  • Ebuild name
  • Description (from the DESCRIPTION=".*" entry in the ebuild)
  • Homepage (from the HOMEPAGE=".*" entry in the ebuild)
  • Ebuild versions
  • Last time modified
  • Last changeset associated to this ebuild package

If you want additional information listed, you can add a info.trac file into the ebuild directory. You can provide the following information in there:

  • Notes
  • Links
  • Bugzilla link
  • Type

If you specify a type, the ebuilds within a Gentoo category will be subdivided according to these types. This can be useful if the overlay provides a lot of ebuilds in one category.

Here is an example info.trac:


NOTE="This allows you to submit del.icio.us links from within
emacs. Very handy tool to manage your link collection. Will be added
to portage once planner has been released."

BUG="102295"

LINK="<a
href='http://www.gunnarwrobel.de/wiki/EmacsDeliciousAPI.html'>My
notes on configuring delicious-el</a>"

You can also place a file called overlay.trac into the root of the overlay. The text in that file will be published as a comment at the top of the overlay listing.

Links

Same section in del.icio.us
  • Gentoo Wiki - HOWTO trac
  • Trac - Backup sites
  • Trac - Webadmin plugin
  • Trac on Gentoo
Back to Personal Wiki
Creative Commons-Lizenzvertrag
The content of this site is licensed under a Creative Commons 2.5 License [attribution, share-alike]