Trac and Subversion on Site5 (Updated again)
Before I try and take all the glory I need to thank Chandra who did most of the work. All I’ve done is modify it for just Site5. You can find her article at http://chandraonline.net/blog/?p=17
Site5 allows multiple accounts in trac but only a single account in subversion because it’s through ssh rather than through webdav.
Site5 comes with subversion and Python installed so most of the work is already done. Before we start I’m going to make a couple of assumptions.
- Our repository will be at ~/repos
- Trac will be installed at ~/trac
- Trac projects will be stored at ~/trac-projects
- We are only going to setup a single version of trac.
- We want to access trac from http://www.example.com/trac
1. Contact Support
Contact Support and get them to add you to the compilers group and change my environment so I can access /usr/include. When I requested this it took less than 5 minutes for them to respond.
2. Installing ClearSilver (0.10.3):
Download http://www.clearsilver.net/downloads/clearsilver-0.10.3.tar.gz and upload it to your server using ftp.
$ tar xzvf clearsilver-0.10.3.tar.gz
$ mv clearsilver-0.10.3 clearsilver-0.10.3-dist
$ cd clearsilver-0.10.3-dist
$ ./configure –prefix=$HOME/clearsilver-0.10.3 –with-python –disable-ruby –disable-java –disable-perl –disable-csharp
$ make ; make install –prefix=$HOME/clearsilver-0.10.3
3. Install Trac
Download Trac http://ftp.edgewall.com/pub/trac/trac-0.9.5.tar.gz and upload it to your server using ftp.
$ tar xzvf trac-0.9.5.tar.gz
$ mv trac-0.9.5 trac-0.9.5-dist
$ cd trac-0.9.5-dist
$ python setup.py build
$ python setup.py install –prefix=/home/??????/trac
$ cp ~/clearsilver-0.10.3-dist/python/neo_cgi.so ~/trac/lib/python2.3/site-packages/
4. Setup a Subversion Repository
$ svnadmin create ~/repos
5. Setup a Trac Environment
$ trac-admin $HOME/trac-projects initenv
6. Create the link between Subversion and Trac.
$ mkdir ~/trac/contrib/
$ svn cat http://svn.edgewall.com/repos/trac/trunk/contrib/trac-post-commit-hook > trac-post-commit-hook
$ create a ~/repos/hooks/post-commit with the following content (replace ???????? with you details):
#!/bin/sh
REPOS=”$1″
REV=”$2″
LOG=`/usr/bin/svnlook log -r $REV $REPOS`
AUTHOR=`/usr/bin/svnlook author -r $REV $REPOS`
TRAC_ENV=’/home/????????/trac-projects’
TRAC_URL=’http://www.????????.com/trac/’
/usr/bin/python /home/????????/trac/contrib/trac-post-commit-hook \
-p “$TRAC_ENV” \
-r “$REV” \
-u “$AUTHOR” \
-m “$LOG” \
-s “$TRAC_URL”
7. Setup Webaccess
$ mkdir $HOME/public_html/trac
$ cd trac
# create a projects.cgi with the following content (replace ???????? with you details):
#!/bin/bash
export PATH=”/home/????????/trac/bin”:$PATH
export PYTHONPATH=”/home/????????/trac/lib/python2.3/site-packages”
export TRAC_ENV=”/home/????????/trac-projects”
/home/????????/trac/share/trac/cgi-bin/trac.cgi
$ chmod +x projects.cgi
$ ln -sf $HOME/python/share/trac/htdocs trac-static
# edit $HOME/trac-projects/conf/trac.ini and add the following under [trac]
htdocs_location = /trac-static
Using Site5 Backend create users and passwords on the directory.
If you find and mistakes in this document please feel free to leave a comment or email me.
Update April 2008: The comments were lost when I migrated this post to a new blog. I’ve tried to answer the questions here.
- When I setup Trac it only supported SQLite so I don’t know how to set it for for MySQL. I would personally recommend SQLite anyway as it will probably be faster on Site5.
- This version of Trac doesn’t have pretty URLs so you have to click on the CGI script that you created. If there is a problem you might want to move projects.cgi to cgi-bin
- When you install ClearSilver make sure you use “python setup.py install –prefix=$HOME/trac” if you miss the prefix then there will be problems later on.
- Subversion over http/https isn’t possible at Site5 because they Frontpage extensions which are incompatible with subversion module for apache.
- If you have only just found this page you may want to install Trac 0.11 instead of 0.10 because then you don’t have to install ClearSilver.