Trac migration

This how-to shows the migration of a Trac environment from a 0.11 installation to a 0.12 installation.

1. Create backups

First thing you should do is backing up the source database as a dump including the structure. This can be done  with your favorite tool. I used MySQL workbench for both exporting and importing the dump.

Then, use Trac’s hotcopy tool to backup your environment.

trac-admin /path/to/projenv hotcopy /path/to/backupdir

If you have a .htpasswd, save it.

2. Prepare target

Create a new database, which you’ll be using during the target environment configuration.

Install Trac in the target machine. I’m using Ubuntu so I just made a simple install using the software center.

Initialize the environment and point it to the new database.

trac-admin /path/to/myproject initenv

Start Trac and check everything is alright.

tracd --port 8000 /path/to/myproject

3. Restore backups

Stop Trac. Starting with the simplest, copy the backup .htpasswd to its new destination.

Then, replace with your hot copy the environment contents.

Finally, and most important, drop all the tables inside the database and import the dump including the structure.

4. Upgrade

First upgrade the database.

trac-admin /path/to/projenv upgrade

Then, upgrae the wiki.

trac-admin /path/to/projenv wiki upgrade

And finally, start your new environment.

tracd --port 8000 --basic-auth=*,/path/to/.htpasswd /path/to/projenv


Failed to create environment. Cannot load Python bindings for MySQL

You need to install a Phyton binding for your database, e. g. python-mysqldb in Ubuntu.

OperationalError: (1050, “Table ‘cache’ already exists”)

You need to restore the database backup into an empty database as said in step three.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s