This forum is no longer active. Please post your questions to our new community site

Forums Trac

GUIDE: Modify Trac stack for ease of use

Subscribe to GUIDE: Modify Trac stack for ease of use 4 post(s), 2 voice(s)

 
Avatar echoecho 3 post(s)

Hello,

The default Trac stack is configured such that you can easily run multiple Trac and SVN projects with minimal fuss. But what if you only want one instance? This brief guide will show you how to:

- Remove the BitNami landing page
- Get rid of the /trac/project-name URL (Shorter URLs = happy users!)
- Host everything from Apache, no SVNServe (Only one port!)
- Use a single htpasswd file (Centralized login file!)

First, turn off both the Apache and Subversion services/daemons. In Windows, that means Windows-R → type “services.msc” → Enter. Find tracApache and tracSubversion, and right-click “Stop” both of them. While you’re at it, go into tracSubversion’s properties and change it from Automatic to Manual. This disables it until/unless you need it again.

Second, open up trac.conf (located in Install\trac\conf). This assumes you’re using the latest distribution of BitNami Trac, which uses the newer WSGI instead of mod_python. Find the line that says “LocationMatch” and change that line to the following:
<LocationMatch “/login”>

Third, in that same file, add this to the very end, changing the filepath to wherever your repository is located:
<Location /svn>
DAV svn
SVNPath C:\SVN

Fourth, open up trac.wsgi (located in Install\trac\conf). Change “TRAC_ENV_PARENT_DIR” to “TRAC_ENV”, and change the folder to your trac SUB-folder. That is, if you told BitNami to put your trac instance in C:/Trac/, and your instance was called project, the folder should be C:/Trac/Project. Go check to make sure!

Fifth, start ONLY the tracApache service. You will never need tracSubversion again unless you want to go back to the old way. At this point, the following URLs should be valid:
- example.com – loads Trac project homepage
- example.com/login (or the Trac login link) – requests authentication
- example.com/svn – loads SVN (which is also the URL you can run a checkout from)

Finally, decide how you want to run with authentication. I believe this current setup lets anyone view Trac and SVN, lets anyone commit to SVN, and uses normal logins for Trac. Since you’re using only Apache, and only that htpasswd file, you can set up authentication in any manner Apache supports. Personally, I just set up a login required to use any part of the Trac/SVN site at all by copy-pasting the LocationMatch portion of trac.conf and making some minor changes:

AuthType Basic
AuthName “Trac”
AuthUserFile " …. Install\trac/conf/htpasswd"
Require valid-user

Nice, eh? We just turned:
http://example.com/trac/SuperProject/wiki/TracG… into:
http://example.com/wiki/TracGuide

Which is real nice for those multi-layered Trac wikis! Plus, you can now just put a link to example.com/svn on your start page, rather than walk people through the SVN default port. Enjoy!

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Thanks a lot for this great guide. This would be helpful for other bitnami users. We can not integrate the URL changes but we will check the SVN configuration to integrate it.

 
Avatar echoecho 3 post(s)

Absolutely. The relevant reading on Apache versus SVNServe is here:
http://svnbook.red-bean.com/en/1.5/svn.serverco…

The guide does mention Apache being slower; I’m not sure how true that statement still is. In my experience, small-scale deployments tend to favor Apache for ease of hosting, and large-scale deployments tend to favor Apache for more features. Either way, it is nice to only have one server running :)

The URL changes are definitely more personal preference, though a “single-project mode” toggle in the installer would be an easy & useful feature. The main frustration comes from Trac being favorable to long URLS, and various /folders/ stack up quick. I’d bet you could incorporate the BitNami brand landing page into it if desired; the trac main URL is actually /wiki, so you could have the base URL / alias to /BitNami.html, and link them to /wiki to enter Trac.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Thanks, maybe we can include an option to configure Trac in single-project mode. We will investigate it.

Forums Trac