Step by step: Trac on Windows – restoring a Linux backup of Trac onto a Windows system

Introduction

In September 2006 I made a major decision on my company Source Code Management (SCM) strategy and signed up with http://www.hosted-projects.com, which provide a hosted solution for SubVersion, Trac and Bugzilla.  A few years earlier, I’d already moved my SCM from SourceSafe to SubVersion hosted on my own server on a local network.  However, I really wanted to move to a hosted provider so I could have remote access to the SCM without worrying about firewall configuration and software updates, never mind having to leave a server on 24 hours a day in a home office.

As well as SubVersion I gained access to Trac and Bugzilla.  I never really got on with Bugzilla, but Trac became an essential tool for helping me to organise my own work schedule and enable remote development for clients.  Within months I realised how useful, and essential, a hosted solution had become and so signed up for backups of both SVN and Trac. I have access to daily backups and these are included them in my own weekly backups. 

During the last three years I’ve been shockingly neglectful and trusted the guys at Hosted Projects and never actually attempted to restore the Trac backups.  For my hosted service, Trac is run on a Linux server, but with a complete dump of the Trac folder structure in the backup I suspected getting it working under Windows was completely feasible.  I finally restored my first Trac/SubVersion combined backup last week, and was impressed at how quickly I had it working, although you do have to be careful. 

This blog details how I took my SubVersion and Trac backups and restored them to run under Windows 7.  Hopefully this should be the first in a series of blogs;

  1. Restoring a Trac installation onto Windows
  2. Installing a new SubVersion/Trac repository onto Windows
  3. Configuring Trac to use Mercurial instead of SubVersion
  4. Configuring Trac to use GIT instead of SubVersion

The following installation notes were made on Windows 7 Ultimate 64 bit running under VirtualBox 3.1.2.

Documentation available for installation of Trac on Windows

The Trac project is available at http://trac.edgewall.org, with the latest stable release of Trac being  0.11.6.  This is the version running on my Hosted Projects service.

The general installation instructions for Windows can be found at, http://trac.edgewall.org/wiki/TracOnWindows,

More importantly there are incredibly useful step by step instructions at, http://trac.edgewall.org/attachment/wiki/TracOnWindows/Step_by_Step-installation-manual.txt

Planning and downloading the correct setup components

It is possible to get information on the version of Trac you are running at Hosted Projects, you can click on the ‘Powered by Trac 0.11.6’ link at the bottom of the home page.  This provides a detailed list of the versions of all the components within the Trac site.

Trac system information, component versions
In addition to Trac 0.11.6, I needed Python 2.5.4, python-2.5.4.msi,

      http://www.python.org/download/releases/2.5.4/

I found the setup tools in the Python Packages area, http://pypi.python.org/pypi, under http://pypi.python.org/pypi/setuptools/0.6c11#downloads,

Finding the setuptools in Python Packages area
 

For the setup tools, I downloaded the MS Windows installer that matched my version of python, setuptools-0.6c11.win32-py2.5.exe

Genshi is the Python library used to generate web pages.  This package is hosted by edgewall.org, the same guys responsible for Trac, at http://genshi.edgewall.org/wiki/Download. Again, I downloaded the MS Windows Installer that matched my version of python (2.5), Genshi-0.5.1.win32-py2.5.exe.

Okay, who thought if was funny to hide the SubVersion download?

To enable the SubVersion integration I headed off to Subversion, http://subversion.tigris.org/, but was redirected to as they have been accepted to the Apache Incubator at http://subversion.apache.org/ . Click on Getting Subversion->Binary Packages on left hand menu (and then selecting Windows), you can locate the Windows installation files, http://subversion.apache.org/packages.html#windows

In the list is SlikSVN, which would by normal suggestion for your standard end user who wants a simple installer but not what I really needed for a Trac installation.  However, also present on this page is a link back to tigris.org, and it is where I ended up for the Apache 2.2 compatible files, http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100.

