Blog

Converting a trac wiki to Confluence

We wanted to migrate our self-hosted trac wiki to Confluence, hosted by Atlassian (the makers of Confluence). There is a tool called the UWC (Universal Wiki Converter) that can help us.

First we need our trac data in a format that the UWC can process.

Export your wiki pages using the trac-admin utility that is installed when trac was installed:

For example:

To export the attachments, there isn’t a suitable tool in trac v1.0 so I wrote a script to export each attachment that exists in the trac database:

Where tracExportAttachments.php is:

Download the UWC (Universal Wiki Converter) tool from https://marketplace.atlassian.com/plugins/com.atlassian.uwc .
Activate XML RPC on confluence. See Administration -> General Configuration -> Remote API (XML-RPC & SOAP)
Unzip the UCW and launch the tool.

(Help shows the version I was running to be 4. The changelog only goes to 3.13)
Configure the tool:

  • Select type “trac”
  • Set the attachments directory to where the Attachments were exported from the script above.
  • Add all files you have exported.
  • Address that I used: https://peopleperhour.atlassian.net/wiki
  • Space Key that I used: PA – I found this from the “Space Permissions” page in Confluence. They seem to abbreviate the full space names to a few letters.

The tool gives a button to press to test the connection to confluence is working. I had a problem with SSL, which I fixed by editing conf/confluenceSettings.properties and set trustall=true ( see https://migrations.atlassian.net/wiki/display/UWC/UWC+SSL+Support ).
Universal Wiki Converter 4.0_007

I found the converter to fail on some pages that have specific syntax in them. Here’s some examples of things I found it didn’t like:

We had 419 trac pages and 171 attachments. About 20 pages had conversion errors. I fixed each case manually – although I wish I had had time to dig into the UWC sourcecode to fix the conversion errors.

Resources:

  • UWC Quickstart guide: https://migrations.atlassian.net/wiki/display/UWC/UWC+Quick+Start
  • Prepare trac: ( https://migrations.atlassian.net/wiki/display/UWC/UWC+Trac+Notes )
  • How to view a trac attachment:

Update: A few weeks into using the new confluence wiki rather than trac and I have noticed more and more formatting issues. In hindsight I wish I had spent more time learning the migration method and maybe writing a plugin to fix formatting issues in the migration. The manual work to fix them in confluence is ending up a real time sink.

9 Comments

  • Akash

    I am trying to Migrate Trac wiki to Confluence, I am struggling from scratch, Can anyone please help me how to generate the Export. We have Trac installed on Linux box. Please let me know where should i look for and from where am i supposed to fire these command.

    Please help me on this. it would be great help.

    Thanks,
    Akash

    Reply
    • Tom

      Hi Akash, When you installed trac, usually it comes with a utility command called `trac-admin` which will allow you to export. You ssh into the machine that is running trac and run: `trac-admin wiki dump `

      Reply
      • Akash

        Hi Tom,

        I am not trac user so my knowledge on Trac is minus zero, This system is owned by other business owner, Can you please let me know when i fire the command from Terminal where will the dump be stored, I need both Export of Pages as well as Attachments that could allow to migrate Trac wiki to Confluence.

        Thanks,
        Akash

        Reply
        • Tom

          Sorry Akash, you’ll have to research this yourself using available documentation.

          Reply
  • Akash

    Hi Tom,

    Thank You,

    Thanks & Regards,
    Akash

    Reply
  • Akash

    Hi Tom,

    I have successfullt exported all wiki pages from trac to local directory, I have attachments as well all the attachments were stored on some directory. for Eg: attachments/..

    All Attachments are stored in respective directory.

    I am facing issue while exporting these into Confluence i am getting error as :
    No attachment found:

    Reply
  • Alex

    Hi,

    Thanks for the information but where is the code for tracExportAttachments.php?

    Reply
    • phenomenon

      Alex, here: confluence.atlassian.com/download/attachments/689014127/exportTrac.php

      Reply
    • Tom

      Hmm, It went missing, thanks for pointing it out Alex. I’ve added the tracExportAttachments.php script back now

      Reply

Post A Comment