Trac

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
(Configuration)
 
(16 intermediate revisions not shown)
Line 282: Line 282:
   
   
 +
 +
==Configuration==
 +
===TracNavigation===
 +
[http://trac.edgewall.org/wiki/TracNavigation TracNavigation]: The main navigation entries can be edited by [mainnav] and [metanav] configuration sections.
 +
e.g.) To change roadmap path from <code>/roadmap</code> to <code>/roadmap?show=all</code> in order to display all the milestones including completed ones, add the following lines to the <code>conf/trac.ini</code> file.
 +
[mainnav]
 +
roadmap.href = /roadmap?show=all
 +
 +
===SVN===
 +
Run
 +
trac-admin $ENV repository resync "svn-name"
 +
e.g.)
 +
trac-admin /opt/trac/project repository resync "(default)"
 +
 +
Add the following line to the <code>post-commit</code> file in the svn hook dir (e.g. <code>/opt/svn/project/hooks</code>)
 +
trac-admin $ENV changeset added "$REPOS" "$REV"
 +
 +
e.g.)
 +
trac-admin /opt/trac/project changeset added "$REPOS" "$REV"
 +
trac-admin /opt/trac/project changeset added "repo-name" "$REV"
 +
 +
uncomment
 +
"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
 +
 +
e.g.)
 +
# "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
 +
 +
=== Git and Gitolite ===
 +
==== Install Git Plugin ====
 +
* For Trac 0.12
 +
$ easy_install http://github.com/hvr/trac-git-plugin/tarball/master
 +
$ /etc/init.d/apache2 restart
 +
 +
* For Trac 0.11:
 +
easy_install http://github.com/hvr/trac-git-plugin/tarball/trac-0.11
 +
* or alternatively the Python 2.4 backport:
 +
easy_install http://github.com/hvr/trac-git-plugin/tarball/trac-0.11-py24
 +
 +
==== Permission ====
 +
* Resolve the permission issue
 +
$ addgroup git-readers
 +
$ usermod -a -G git-readers,www-data git
 +
$ usermod -a -G git-readers www-data
 +
 +
$ chown git:git-readers /home/git
 +
$ chown -R git:git /home/git/repositories
 +
 +
$ chmod u=rwx,g=rx,o= /home/git
 +
$ chmod -R u=rwx,g=rx,o=rx /home/git/repositories
 +
 +
$ su - git
 +
 +
* modify /home/git/.gitolite.rc file
 +
$REPO_UMASK = 0077;
 +
to
 +
$REPO_UMASK = 0022;
 +
 +
# -2 for the group.
 +
# -7 for the others.
 +
 +
$ exit
 +
$ /etc/init.d/apache2 restart
 +
 +
==== Post Hook (This may not work!) ====
 +
* Git post-comment hook
 +
$ cd project-repo/.git/hooks  (remote)
 +
$ vim post-commit
 +
 +
#!/bin/sh
 +
#
 +
REV=$(git rev-parse HEAD)
 +
trac-admin /some/trac/project changeset added "(default)" $REV
 +
 +
* for post commit update
 +
$ chown git:git-readers post-receive
 +
$ chmod g+w trac.log
==Plugin Installation==
==Plugin Installation==
Line 288: Line 364:
===WebAdmin===
===WebAdmin===
WebAdmin is web user interface to administrate trac.
WebAdmin is web user interface to administrate trac.
 +
* From 0.11 it is included in the core package so no need to install it.
====Installation====
====Installation====
Line 309: Line 386:
  ==========================
  ==========================
 +
-Optional
 +
Change <code>max_daysback</code> value
 +
max_daysback = -1
 +
* max_daysback Maximum number of days (-1 for unlimited) displayable in the Timeline. (since 0.11)
===AccountManagerPlugin===
===AccountManagerPlugin===
-To make managing trac account easy, install account manager plug-in.
-To make managing trac account easy, install account manager plug-in.
 +