I downloaded two files; the SubVersion command line setup and the SubVersion Python module integration; Setup-Subversion-1.6.6.msi and svn-python-1.6.6.win32-py2.5.exe.

Installation order

  1. python-2.5.4.msi (install for all users)
  2. setuptools-0.6c11.win32-py2.5.exe (Run As Administrator)
  3. Genshi-0.5.1.win32-py2.5.exe (Run As Administrator)
  4. (reboot system)
  5. Add c:\Python25;C:\Python25\Scripts to path. (Windows 7, Control Panel -> System and Security -> System -> Advanced System Settings, Environment Variables button)
  6. Setup-Subversion-1.6.6.msi (install for all users)
  7. svn-python-1.6.6.win32-py2.5.exe (Run As Administrator)
  8. Trac-0.11.6.win32.exe (Run As Administrator)
  9. For a restore, create c:\project\trac, then copy the entire backup folder tree to, say, c:\project\trac\tiger
  10. Assuming you have restored the SubVersion repository, edit the Trac configuration file to point at the restored SubVersion repository; repository_dir = c:\svn\tiger (for my folder layout the configuration file is at, c:\projects\trac\tiger\conf\trac.ini)
  11. Resynchronise the Trac database with the SubVersion repository in its new location using the trac-admin python script; trac-admin c:\projects\trac\tiger resync
  12. Create the file c:\Python25\Scripts\trace-digest.py as detailed in the step by step guide to support creating a ‘users’ text file with encrypted passwords
  13. You can then use trace-digest.py to create users (for myself that meant the same login names as already present in my Trac backup); trac-digest.py -u "admin" -p adminpassword >> C:\projects\trac\users.txt
  14. Finally run the python script to create Trac web server listening for requests; tracd-script.py -p 80 --auth="*",C:\projects\trac\users.txt,trac c:\projects\trac\tiger
  15. Browse to http://127.0.0.1/tiger, and log in as the admin user you have configured

Lesson learned

The lesson should be that I should have attempted this restoration of a vital backup many years ago, but it does prove that the Hosted Projects backup solution is happy to restore to a different operating system if required.

Next step

My aim is to write up how to create a completely new SubVersion/Trac installation which should be fairly similar to the above, but will include initial creation of the Trac installation and SubVersion repository.  I suspect it may also require more details regarding the configuration options, as this will not be a canned backup that has most of the options pre-configured.

Notes

  1. When I first installed Python I glibly installed the 64-bit version, ignoring the fact that the supporting modules were only 32-bit.  This meant that the 32-bit modules complained that Python was not installed, as they could not locate the correct registry entry.  Never forget that there are separate registry hives for 32-bit and 64-bit programs.  I went back to a 32-bit Python install as security/performance is not really a consideration for myself, I just want to be able to restore a Trac system in an emergency.
  2. User Access Control is present under Windows 7 (although this could equally apply to Vista or Windows Server 2008). While an MSI installer will ask for permission when it executes, any ‘old fashioned’ setup files that are a standalone EXE have to be Run As Administrator manually, otherwise they will fail;Running an EXE setups as administrator
  3. The first time I ran Trac I had not installed the SVN Python tools, something that was missing of the Trac on Windows installation notes.
  4. Once the SVN Python tools were installed, I then received a message within Trac that the location of the SubVersion repository had changed and I needed to use a trac-admin resync command to synchronise the local SubVersion repository check in data to the Trac database.
  5. If you have trouble in Windows 7 finding how to change the Path environment variable setting, this image might help,

Editing PATH environment variable

 

Print | posted on Tuesday, February 2, 2010 10:38 AM

Comments on this post

# re: Step by step: Trac on Windows – restoring a Linux backup of Trac onto a Windows system

Requesting Gravatar...
Thank you buddy, your blog helped me alot to implement Trac
your blog have a massive help
Left by Muhammad Haseeb on Dec 06, 2010 6:26 PM

Your comment:

 (will show your gravatar)