Posts Tagged ‘trac’

  1. 64bit, virtual-python.py and anoyances caused

    Host broke, gave us a new server. This however was 64bit and broke Trac. To get it working again:

    • Modify the virtual-python file line
    stdlib_dir = join(prefix, 'lib', py_version)

    to

    stdlib_dir = join(prefix, 'lib64', py_version)

    and run.

    • Then re-follow the first few steps in guide on installing Trac, up to and including the easy_install of Trac, found here
    • Now rename the library in the home folder from lib to lib64

    All should now be working!

  2. Python, Trac and shared hosting

    Easy, step by step:

    Set up a “virtual” python installation by running this script: virtual-python, then add these to your .bash_profile:

    export PYTHONPATH="$HOME/lib/python2.4/site-packages"
    export LD_LIBRARY_PATH="$HOME/packages/lib"
    export PATH="$HOME/packages/bin:$PATH"

    then reload your bash profile with source .bash_profile

    Next get the easy install package: EasyInstall and run it:

    sh setuptools-0.6c9-py2.4.egg --prefix=~

    This now allows you to install Trac in an easier way:

    easy_install --prefix=~ Trac

    Next setup the Trac environment:

    trac-admin /path/to/project initenv

    then deploy it for use on a webserver. Due to a bug you need to create another directory to deploy to and then copy over:

    trac-admin /path/to/project deploy /other/dir
    mv /other/dir/* /path/to/project

    Now the fun begins – you need to makes sure all permissions are correct. Navigate to the cgi-bin directory and run:

    chmod +rx trac.cgi

    You also need to change #!/usr/bin/python to your python path

    The next step is to create an index.cgi page to fix the shared server path bugs:

    #!/bin/bash
    export HOME="/your/site/home"
    export TRAC_ENV="$HOME/path/to/trac"
    export PYTHONPATH="$HOME/lib/python2.4/site-packages"
    export PATH="$HOME/bin:$PATH"
    export LD_LIBRARY_PATH="$HOME/lib"
    /full/path/to/trac/cgi-bin/trac.cgi

    and as before, run chmod +rx index.cgi to get it working

    Now we need to setup up a .htaccess file to ensure it all works:

    DirectoryIndex cgi-bin/index.cgi
     
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /path/to/.htpasswd/file
    Require valid-user

    The auth stuff is needed for later. You need to create a htpasswd file with the name of the user you would like to add as admin to it to initially get it running. A better approach will be used when it’s running.

    The next step is to check it all works! Once you’ve checked it is in fact live and kicking, you need to add the permissions to access it.

    trac-admin /path/to/trac/site
    >> permissions add admins TRAC_ADMIN
    >> permissions add {your_name} admins

    And you should now be able to log in!

    The next step is to get the some better authentication working. First:

    easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9

    to install the account manager plugin.

    Then simply add the location of the password file in the htpasswd section of the account manager admin. You now need to disable your authentication in the .htaccess file you originally setup so that the HTML login will work. simply comment out the authentication lines.

    Next, edit trac.ini , adding trac.web.auth.LoginModule = disabled to the components section (or disable in the trac admin).

    Finally, we need to set up Trac so that it uses a static location for files seen as we’re stuck using CGI. Simply edit the trac.ini section so that the htdocs_location reads the full URL to it: http://your-site.com/htdocs/common/.

    Now all should be working!