trac

Migrating Trac 0.12 from Debian wheezy to Trac 1.0.2 on jessie including all plugins


I try to migrate a trac installation from a debian wheezy server to another debian jessie.

If I copy all files to the new server I get the message, that I have to upgrade with trac-admin /var/trac/blimus upgrade, which seems to work, but it seems not to update all plugins.

for example I had a plugin installed in the old trac, that lets you login on a webpage instead of the htaccess popup.

On the new server I now get the error

Error: Not Found
No handler matched request to /login

How do I get the web-login back?

Is there a way to analyze the old trac folder, which plugins were installed, so I can install the missing ones in the new installation?

I checked the new trac.ini file and added the missing options, this is my trac.ini

These are my versions:

# trac-admin --version          
Warning: Detected setuptools version 5.5.1.
Welcome to trac-admin 1.0.2

Solution

  • This instruction will work on Debian jessie (Trac 1.0.2), as well as Ubuntu 14.04 trusty (Trac 1.0.1)

    Prerequisites

    On your old Debian wheezy server:

    # cd ~/
    # tar -cvzf trac-example.tgz /var/trac/example
    # cp /var/trac/example/conf/trac.ini trac.ini-example
    # update your trac.ini-example to match new settings
    

    Installation on the new server

    #!/usr/bin/env bash
    
    ####################### config ##############################
    INSTALLPATH=/var/trac/example
    DEPLOYPATH=/var/www/trac-example
    # where you store your tgz backup and the new trac.ini file
    BACKUP_PATH=~/
    #############################################################
    
    # install packages without user interaction:
    export DEBIAN_FRONTEND=noninteractive
    
    apt-get -y install unzip apache2 trac trac-accountmanager trac-xmlrpc libapache2-mod-python libapache2-mod-python-doc libapache2-mod-wsgi
    a2dismod python
    a2enmod rewrite
    
    # add trac user for apache WSGIDaemonProcess:
    adduser --shell /bin/sh --no-create-home --disabled-password trac
    mkdir -p /home/trac/.keep-for-mod_wsgi
    
    mkdir -p /var/trac
    

    # extract the tar-gz file of the trac installation from the old server

    tar -C /var/trac/ -xvzf $BACKUP_PATH/trac-example.tgz 
    
     # copy your new config here:
    cp $INSTALLPATH/conf/trac.ini $INSTALLPATH/conf/trac.ini-backup
    cp $BACKUP_PATH/trac.ini-example $INSTALLPATH/conf/trac.ini
    

    # remove old plugins and eggs

    rm -rf $INSTALLPATH/plugins/nevernotifyupdaterplugin-0.0.* $INSTALLPATH/eggs/*
    

    # update Trac

    cd $INSTALLPATH/
    trac-admin $INSTALLPATH upgrade
    trac-admin $INSTALLPATH wiki upgrade
    trac-admin $INSTALLPATH deploy $DEPLOYPATH/
    chmod ugo+x $DEPLOYPATH/cgi-bin/ $DEPLOYPATH/htdocs/
    
    # downgrade genshi from 7.3 to 6.0 due to error when adding an attachment:
    easy_install -U Genshi==0.6
    # upgrade setuptools
    easy_install -U setuptools==1.4.2
    

    # install neverNotifier Plugin

    # (This is still needed on trac 1.0.x, on 1.2 ist is obsolete)

    cd /tmp
    wget "https://trac-hacks.org/browser/nevernotifyupdaterplugin/1.0?r│
    ev=17630&format=zip"
    unzip 1.0\?r*
    cd 1.0/
    python setup.py bdist_egg
    cp dist/nevernotifyupdaterplugin-1.0-py2.7.egg $INSTALLPATH/plugins/
    

    # setup hosts file

    VHOST=$(cat <<EOF
    <VirtualHost *:80>
      Alias /trac/chrome/common $DEPLOYPATH/htdocs/site/common
      Alias /trac/chrome/site $DEPLOYPATH/htdocs/site
      <Directory "$DEPLOYPATH/htdocs">
        Require all granted
      </Directory>
      <Location "/trac">
        SetEnv TRAC_ENV "$INSTALLPATH"
        SetEnv PYTHON_EGG_CACHE "$INSTALLPATH/.python-eggs"
        SetEnv TRAC_ENV_INDEX_TEMPLATE $INSTALLPATH/templates
      </Location>
      ##trac mit mod_wsgi
      WSGIDaemonProcess trac user=trac group=trac threads=25
      WSGIScriptAlias /trac $DEPLOYPATH/cgi-bin/trac.wsgi
      <Directory $DEPLOYPATH/apache>
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
      </Directory>
      <Directory $DEPLOYPATH/cgi-bin>
        Require all granted
      </Directory>
      <Directory $DEPLOYPATH/htdocs/common>
        Require all granted
      </Directory>
      <Directory $DEPLOYPATH/htdocs/site>
        Require all granted
      </Directory>
    </VirtualHost>
    EOF
    )
    

    # apache config

    echo "${VHOST}" > /etc/apache2/sites-available/trac-example.conf
    a2ensite trac-example
    

    On a fresh installed systen, disable the default apache config

    rm /etc/apache2/sites-enabled/000-default.conf
    

    then restart apache

    service apache2 restart