-To see the details, visit the [http://trac-hacks.org/wiki/AccountManagerPlugin AccountManagerPlugin] homepage.
====Install====
====Install====
Line 325: Line 407:
For Trac 0.9:
For Trac 0.9:
-
 
+
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9  
-
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9  
+
Line 333: Line 414:
Then install this plugin:
Then install this plugin:
-
 
+
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10  
-
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10  
+
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-
For Trac 0.11: (and check #899 patch)
+
For Trac 0.11 / 0.12 <span style="text-decoration:line-through;">(doesn't currently work with 0.11.4, see [http://trac-hacks.org/ticket/4125 #4125]) (also if necessary, check #899 patch): </span>
 +
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.11
 +
-----------------------------------------------------------------------------
-
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
 
 +
<span style="text-decoration:line-through;">For Trac 0.12: </span>
 +
<span style="text-decoration:line-through;"> $ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk </span>
====Configuration====
====Configuration====
Line 426: Line 509:
-
==Known Problem with Mylyn==
+
===Syntax Highlighting Plugin===
-
===Problem===
+
==== Installation ====
 +
If syntax highlighting does not work, install [http://pygments.org Pygments]
 +
<pre>
 +
$ easy_install Pygments
 +
</pre>
 +
 
 +
==== Configuration ====
 +
It is automatically detected and used by trac once it is installed.
 +
 
 +
 
 +
=== Server Side Redirect from a Wiki Page ===
 +
[http://trac-hacks.org/wiki/ServerSideRedirectPlugin ServerSideRedirectPlugin] is a plugin to automatically redirect a wiki page to another wiki (or web) page.
 +
 
 +
==== Installation ====
 +
===== Install ExtractUrlPlugin =====
 +
To install Server Side Redirect plug in [http://trac-hacks.org/wiki/ExtractUrlPlugin ExtractUrlPlugin] must be installed first.
 +
$ sudo easy_install http://trac-hacks.org/svn/extracturlplugin/0.11
 +
 
 +
===== Install ServerSideRedirectPlugin =====
 +
$ sudo easy_install http://trac-hacks.org/svn/serversideredirectplugin/0.11
 +
 
 +
==== Configuration ====
 +
Open the trac.ini file and add the following lines.
 +
[components]
 +
tracserversideredirect.* = enabled
 +
tracextracturl.* = enabled
 +
 
 +
=== ColorMacro ===
 +
[http://trac-hacks.org/wiki/ColorMacro ColorMacro] is a plugin to change the colour of text and background.
 +
 
 +
==== Installation ====
 +
http://trac-hacks.org/ticket/8524
 +
http://trac-hacks.org/wiki/WikiStart#HowdoIinstallthesethings
 +
 
 +
===== Download the macro file =====
 +
For 0.11:
 +
$ wget http://trac-hacks.org/svn/colormacro/0.11/Color.py
 +
 
 +
For 0.12:
 +
$ wget http://trac-hacks.org/svn/colormacro/0.12/ColorMacro.py
 +
 
 +
===== Move to Plugins Directory =====
 +
* Move the macro file to the plugins directory of the project environment.
 +
$ chown www-data:www-data ColorMacro.py
 +
$ mv ColorMacro.py /trac_env_location/plugins/
 +
 
 +
 
 +
==== Usage ====
 +
<pre>
 +
[[Color( background-color, color , text )]]
 +
or
 +
[[Color( color , text )]]
 +
</pre>
 +
* ''none'' for no colour change.
 +
e.g.)
 +
<pre>
 +
[[Color(none,red,No background colour change but the text)]]
 +
</pre>
 +
 
 +
===IniAdminPlugin===
 +
[http://trac-hacks.org/wiki/IniAdminPlugin IniAdminPlugin] is a Trac plugin to edit the options in trac.ini file via the [http://trac-hacks.org/wiki/WebAdminPlugin WebAdminPlugin].
 +
==== Installation ====
 +
for 0.11 and 0.12
 +
sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11
 +
'''Note:''' It may require a restart of the server process to apply the changes.
 +
 
 +
 
 +
== Issues ==
 +
===Issue with python-setuptools===
 +
====Problem====
 +
If some warning messages like the following ones appear during installation, user addition, etc.
 +
<pre>
 +
/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/loader.py:41: UserWarning: Unbuilt egg for setuptools [unknown version] (/usr/lib/python2.6/dist-packages)
 +
  pkg_resources.Environment(search_path)
 +
/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/loader.py:68: UserWarning: Unbuilt egg for setuptools [unknown version] (/usr/lib/python2.6/dist-packages)
 +
  entry.load(require=True)
 +
</pre>
 +
 
 +
====Solution====
 +
Re-install python-setuptools
 +
$ rmdir /usr/lib/python2.6/dist-packages/setuptools.egg-info
 +
$ apt-get install --reinstall python-setuptools
 +
 
 +
 
 +
====Reference====
 +
https://bugs.launchpad.net/ubuntu/+source/distribute/+bug/576434/comments/13
 +
 
 +
===Known Problem with Mylyn===
 +
====Problem====
Mylyn, an Eclipse plug-in, is currently not working with Trac 0.11. It does not recognise Trac 0.11 repository.
Mylyn, an Eclipse plug-in, is currently not working with Trac 0.11. It does not recognise Trac 0.11 repository.
-
===Solution===
+
====Solution====
It can be solved by using [http://trac-hacks.org/wiki/XmlRpcPlugin XmlRpcPlugin].
It can be solved by using [http://trac-hacks.org/wiki/XmlRpcPlugin XmlRpcPlugin].
-
-To install,
+
-To install (for 0.11 and 0.12),
<pre>
<pre>
-
$ sudo easy_install http://trac-hacks.org/svn/xmlrpcplugin/trunk/
+
$ sudo easy_install -Z -U http://trac-hacks.org/svn/xmlrpcplugin/trunk  
</pre>
</pre>
-Access the Trac and log in with the admin ID. Go to the Admin menu and enable all the components or the following ones in the TracXMLRPC plug-in.
-Access the Trac and log in with the admin ID. Go to the Admin menu and enable all the components or the following ones in the TracXMLRPC plug-in.
 +
tracrpc.api.* — License: BSD
 +
  XMLRPCSystem — Core of the RPC system.
 +
 +
<span style="text-decoration: line-through;">tracrpc.json_rpc.* — License: BSD</span>
 +
<span style="text-decoration: line-through;">  JsonRpcProtocol — Example `POST` request using `curl` with `Content-Type` header and body:</span>
 +
 +
tracrpc.search.* — License: BSD
 +
  SearchRPC — Search Trac.
 +
 +
tracrpc.ticket.* — License: BSD
 +
  ComponentRPC — Interface to ticket component objects.
 +
  MilestoneRPC — Interface to ticket milestone objects.
 +
  PriorityRPC — Interface to ticket priority.
 +
  ResolutionRPC — Interface to ticket resolution.
 +
  SeverityRPC — Interface to ticket severity.
 +
  StatusRPC — An interface to Trac ticket status objects. Note: Status is defined by workflow, and all methods except `getAll()` are deprecated no-op methods - these will be removed later.
 +
  TicketRPC — An interface to Trac's ticketing system.
 +
  TypeRPC — Interface to ticket type.
 +
  VersionRPC — Interface to ticket version objects.
 +
 +
tracrpc.web_ui.* — License: BSD
 +
  RPCWeb — Handle RPC calls from HTTP clients, as well as presenting a list of methods available to the currently logged in user. Browsing to <trac>/rpc or <trac>/login/rpc will display this list.
 +
 +
tracrpc.wiki.* — License: BSD
 +
  WikiRPC — Superset of the &#91;http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API&#93;.
 +
 +
tracrpc.xml_rpc.* — License: BSD
 +
  XmlRpcProtocol — There should be XML-RPC client implementations available for all popular programming languages. Example call using `curl`:
 +
 +
'''Note''': ''RPCWeb'' and ''XmlRpcProtocol'' are required for login
 +
 +
OLD (don't need it):
  XMLRPCSystem
  XMLRPCSystem
  WikiRPC
  WikiRPC
  All the components with '''.ticket'''
  All the components with '''.ticket'''
 +
-If the authentication fails, it might be because of the [http://trac-hacks.org/wiki/XmlRpcPlugin#ProblemswhenAccountManagerPluginisenabled problem with AccountManagerPlugin].
 +
It can be solved by using [http://trac-hacks.org/wiki/HttpAuthPlugin HttpAuthPlugin].
 +
 +
=====HttpAuthPlugin=====
 +
[http://trac-hacks.org/wiki/HttpAuthPlugin HttpAuthPlugin]
 +
 +
======Installation======
 +
$ sudo easy_install http://trac-hacks.org/svn/httpauthplugin/trunk
 +
 +
======Configuration======
 +
[components]
 +
httpauth.* = enabled
-
*When accessing the Trac through Mylin, select '''<code>XML-RPC Pligin (Rev. 1950)</code>''' in the 'Additional Settings' as the access type.
+
-To add additional paths for XmlRpc ('''Optional'''):
 +
[httpauth]
 +
paths = /xmlrpc, /login/xmlrpc
 +
Don't forget to restart the server.
 +
*Now go to the Permissions menu in the web admin and give the '''XML_RPC''' permission to the users who are allowed to access the trac through XML RPC.
 +
*When accessing the Trac through Mylyn, select '''<code>XML-RPC Pligin (Rev. 1950)</code>''' in the 'Additional Settings' as the access type.
==Trac with SSL and Virtual Host==
==Trac with SSL and Virtual Host==

Latest revision as of 15:16, 10 August 2012


Contents

Trac

Trac is an open-source Issue Tracking System.

Trac Installation

Install Trac 0.11 on Ubuntu Linux 8.10 Intrepid

From the Ubuntu Repository

$ sudo apt-get install trac libapache2-mod-python python-mysqldb 

Through easy_install

It requires the following dependencies to be installed beforehand.

$ apt-get install python-pysqlite2 python-subversion python-support python-setuptools libapache2-mod-python python-mysqldb 
  • Install Trac through easy_install in the python-setuptools.
$ sudo easy_install Trac 

Install Trac 0.11 on Ubuntu Linux 8.04 Hardy

  • Install dependencies.
$ sudo apt-get install python-pysqlite2 python-subversion python-support python-setuptools libapache2-mod-python python-mysqldb 
  • Install it.
$ sudo easy_install Trac 


  • Not necessary if using easy_install
  1. *Extract the trac 0.11 archive file downloaded from the trac web-site.
# $ tar -xzvf Trac-0.11.1.tar.gz 
  1. *Install it.
# $ cd Trac-0.11.1 
# $ sudo easy_install Trac 


Preparation for Project Creation

-To set up and use trac,

  1. Trac project directory should be created.
  2. Trac project directory info should be added to apache2 sites-enabled.
  3. Database for the Trac should be created.

Create Project Directory

-To set up a trac project, create a directory for the project.

$ sudo mkdir /opt/trac 
$ sudo chown www-data:www-data /opt/trac 

-Create available site info for trac

$ cd /etc/apache2/sites-available 
$ sudo vim trac 

Add Project Info to Apache

-Add the following lines

    <Location /trac>
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /opt/trac
        PythonOption TracUriRoot /trac
#        PythonOption PYTHON_EGG_CACHE /tmp
        SetEnv PYTHON_EGG_CACHE /tmp
        SSLRequireSSL
    </Location>

    <LocationMatch "/trac/[^/]+/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile /etc/subversion/.passwd
        Require valid-user
    </LocationMatch>

-SSLRequireSSL is to use SSL for accessing the Trac project.

-If PythonOption PYTHON_EGG_CACHE /tmp does not work and the following errors are displayed, use SetEnv PYTHON_EGG_CACHE /tmp instead.

...

ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg
cache:

  [Errno 13] Permission denied: '/var/www/.python-eggs'

The Python egg cache directory is currently set to:

  /var/www/.python-eggs

Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.


-Enable it and reload apache2 config or restart it.

$ sudo a2ensite trac 
$ sudo /etc/init.d/apache2 reload 
or
$ sudo /etc/init.d/apache2 restart 


Create the Database and Setup the User

-Create the database for the trac.

CREATE DATABASE `trac` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;


-Check if its character set is correct

mysql> USE trac; 
Database changed
mysql> SHOW VARIABLES LIKE '%character%'; 
+--------------------------+--------------------
| Variable_name            | Value
+--------------------------+--------------------
| character_set_client     | cp1251
| character_set_connection | cp1251
| character_set_database   | utf8
| character_set_filesystem | binary
| character_set_results    | cp1251
| character_set_server     | utf8
| character_set_system     | utf8
| character_sets_dir       | C:\DevServer\Instal
+--------------------------+--------------------
8 rows in set (0.00 sec)


-Allocate the admin user of the trac database.

GRANT ALL ON `trac`.* TO `trac`@`localhost` IDENTIFIED BY 'password'; 
FLUSH PRIVILEGES;


-The connection string is

mysql://trac:password@localhost/trac


Project Environment Initialisation

-Now initialise project.

$ sudo trac-admin /opt/trac/project initenv 
Creating a new Trac environment at /opt/trac/project                   

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 Project

 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]> mysql://trac:password@localhost/trac

 Please specify the type of version control system,
 By default, it will be svn.                       

 If you don't want to use Trac with version control integration, 
 choose the default here and don't specify a repository directory. 
 in the next question.                                             

Repository type [svn]> svn

 Please specify the absolute path to the version control 
 repository, or leave it blank to use Trac without a repository.
 You can also set the repository location later.                

Path to repository [/path/to/repos]> /opt/svn/myproject

Creating and Initializing Project
 Installing default wiki pages   
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracImport imported from TracImport
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracIni imported from TracIni      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracNavigation imported from TracNavigation
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TitleIndex imported from TitleIndex        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTimeline imported from TracTimeline    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSearch imported from TracSearch        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracWiki imported from TracWiki            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracCgi imported from TracCgi              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiRestructuredText imported from WikiRestructuredText
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracAdmin imported from TracAdmin                      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRoadmap imported from TracRoadmap                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiNewPage imported from WikiNewPage                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiFormatting imported from WikiFormatting            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/RecentChanges imported from RecentChanges              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSupport imported from TracSupport                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRevisionLog imported from TracRevisionLog          
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiDeletePage imported from WikiDeletePage            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracLogging imported from TracLogging                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTicketsCustomFields imported from TracTicketsCustomFields
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracFastCgi imported from TracFastCgi                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracStandalone imported from TracStandalone                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracBackup imported from TracBackup                          
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracAccessibility imported from TracAccessibility            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracNotification imported from TracNotification              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracModPython imported from TracModPython                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracWorkflow imported from TracWorkflow                      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracChangeset imported from TracChangeset                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/CamelCase imported from CamelCase                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracGuide imported from TracGuide                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracBrowser imported from TracBrowser                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracEnvironment imported from TracEnvironment                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRss imported from TracRss                                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/PageTemplates imported from PageTemplates                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterMapTxt imported from InterMapTxt                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiProcessors imported from WikiProcessors                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracQuery imported from TracQuery                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterWiki imported from InterWiki                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracPermissions imported from TracPermissions                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterTrac imported from InterTrac                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracReports imported from TracReports                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTickets imported from TracTickets                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiStart imported from WikiStart                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiRestructuredTextLinks imported from WikiRestructuredTextLinks
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracLinks imported from TracLinks                                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiPageNames imported from WikiPageNames                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracInstall imported from TracInstall                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracUnicode imported from TracUnicode                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracInterfaceCustomization imported from TracInterfaceCustomization
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracPlugins imported from TracPlugins                              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracUpgrade imported from TracUpgrade                              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiMacros imported from WikiMacros                                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracFineGrainedPermissions imported from TracFineGrainedPermissions
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiHtml imported from WikiHtml                                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/SandBox imported from SandBox                                      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSyntaxColoring imported from TracSyntaxColoring                
 Indexing repository                                                                                                         

---------------------------------------------------------------------
Project environment for 'My Project' created.

You may now configure the environment by editing the file:

  /opt/trac/project/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

  tracd --port 8000 /opt/trac/project

Then point your browser to http://localhost:8000/project.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

  http://trac.edgewall.org/

Congratulations!

-Set the permission.

$ sudo chown -R www-data:www-data /opt/trac 


Configuration

TracNavigation

TracNavigation: The main navigation entries can be edited by [mainnav] and [metanav] configuration sections. e.g.) To change roadmap path from /roadmap to /roadmap?show=all in order to display all the milestones including completed ones, add the following lines to the conf/trac.ini file.

[mainnav]
roadmap.href = /roadmap?show=all

SVN

Run

trac-admin $ENV repository resync "svn-name"

e.g.)

trac-admin /opt/trac/project repository resync "(default)"

Add the following line to the post-commit file in the svn hook dir (e.g. /opt/svn/project/hooks)

trac-admin $ENV changeset added "$REPOS" "$REV"

e.g.)

trac-admin /opt/trac/project changeset added "$REPOS" "$REV"
trac-admin /opt/trac/project changeset added "repo-name" "$REV"

uncomment

"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf

e.g.)

# "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf

Git and Gitolite

Install Git Plugin

  • For Trac 0.12
$ easy_install http://github.com/hvr/trac-git-plugin/tarball/master 
$ /etc/init.d/apache2 restart 
  • For Trac 0.11:
easy_install http://github.com/hvr/trac-git-plugin/tarball/trac-0.11
  • or alternatively the Python 2.4 backport:
easy_install http://github.com/hvr/trac-git-plugin/tarball/trac-0.11-py24

Permission

  • Resolve the permission issue
$ addgroup git-readers 
$ usermod -a -G git-readers,www-data git 
$ usermod -a -G git-readers www-data 
$ chown git:git-readers /home/git 
$ chown -R git:git /home/git/repositories 
$ chmod u=rwx,g=rx,o= /home/git 
$ chmod -R u=rwx,g=rx,o=rx /home/git/repositories 
$ su - git 
  • modify /home/git/.gitolite.rc file
$REPO_UMASK = 0077;

to

$REPO_UMASK = 0022;

# -2 for the group.
# -7 for the others.
$ exit 
$ /etc/init.d/apache2 restart 

Post Hook (This may not work!)

  • Git post-comment hook
$ cd project-repo/.git/hooks  (remote)
$ vim post-commit 
#!/bin/sh
#
REV=$(git rev-parse HEAD)
trac-admin /some/trac/project changeset added "(default)" $REV
  • for post commit update
$ chown git:git-readers post-receive
$ chmod g+w trac.log

Plugin Installation

There are numerous plug-ins available for Trac.

WebAdmin

WebAdmin is web user interface to administrate trac.

  • From 0.11 it is included in the core package so no need to install it.

Installation

  • Install the trac:WebAdmin plug-in.
#sudo svn export http://svn.edgewall.com/repos/trac/sandbox/webadmin/
$ sudo easy_install http://svn.edgewall.com/repos/trac/sandbox/webadmin/ 
  • add TRAC_ADMIN permission to the user 'admin' in the project.
$ sudo trac-admin /opt/trac/project/ permission add admin TRAC_ADMIN 
  • create an htpasswd file or an htaccess file for the admin user.


Configuration

-add below to trac.ini (It is probably only for version 0.10. It has not been checked for 0.9)

==========================
[components]
webadmin.* = enabled
==========================

-Optional

Change max_daysback value

max_daysback = -1
  • max_daysback Maximum number of days (-1 for unlimited) displayable in the Timeline. (since 0.11)

AccountManagerPlugin

-To make managing trac account easy, install account manager plug-in. -To see the details, visit the AccountManagerPlugin homepage.

Install

-First make sure you've installed setuptools. $ sudo apt-get install python-setuptools


Then you can install the plugin using the easy_install application.

Note: Windows users will need to add easy_install to their PATH.

For Trac 0.9:

$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9 



For Trac 0.10:

Then install this plugin:

$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10 


For Trac 0.11 / 0.12 (doesn't currently work with 0.11.4, see #4125) (also if necessary, check #899 patch):

$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.11 


For Trac 0.12:

 $ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk 

Configuration

  • Make sure virtual host setup for trac has the following info and, the .htpasswd file has a user the username of which is admin. The file must be located in the right place as specified below. Otherwise it will get an error message when logging in.
    <LocationMatch "/[^/]+/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile /etc/subversion/.test_passwd
        Require valid-user
    </LocationMatch>
  • Access Trac and log in with admin ID.
  • Go to Admin menu and configure Accounts module (probably almost everything expect htpasswd ones and RegistrationModule).
  • Go to Accounts -> Configuration
  • Set HtDigestStore (The file does not have to exist as Trac will create one yet it is better to use the existing htdigest file with the admin user info).
e.g.)
1  HtDigestStore
    filename: /opt/trac/project/conf/.filename.htdigest
    realm: realm_name
  • The /opt/trac/project/conf/.filename.htdigest file can be shared with svn in both apache site setup and SvnServePasswordStore.
e.g.)
-- SvnServePasswordStore
    filename: /opt/trac/project/conf/.filename.htdigest


  • Add the following lines to trac.ini file in the trac_project/conf directory (Not necessary for 0.11)

trac.ini

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.htfile.abstractpasswordfilestore = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.http.httpauthstore = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled
acct_mgr.pwhash.htpasswdhashmethod = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.loginmodule = disabled
webadmin.* = enabled
  • may only need this.
add: trac.web.auth.loginmodule = disabled
  • If email verification is used, also make sure that smtp is enabled.
[notification]
......
smtp_enabled = true


  • Not necessary if you set it up through web admin.
[account-manager]
htdigest_realm = tectra_trac
password_file = /opt/trac/project/conf/users.htdigest
password_store = HtDigestStore

-or

[account-manager]
htdigest_realm = tectra_trac
password_file = /opt/trac/project/conf/users.htpasswd
password_store = HtPasswdStore
  • Optional: change
[trac]
...
default_charset = iso-8859-15

to

[trac]
...
default_charset = utf-8


  • Comment out the authentication info of trac in the available sites (/etc/apache2/sites-available/trac).
#  <LocationMatch "/trac/[^/]+/login">
#    AuthType Basic
#    AuthName "Trac"
#    AuthUserFile /etc/subversion/.passwd
#    Require valid-user
#  </LocationMatch>
  • Restart Apache2
$ sudo /etc/init.d/apache2 restart 


Syntax Highlighting Plugin

Installation

If syntax highlighting does not work, install Pygments

$ easy_install Pygments 

Configuration

It is automatically detected and used by trac once it is installed.


Server Side Redirect from a Wiki Page

ServerSideRedirectPlugin is a plugin to automatically redirect a wiki page to another wiki (or web) page.

Installation

Install ExtractUrlPlugin

To install Server Side Redirect plug in ExtractUrlPlugin must be installed first.

$ sudo easy_install http://trac-hacks.org/svn/extracturlplugin/0.11
Install ServerSideRedirectPlugin
$ sudo easy_install http://trac-hacks.org/svn/serversideredirectplugin/0.11

Configuration

Open the trac.ini file and add the following lines.

[components]
tracserversideredirect.* = enabled
tracextracturl.* = enabled

ColorMacro

ColorMacro is a plugin to change the colour of text and background.

Installation

http://trac-hacks.org/ticket/8524 http://trac-hacks.org/wiki/WikiStart#HowdoIinstallthesethings

Download the macro file

For 0.11:

$ wget http://trac-hacks.org/svn/colormacro/0.11/Color.py 

For 0.12:

$ wget http://trac-hacks.org/svn/colormacro/0.12/ColorMacro.py 
Move to Plugins Directory
  • Move the macro file to the plugins directory of the project environment.
$ chown www-data:www-data ColorMacro.py 
$ mv ColorMacro.py /trac_env_location/plugins/


Usage

[[Color( background-color, color , text )]]
or
[[Color( color , text )]]
  • none for no colour change.

e.g.)

[[Color(none,red,No background colour change but the text)]]

IniAdminPlugin

IniAdminPlugin is a Trac plugin to edit the options in trac.ini file via the WebAdminPlugin.

Installation

for 0.11 and 0.12

sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11 

Note: It may require a restart of the server process to apply the changes.


Issues

Issue with python-setuptools

Problem

If some warning messages like the following ones appear during installation, user addition, etc.

/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/loader.py:41: UserWarning: Unbuilt egg for setuptools [unknown version] (/usr/lib/python2.6/dist-packages)
  pkg_resources.Environment(search_path)
/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/loader.py:68: UserWarning: Unbuilt egg for setuptools [unknown version] (/usr/lib/python2.6/dist-packages)
  entry.load(require=True)

Solution

Re-install python-setuptools

$ rmdir /usr/lib/python2.6/dist-packages/setuptools.egg-info 
$ apt-get install --reinstall python-setuptools


Reference

https://bugs.launchpad.net/ubuntu/+source/distribute/+bug/576434/comments/13

Known Problem with Mylyn

Problem

Mylyn, an Eclipse plug-in, is currently not working with Trac 0.11. It does not recognise Trac 0.11 repository.

Solution

It can be solved by using XmlRpcPlugin.

-To install (for 0.11 and 0.12),

$ sudo easy_install -Z -U http://trac-hacks.org/svn/xmlrpcplugin/trunk 


-Access the Trac and log in with the admin ID. Go to the Admin menu and enable all the components or the following ones in the TracXMLRPC plug-in.

tracrpc.api.* — License: BSD
  XMLRPCSystem — Core of the RPC system.

tracrpc.json_rpc.* — License: BSD
  JsonRpcProtocol — Example `POST` request using `curl` with `Content-Type` header and body:

tracrpc.search.* — License: BSD
  SearchRPC — Search Trac.

tracrpc.ticket.* — License: BSD
  ComponentRPC — Interface to ticket component objects.
  MilestoneRPC — Interface to ticket milestone objects.
  PriorityRPC — Interface to ticket priority.
  ResolutionRPC — Interface to ticket resolution.
  SeverityRPC — Interface to ticket severity.
  StatusRPC — An interface to Trac ticket status objects. Note: Status is defined by workflow, and all methods except `getAll()` are deprecated no-op methods - these will be removed later.
  TicketRPC — An interface to Trac's ticketing system.
  TypeRPC — Interface to ticket type.
  VersionRPC — Interface to ticket version objects.

tracrpc.web_ui.* — License: BSD
  RPCWeb — Handle RPC calls from HTTP clients, as well as presenting a list of methods available to the currently logged in user. Browsing to <trac>/rpc or <trac>/login/rpc will display this list.

tracrpc.wiki.* — License: BSD
  WikiRPC — Superset of the [http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API].

tracrpc.xml_rpc.* — License: BSD
 XmlRpcProtocol — There should be XML-RPC client implementations available for all popular programming languages. Example call using `curl`:

Note: RPCWeb and XmlRpcProtocol are required for login

OLD (don't need it):

XMLRPCSystem
WikiRPC
All the components with .ticket

-If the authentication fails, it might be because of the problem with AccountManagerPlugin. It can be solved by using HttpAuthPlugin.

HttpAuthPlugin

HttpAuthPlugin

Installation
$ sudo easy_install http://trac-hacks.org/svn/httpauthplugin/trunk 
Configuration
[components]
httpauth.* = enabled

-To add additional paths for XmlRpc (Optional):

[httpauth]
paths = /xmlrpc, /login/xmlrpc

Don't forget to restart the server.

  • Now go to the Permissions menu in the web admin and give the XML_RPC permission to the users who are allowed to access the trac through XML RPC.
  • When accessing the Trac through Mylyn, select XML-RPC Pligin (Rev. 1950) in the 'Additional Settings' as the access type.

Trac with SSL and Virtual Host

-Edit /etc/apache2/sites-available/trac file with the following lines.

<VirtualHost *:443>
    ServerAdmin kevin@yoursite.com

    SSLEngine on

    SSLOptions +StrictRequire

    SSLCertificateFile /etc/ssl/certs/server.crt
    SSLCertificateKeyFile /etc/ssl/private/server.key

#    DocumentRoot /opt/trac
    ServerName trac.yoursite.com

#    <Location /trac>
   <Location />
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /opt/trac
#        PythonOption TracUriRoot /trac
        PythonOption TracUriRoot /
#        PythonOption PYTHON_EGG_CACHE /tmp
        SetEnv PYTHON_EGG_CACHE /tmp
#        SSLRequireSSL
    </Location>

#    <LocationMatch "/[^/]+/login">
#        AuthType Basic
#        AuthName "Trac"
#        AuthUserFile /etc/subversion/.test_passwd
#        Require valid-user
#    </LocationMatch>
</VirtualHost>


  • To use htdigest instead of htpasswd
    <LocationMatch "/[^/]+/login">
        AuthType Digest
        AuthName realm
        AuthUserFile /somepath/.mclicker.htdigest
        Require valid-user
    </LocationMatch>
  • Yet this might not be necessary. Better use an htpasswd for accessing trac then use web admin to set up an htdigest file for the user management.


  • Restart Apache2
$ sudo /etc/init.d/apache2 restart 
  • If the authentication type is Digest and there is an error message like this
Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration
   ...fail!
  • Enable auth_digest module.
$ a2enmod auth_digest 


Now trac can be accessed through the URL https://trac.yoursite.com so the project URL in the Trac will be like below.

https://trac.yoursite.com/myproject
Personal tools