<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>feisley &#187; Trac</title>
	<atom:link href="http://feisley.com/category/projects/trac/feed/" rel="self" type="application/rss+xml" />
	<link>http://feisley.com</link>
	<description>programming with a side of life</description>
	<lastBuildDate>Thu, 15 Apr 2010 07:33:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Trac &#8211; Part 2</title>
		<link>http://feisley.com/2009/03/02/trac-part-2/</link>
		<comments>http://feisley.com/2009/03/02/trac-part-2/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 15:08:50 +0000</pubDate>
		<dc:creator>Jacob Feisley</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Trac]]></category>

		<guid isPermaLink="false">http://feisley.com/?p=2347</guid>
		<description><![CDATA[In Part 1 I mentioned that I had recently selected Trac as my project management tool of choice. It is fairly feature complete for my needs and where a core feature is lacking, there is usually a plugin to facilitate it.
In this part I will describe how I setup this system. I had specific goals [...]]]></description>
			<content:encoded><![CDATA[<p>In Part 1 I mentioned that I had recently selected Trac as my project management tool of choice. It is fairly feature complete for my needs and where a core feature is lacking, there is usually a plugin to facilitate it.</p>
<p>In this part I will describe how I setup this system. I had specific goals in mind so this may need to be adapted for your needs. Additionally I will briefly cover the Subversion setup that was required to make this work.</p>
<h3><span id="more-2347"></span></h3>
<h2>Goals</h2>
<ol>
<li>Multiple Trac projects needed to be hosted</li>
<li>Seamless integration to the Subversion server</li>
<li>Simple adding of new projects without the need for configuration changes</li>
<li>Single Sign On (SSO) for all projects (see #5)</li>
<li>Centralized authentication for all projects (one account is all you need)</li>
<li>Per project authorization / permissions</li>
</ol>
<h2>Requirements / Supplies</h2>
<ol>
<li>Ubuntu Server 8.04.1 LTS</li>
<li>Subversion 1.5</li>
<li>Python 2.5</li>
<li>Setuptools (for Python)</li>
<li>Trac 0.11.3</li>
<li>Apache 2
<ol>
<li>mod_wsgi</li>
<li>mod_dav</li>
</ol>
</li>
</ol>
<h2>Preliminary Notes<br />
</h2>
<p>In order to attain the goals I mentioned before, I determined the easiest way to proceed was to use subdomains for the &#8220;sections&#8221; and then subdirectories for the projects. For example:</p>
<p><strong>http://dev.mydomain.com/&lt;project1&gt;   <br />
http://dev.mydomain.com/&lt;project2&gt; </strong></p>
<p>and</p>
<p><strong>http://svn.mydomain.com/&lt;project1&gt;   <br />
http://svn.mydomain.com/&lt;project2&gt; </strong></p>
<p>Additionally, it is important to note that I will be applying authentication at the root of each subdomain (thus there is no anonymous access to the Trac instances. If this is not what you want, it is possible to modify your Apache configuration to allow anonymous access.</p>
<p>When I am referring to configuration names and paths, I will use <em> </em> to represent any generic project name for which you may have a Trac and Subversion instance.</p>
<h2>Procedure</h2>
<p>First of all we will need to prepare space on the server for the Trac instances as well as the Subversion repository. These can really be anywhere but for my server I chose the following:</p>
<p>Subversion Repositories: <strong>/var/repos/<em> </em></strong><br />
 Trac Instances: <strong>/var/trac/<em> </em></strong></p>
<p><br class="spacer_" /></p>
<p>Next we will setup the Apache2 server for the Subversion server. I will assume you are familiar with making a new VirtualHost within Apache and will just go over the snippet for the Subversion handler.</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">&lt;Location /&gt;
    AuthType Basic
    AuthName &quot;My Subversion Server&quot;
    AuthUserFile /var/trac/htpasswd
    Require valid-user
&nbsp;
    DAV svn
    SVNParentPath /var/repos/
    SVNListParentPath on
    AuthzSVNAccessFile /etc/apache2/subversion.authz
&lt;/Location&gt;</pre></td></tr></table></div>

<p>The first section deals with enforcing authentication. Notice that it points to <em>/var/trac/htpasswd</em> which will be the global password file for all Trac instances and Subversion.</p>
<p>Also, I used the SVNParentPath to point to /var/repos so that it will automatically map any repository under that path without having to change the VirtualHost.</p>
<p>Notice also the AuthzSVNAccessFile. This is the permissions file for the Subversion server. If you specify this, then you can grant read and write permissions to the repository on a user by user basis. <em>NOTE: If you choose to omit this, then anyone that is in your htpasswd file will be able to write to the repository. </em>For the sake of consistance I placed the global authz file in /var/apache2/</p>
<p>Here is an example &#8220;subversion.authz&#8221; file:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="" style="font-family:monospace;"># Groups
<span class="br0">&#91;</span>groups<span class="br0">&#93;</span>
admin = myusername
&nbsp;
# Global permissions <span class="br0">&#40;</span> &quot;* = &quot;  means default is no access<span class="br0">&#41;</span>
<span class="br0">&#91;</span>/<span class="br0">&#93;</span>
* =
@admin = rw
&nbsp;
# Permissions for &lt;project1&gt;
<span class="br0">&#91;</span>&lt;project1&gt;:/<span class="br0">&#93;</span>
&nbsp;
# Permissions for &lt;project2&gt;
<span class="br0">&#91;</span>&lt;project2&gt;:/<span class="br0">&#93;</span>
user1 = rw
user2 = r</pre></td></tr></table></div>

<p>So, now that we have the Subversion hosting working via apache, we will setup the Trac instance. Start by making sure you have the latest version of Trac installed. At the time of writing this was Trac 0.11.3:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">easy_install Trac</pre></div></div>

<p>Next, you will need the following WSGI handler code to dispatch requests to the Trac server.<br class="spacer_" /></p>
<p>Create a file &#8220;trac.wsgi&#8221; in /var/www/wsgi/</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> trac.<span style="color: black;">web</span>.<span style="color: black;">main</span>
&nbsp;
application = trac.<span style="color: black;">web</span>.<span style="color: black;">main</span>.<span style="color: black;">dispatch_request</span></pre></td></tr></table></div>

<p>After we have this file, we will add the following code to the VirdualHost for trac.mydomain.com:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="" style="font-family:monospace;">WSGIScriptAlias / /var/www/wsgi/trac.wsgi
&nbsp;
&lt;Location /&gt;
    WSGIApplicationGroup %<span class="br0">&#123;</span>GLOBAL<span class="br0">&#125;</span>
    Order deny,allow
    Allow from all
&nbsp;
    SetEnv trac.env_parent_dir /var/trac
&nbsp;
    AuthType Basic
    AuthName &quot;My Trac Server&quot;
    AuthUserFile /var/trac/htpasswd
    Require valid-user
&lt;/Location&gt;</pre></td></tr></table></div>

<p>Once you have added that restart the web server and you should have the Trac site enabled.</p>
<p><br class="spacer_" /></p>
<p>Now we will make a new project called &#8220;TestProject&#8221;. The following commands will do that:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>repos
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> TestProject
<span style="color: #c20cb9; font-weight: bold;">svnadmin</span> create TestProject
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> TestProject
trac-admin TestProject initenv
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chown</span> www-data:www-data <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>repos
<span style="color: #c20cb9; font-weight: bold;">chown</span> www-data:www-data <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>trac</pre></td></tr></table></div>

<p>This will create the Subversion repository as well as initialize the Trac instance.  Note the last two lines where we set the owner of the Subversion and Trac instances to &#8220;www-data&#8221; this is so that the Apache process owns the files and manages all permissions to them.</p>
<h2>Next Steps</h2>
<p>The next steps will be to configure your Trac instances. The config for each instance will be located at &#8220;/var/trac/&lt;project&gt;/config/trac.ini&#8221;. If you used the SVN authz file as I did, there is a place in the config file to specify this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="" style="font-family:monospace;"><span class="br0">&#91;</span>trac<span class="br0">&#93;</span>
authz_file = /etc/apache2/subversion.authz
authz_module_name = &lt;project&gt;
# Where &lt;project&gt; is the repository name.</pre></td></tr></table></div>

<p>This configuratuion will ensure that even if someone has trac browser access, they still must have svn autorization otherwise the browser will display a permission denied error.</p>
<h2>The End!</h2>
<p>I hope you found this useful. If you have any comments or find any errors in my tutorial, please leave me a comment so that I may answer you or fix the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://feisley.com/2009/03/02/trac-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Trac &#8211; Part 1</title>
		<link>http://feisley.com/2009/02/01/trac-part-1/</link>
		<comments>http://feisley.com/2009/02/01/trac-part-1/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 07:33:13 +0000</pubDate>
		<dc:creator>Jacob Feisley</dc:creator>
				<category><![CDATA[Hydra Labs]]></category>
		<category><![CDATA[Trac]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://feisley.com/?p=2255</guid>
		<description><![CDATA[
I recently decided to adopt Trac for my development for Hydra Labs, as well as for my personal and school projects. Trac is a Python powered development tool that includes a wiki, ticketing system, and source browser. Trac focuses on being very transparent and does not require a large process to begin using it. Additionally, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-2256" title="trac_logo" src="http://feisley.com/wp-content/uploads/2009/02/trac_logo-150x42.png" alt="trac_logo" width="150" height="42" /></p>
<p>I recently decided to adopt <a href="http://trac.edgewall.org/">Trac</a> for my development for Hydra Labs, as well as for my personal and school projects. Trac is a Python powered development tool that includes a wiki, ticketing system, and source browser. Trac focuses on being very transparent and does not require a large process to begin using it. Additionally, it is extremely extendable using a vast array of plugins available from the <a href="http://trac-hacks.org/">Trac-Hacks</a> site.</p>
<p>My environment required a few moderate customizations because I wanted to have global authentication so that once I create an account to login to one of my projects, it would be valid for all the other ones. Also I needed to integrate authentication and authorization for the Subversion repository as well.</p>
<p>In Part 2 of this article, I will describe the complete setup process I went through to get this installed and customized to the needs of my projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://feisley.com/2009/02/01/trac-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

