onsdag 10 september 2008

Trac on windows

Trac is a rightfull bitch to install on win32 as it requires very specific version matching of packages. This is a long winded installation note with the more or less latest versions available as of this writing.

I'm hoping to get working on TortoiseSVN and Trac integration once this is done (ie, make tortoise automatically set variables etc sent in change notes, which can hence update the issue tracking systems in trac and so forth. The way of working is really really sweet imho, and I think it could be a really nice way of working. I'm just sad that I have to set all this serverstuff up on windows though.

Let's begin with a list of all the installation files used:

python-2.5.2.msi
setuptools-0.6c8.win32-py2.5.exe
py25-pysvn-svn150-1.6.0-975.exe
svn-python-1.5.2.win32-py2.5.exe
Genshi-0.5.win32-py2.5.exe
Trac-0.11.win32.exe
WampServer2.0c.exe
CruiseControl-2.7.3.exe
TortoiseSVN-1.5.3.13783-win32-svn-1.5.2.msi
WampServer2-APACHE229.exe
svn-win32-1.5.2.zip
mod_python-3.3.1.win32-py2.5-Apache2.2.exe


These packages should be fairly simple to get started with. Install them straight on, in the order mentioned.

python-2.5.2.msi
setuptools-0.6c8.win32-py2.5.exe
py25-pysvn-svn150-1.6.0-975.exe
svn-python-1.5.2.win32-py2.5.exe
Genshi-0.5.win32-py2.5.exe
Trac-0.11.win32.exe

Install the above packages in that order. Some errors i ran into:

Unsupported version control system "svn"

I accidentally used svn-python-1.5.0.win32-py2.5.exe. It also complained about not finding SSLEAY32.DLL which threw me off course, looking for the wrong solution.

Secondary applications
On top of this, the following applications where installed (not yet configured/set up).

WampServer2.0c.exe
CruiseControl-2.7.3.exe
TortoiseSVN-1.5.3.13783-win32-svn-1.5.2.msi

WampServer2-APACHE229.exe
The Apache2.2.9 must be installed before svn-win32-1.5.2.zip files are, and the .so files must be put in 2.2.9 as that package will not run on Apache2.2.8. Apache 2.2.8 with svn-win32-1.5.2.zip will die silently without hint as to why it died.

Once all of the above is installed, create a svn repository in c:\projects\svn\test (create directories, and then right click test and choose TortoiseSVN -> Create repository here.
Now create a trac database in c:\projects\trac\test\ by running

c:\python2.5\trac-admin.exe c:\projects\trac\test\ initenv

Answer the questions asked by trac-admin.exe. To test the trac at this point, run tracd.exe per ordinations from trac-admin.exe.

svn-win32-1.5.2.zip
Contains required files to make dav_svn work in apache2.2, edited extract on how to install:
For an Apache server here's the essentials:
1. Copy bin/mod_dav_svn.so and bin/mod_authz_svn.so to the Apache modules directory.
2. Add the Subversion/bin directory to the SYSTEM PATH.
3. Edit the Apache configuration file (httpd.conf) and make the following changes:
3a. Uncomment the following two lines:

#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so

3b. Add the following two lines to the end of the LoadModule section:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

3c. Add the following to end of the file.

<location /svn>
DAV svn
SVNPath c:\projects\svn\test
AuthType Basic
AuthName "My Subversion repository"
AuthUserFile "c:\projects\svn\test\conf\passwd" Require valid-user
</location>

Add users to passwd file above:

C:\wampbin\apache\apache2.2.9\bin\htpasswd.exe -b \projects\svn\test\conf\passwd myuser hejhej

Finally installing Trac in apache2.2

mod_python-3.3.1.win32-py2.5-Apache2.2.exe
To run trac via apache, you need the above module for apache as well. Once this is done, add the following to modules section of apache:

LoadModule python_module modules/mod_python.so

To test the python installation add the following to the end of your httpd.conf:

<location /mpinfo>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler mod_python.testhandler
</location>

And if that works, test the following:

<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv "c:/projects/trac/test/"
PythonOption TracUriRoot /trac
</Location>

Further reading