How To Migrate From Trac To Redmine
How To Migrate From Trac To RedmineThis tutorial describes how to migrate from trac to redmine. Originally written to perform an upgrade from trac 0.10.3 (old etch server) to Redmine 1.0.1 (squeeze) but was successfully tested with trac 0.11 and 0.12, as well as Redmine 1.0.5 and 1.1.2 (1.2 is also working. This version was also tested to produce the upstream patch but not intensively). Do not forget to disable trac to prevent users from using it during the migration.
1. Back Up Trac Data
ssh oldtracserver
2. Install Redmine On The New ServerPretty straightforward even if running the standalone server requires some tricks :
aptitude install redmine Now you now can go to http://newredmineserver:3000 to be greeted by the default redmine page.
3. Install A Development EnvironmentPeople might argue that this is optional but it is a very important step. You are likely to do a lot of mistakes with a new unfamiliar tool so you will be glad that you tried it on dev beforehand. The production database will be kept clean of all trial and errors which might save you from redoing a lengthy migration. vi /etc/redmine/default/database.yml development: adapter: sqlite3 database: /var/lib/dbconfig-common/sqlite3/redmine/instances/default/redmine_default-dev encoding: utf8
cd /usr/share/redmine
4. Clean Up Redmine Test EnvironmentIf you still managed to mess up your database during your migration, here is how to recover a clean redmine environment:
rm /var/lib/dbconfig-common/sqlite3/redmine/instances/default/redmine_default*
5. Migrate Trac DB To Redmine'sThe script used for the migration has been heavily customised to import more data from trac than the default script shipped with redmine. I based my work on the Trac Importer Patch Coordination effort from Redmine's forum. More specifically on the most advanced version of the script that can be found here. My modifications add the following enhancements:
It also fixes some bugs in the current script:
And some ugly hack that might be removed:
I sent it upstream hoping they will put it in a future version of redmine. Else you can download it from our public SVN: trac-redmine/migrate_from_trac.rake. The corresponding patch for Redmine's trunk revision 5857 is here: trac-redmine/migrate_from_trac.rake_r5857.patch. Once you have the new script, run:
rake redmine:migrate_from_trac RAILS_ENV="production" As said above each my script will add a link in each timelog comments pointing to the correct note in the issue. Unfortunately timelog entries are not textiled and so are displayed as raw text. If you want to change this behaviour you will have to apply the patch from this issue to your Redmine:
cd /usr/share/redmine
6. SVN MigrationIf you are migrating SVN to a new server as well, here is a small procedure. Nothing exciting you will find the same all over the web, this is just for reference:
6.1. Back Up SVN On The Old host
ssh oldsvnserver
6.2. Import On The New Host
svnadmin create project1
7. Link Redmine To SVNIf you used trac tickets links in your commit message with "See #" and "Fix #" heavily like us then don't forget to add the following:
7.1. Add pre-revprop-change Hooks To Allow Revision Modifications
cd /var/lib/svn/ #!/bin/sh exit 0
ln -s /var/lib/svn/pre-revprop-change project1/hooks/
7.2. Modify SVN Commits' Logs
rake redmine:migrate_from_trac_svn RAILS_ENV="production"
7.3. Set Up All Repositories In RedmineIn redmine, go to: your project -> Settings -> Repository (i.e. http://newredmineserver:3000/project1/settings/repository):
7.4. Sync Redmine DB From SVNYou have to generate a key first by going back in Administration -> Settings -> Repository (i.e. http://newredmineserver:3000/settings?tab=repositories): Then to import all projects' repository at once run: wget "http://newredmineserver:3000/sys/fetch_changesets?key=8qKxftrhICYt8bPEShVa"
8. Upgrade To Redmine 1.0.5Squeeze version of redmine is vulnerable to this security advisory (at the time of writing 21/04/2011) which is corrected in 1.0.5. aptitude -t squeeze-backports install redmine redmine-sqlite That's it! Your trac projects should now be migrated completely to redmine. The only remaining issues we encountered where from bogus data in Trac, or badly formatted HTML in wiki pages that needed to be modified manually. Despite these few exceptions the script will do pretty much all the work for you.
9. Links
|






Recent comments
20 hours 18 min ago
1 day 1 hour ago
1 day 2 hours ago
1 day 3 hours ago
1 day 5 hours ago
1 day 9 hours ago
1 day 10 hours ago
1 day 12 hours ago
2 days 1 hour ago
2 days 3 hours ago