installing trac

Installing the trac (http://trac.edgewall.org/) project to manage bugs and possibly even features/specifications for your projects. First install the trac dependencies

apt-get install python python-central python-setuptools 
python-pysqlite2 python-subversion libjs-jquery python-genshi 
python-tz python-pygments

use easy_install to install the latest version of trac (we had issues with the apt-get version and attachments)

easy_install -n http://svn.edgewall.org/repos/trac/tags/trac-0.11.4

create the directories that will contain our trac project files

mkdir /opt/trac 
mkdir -p /opt/trac/.trac-base/egg-cache 
cd /opt/trac

create the trac project

trac-admin trac-example initenv

create a password file and setup initial users

htpasswd /opt/htpasswd

make sure apache owns the trac directories

chown -R www-data:www-data /opt/trac

configure apache to handle trac as the root site

vim /opt/apache2/sites-enabled/trac

<VirtualHost *:80>
        Alias /trac/ /usr/share/trac/htdocs 
 
        ErrorLog /var/log/apache2/error.trac.log 
        CustomLog /var/log/apache2/access.trac.log combined 
 
         <Location "/">
                SetHandler mod_python 
                PythonInterpreter main_interpreter 
                PythonHandler trac.web.modpython_frontend 
                PythonOption TracEnvParentDir /opt/trac/ 
                PythonOption TracUriRoot / 
                PythonOption PYTHON_EGG_CACHE /opt/trac/.trac-base/egg-cache 
         </Location>

        # use the following for one authorization for all projects 
        # (names containing "-" are not detected): 
         <Location "/">
            AuthType Basic 
            AuthName "trac" 
            AuthUserFile /opt/htpasswd 
            Require valid-user 

        </Location>

</VirtualHost>

restart apache

/etc/init.d/apache2 restart

check the system with your browser by navigating to http://localhost/

 

Filed under  //

Comments [0]

replicating a subversion repository with svnsync

svnsync can be used to synchronize a remote subversion repository into a local one, this can be useful as a backup mechanism or to allow a trac (http://trac.edgewall.org/) instance to access subversion when it is impractical to host both on the same computer.

Create the new subversion repository and initialize it
svnadmin create svn.example.com

Create the pre-revprop-change hook script required by svnsync

Initialize the repository 
svnsync init file://$PWD/svn.example.com https://svn.example.com/

Resynchronize the repository with the master
svnsync sync file://$PWD/svn.example.com

Setup crontab to perform this operation every 5 minutes
crontab -e
*/5 * * * * /usr/bin/svnsync sync --non-interactive file:///opt/svn.example.com

NOTE: svnsync creates a lock property and if it fails for some reason this lock will prevent any further synchronizations, to remove it use the following
svn proplist --revprop -r 0 file:///opt/svn.example.com/
svn propdel svn:sync-lock --revprop -r 0  file:///opt/svn.example.com/

Filed under  //

Comments [0]