Posts Tagged ‘shared host’

  1. trac-bzr setup

    Not so easy on a shared host:

    First, get bazaar. Because we have no gcc ability, we need to set up a config file to change some values in. First create ~/.pydistutils.cfg. You need to add the lines:

    [build_ext]
    allow-python-fallback=1

    This now allows us to build bazaar:

    easy_install --prefix=~ bzr

    With Bazaar installed fetch the latest version of trac-bzr:

    bzr branch lp:trac-bzr

    You then need to set it up. Navigate to the trac-bzr folder and run:

    python setup.py install --prefix=~

    Once installed, you need to add/change some lines in your trac.ini file.

    Add
    tracbzr.* = enabled

    To the components section and

    Change
    repository_dir = /your/repository/location
    repository_type = bzr

    Once that is complete, you need to get the stuff into your repository. First run bzr repo-init and then change to your working repository and run bzr push sftp:/location/of/repo.

  2. 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!

  3. 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!

  4. Perl, cPanel and Bugzilla

    There are a few things that need to be done to get it working:

    Firstly, in 4 Perl scripts (checksetup.pl, testserver.pl, index.cgi and Bugzilla.pm) you need to add the path to the alternative Perl modules that cPanel has installed:

    BEGIN {
        my $homedir = ( getpwuid($>) )[7];
        my @user_include;
        foreach my $path (@INC) {
            if ( -d $homedir . '/perl' . $path ) {
                push @user_include, $homedir . '/perl' . $path;
            }
        }
        unshift @INC, @user_include;
    }

    When you run the ./checksetup.pl file you may need to specify more options, especially if your Perl installation constantly runs out of memory:

    ./checksetup.pl --no-templates --make-admin

    and all should work.