Trac configuration

From NCEAS Knowledge Base

Jump to: navigation, search

Contents

Draft details on creating Trac site:

1. Instantiation

Use these commands to create a new Trac project associated with an existing Subversion repository:

trac-admin </path/to/trac/project> initenv <projectname> sqlite:db/trac.db svn </path/to/svn/repo>
chown -R apache /path/to/trac/project

For our systems, trac repositories are being stored in /var/trac, and svn repositories are in /var/code.

For consistency, the project name should be the same as the SVN repository name.

2. Permissions

Other more complex models are possible, but these seem like two candidates for typical NCEAS projects:

"Open" project

trac-admin /path/to/trac/project permission remove authenticated WIKI_MODIFY WIKI_CREATE

This effectively removes the wiki capability (which we provide via the Plone sites), while still providing a friendly default landing page for the Trac project. All LDAP users will be able to use Trac features like ticketing, but only users specified in the svnauthz file (if appropriately configured -- see below) can view files in the repository.

"Private" project

trac-admin /path/to/trac/project permission remove anonymous *
trac-admin /path/to/trac/project permission remove authenticated *
trac-admin /path/to/trac/project permission add authenticated WIKI_VIEW
trac-admin /path/to/trac/project permission add <user1> members
trac-admin /path/to/trac/project permission add <user2> members
trac-admin /path/to/trac/project permission add members BROWSER_VIEW CHANGESET_VIEW FILE_VIEW LOG_VIEW MILESTONE_ADMIN REPORT_ADMIN ROADMAP_ADMIN SEARCH_VIEW TICKET_ADMIN TIMELINE_VIEW

As with the "Open" project permissions above, the landing page is visible to all LDAP users, and wiki editing is disabled. However, users must specifically be added to the 'members' group to have access to other Trac features (repo browsing, ticketing, etc).

Administrator privileges

To give full admin privileges to a particular user, including ability to modify permissions for others via the web admin interface, use the following:

trac-admin /path/to/trac/project permission add <user> admin
trac-admin /path/to/trac/project permission add admin TRAC_ADMIN

(In general this should probably be reserved for NCEAS staff responsible for site administration?)

3. Extra customization

SVN authz

To ensure that only authorized SVN repository users can browse the source, add the following to /path/to/trac/project/conf/trac.ini:

[trac]
authz_file = </path/to/svn/authzfile>
authz_module_name = <svn_repo_name>

If this is not configured, the repository (including metadata and properties) will be viewable by all LDAP users in the case of the "Open" project permissions outlined above. For "Private" projects, it shouldn't matter anyway, since permissions on repository-related features have already been restricted at the Trac level. Note that a user will need to have privileges in both Trac and the svnauthz file in order to browse the repository.

NCEAS icon

This assumes our NCEAS icon file 'favicon.ico' as at the root of the virtual host, which is currently the case. Add this to /path/to/trac/project/conf/trac.ini:

[project]
icon = /favicon.ico

NCEAS logo

Put NCEAS logo in project/htdocs directory. (This should really go in a global directory, not the project-specific directory. In that case, replace "site" with "common" in the config line below. I'm not sure where Trac's global stuff is -- I think this behavior might have changed since Trac 0.10? Need to check.)

Add this to /path/to/trac/project/conf/trac.ini:

[header_logo]
alt = NCEAS
height = <height>
width = <width>
link = http://www.nceas.ucsb.edu
src = site/<logo_filename>

(Our smallnceast.png logo is 120 x 121.)

Tweak navigation links

  • Replace Wiki with Home (because this isn't a wiki :)
  • Point the 'Home' link to the collaborative plone site
  • Remove useless Logout link
  • Remove About Trac link

Add these lines to /path/to/trac/project/conf/trac.ini:

[mainnav]
wiki.label = Home
wiki.href = https://somehost.ecoinformatics.org/

[metanav]
logout = disabled
about = disabled

Landing page

Import our template landing page. We don't actually have this page yet, but let's assume we create one and call it template_WikiStart.txt.

wiki import WikiStart /path/to/template_WikiStart.txt

We could easily have a script that first updates this file with custom project name, URL for affiliated Plone site, etc., before importing into the Trac project.

Ticket assignment

By default, the "assign to" field in the New Ticket box accepts arbitrary text. This can be replaced with a drop-down menu that includes all users who (a) have logged in at least once and (b) have TICKET_MODIFY permissions.

To enable this, add this to /path/to/trac/project/conf/trac.ini:

[ticket]
restrict_owner = true

For tips on adding users to this pool before they have logged in, see here

Viewing tickets

As documented here, Trac's report module is being deprecated in favor of a newer query module. Although it doesn't yet implement all of the existing reporting features, the query module provides a nicer interface that should already be sufficient for most usages. The 'View Tickets' link can be set up to serve the query interface instead of the report interface by adding this to /path/to/trac/project/conf/trac.ini:

[components]
trac.ticket.report.* = disabled

Additional visual customization

An overview of the Trac templating system is available. The guide provides basic instructions for overriding standard trac templates and for replacing CSS files to match the look and feel of existing sites.

4. Misc

  • TO DO: Identify good default settings (and customization procedure) for email notification
Personal tools