The transition of my trac install to leopard's shiny new Apache environment started out smooth, but required some trickery as it turned out later.
Here's the story of my trac transition from Tiger to Leopard
I started with trac 0.11dev some months ago and I am very pleased to work with trac.
I think, that 0.11 is much easier to install and handle as its predecessors. As I am a newcomer to trac, i don't rely on many plugins and so I can safely get away with 0.11.
First I needed my svn repository up and working again. That was a breeze as svn is already installed on Leopard. So I only needed to copy my repository folder over from my backup disk to its new location (svn is a cool thing!) and edit the httpd config file:
add the following line (dunno, why it is NOT there in the first place commented out like the php5 module...)
LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
(as apache is compiled with dav_svn support and the dav_svn comes also preinstalled, I don't quite get, why this line was not in the standard httpd.conf. anyone?)
while we are there just enable php5, as we will need it later anyway.
Now, for each svn reporitory I have something like this at the end of httpd.conf:
AuthName "Subversion Repository"
For now I have only "AuthType Basic", which isn't exactly secure, but I leave the digest authentication for later.
Note also, that I have my repositories and my trac environments in /Library. That's my personal choice.
I though, that it might be a good idea to have these things close to the WebRoot directory, which Apple chose to put in /Library/WebServer/.
I don't think it is a bad location, but certainly /usr/share/ or /opt/local/share/ is another good option. (...more or less personal preference I think)
I have also my svn and my trac environment folder owned by user _www, because in most cases I will use these via the webserver.
sudo chown -R /Library/svn/
After restarting the server we can check our repository by pointing the browser to it.
Since I chose to use mysql with trac (against recommendation) just because I have no experience with the other databases at all and mysql is something I have already used for other things, it is now time to get mysql upp and running on my shiny new Leopard OS.
It turns out, that there is no 64-bit binary, which is where the trouble started.
Read how I got mysql working on 10.5
and mysql-python which is required so trac can interface with the mysql database.
The transition of the mysql databases was also a simple matter of copying the database files into the mysql folder.
I downloaded, configured and installed phpmyadmin in my webroot folder so I could check the mysql install and create and grant permissions to the mysql user I use in trac.
Now it's time to get trac. (I have faith in the trac developers and install from trunk the latest revision)
First create a folder somewhere in your development environment, where you want to store the working copy of the svn checkout. In my case it's ~/Documents/Programming/trac/tracsvn/
mkdir -p ~/Documents/Programming/trac/tracsvn/trac
svn co http://svn.edgewall.org/repos/trac/trunk
that's the place where I also keep the working copies of the plugins and trac related sources later.
sudo python setup.py install
In my case it compiled and installed without a problem.
Next I copied my trac environment folders from my backup to /Library/trac and changed the owner to _www
sudo ditto /Volumes/backup/Library/trac /Library/
sudo chown -R _www /Library/trac
Now edited the httpd.conf again in order to register my trac environments with the apache server.
my setup is simple and consists of two things in httpd.conf:
the scriptalias to the trac location on the server and the Locations of the different trac environments (each trac project)
for each trac project I have something like:
Allow from all
"Allow from all" since authentication is handled via the authentication plugin within trac. (If you want instead basic http authentication it would look like:
and the cgi script for trac (in the alias_module section):
ScriptAlias /trac /Library/WebServer/CGI-Executables/trac.fcgi
Copy the cgi script from the working copy of the trac svn repository, which we checked out earlier into the directory specified in the scriptalias directive and edit the trac.fcgi file.
The first line (shebang) didn't work in my standard install as it didn't point to the python2.5 binary. It can be changed to:
but it is nontheless a good idea to make symlinks as many scripts will use #!/usr/bin/python as shebang line.
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python /usr/bin/python
and while we are there make some other symlinks for the python environment too (dunny why they aren't there in the first place):
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python-config /usr/bin/python-config
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 /usr/bin/python2.5
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config /usr/bin/python2.5-config
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw /usr/bin/pythonw
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5 /usr/bin/pythonw2.5
back to trac.fcgi:
add the following lines before the line from trac.web import fcgi_frontend just after try:
os.environ['TRAC_ENV_PARENT_DIR'] = "/Library/trac"
(mind the indentation, it matters in python)
make the cgi file executable and owned by _www:
sudo chmod 755 /Library/WebServer/CGI-Executables/trac.fcgi
sudo chown _www /Library/WebServer/CGI-Executables/trac.fcgi
From this point on my trac enviroments where up and running.
In order to speed up performance I installed mod_fcgid, which significantly speeds up trac at the cost however of RAM, as the trick is that it stays in RAM.
At that point I noticed, that it is pretty tricky to get the modules to work, as they wouldn't compile in 64-bit architecture out of the box. It wasn't exactly easy to figure it out, but in afterwards all seems to be easy as always. ;-)
Read how to get mod_fcgid up on leopard here
Since I gave up with fcgid at the first try, I tried mod_python (installation description here) and wsgi (installation description here). I got them both compiled OK, as you can see, but I didn't succeed in making one of both play nice with mysql (resp. mysql-python egg). Perhaps this will require a 64-bit mysql server?!