Edgewall Software

Version 2 (modified by lmwangi, 17 years ago) ( diff )

Migration

I had to migrate a subversion and Trac enviroment between two machines; Different distributions. For svnsync, it is required to have both svn server versions ≥ 1.4.0

Subversion Replication

  • Create a repository on the new server
    $ svnadmin create /var/spool/raid/svn_repo
    
  • Make sure the commit hooks are configured to allow our 'svnsync' user to do anything it wants.
    $ echo "#!/bin/sh" > /var/spool/raid/svn_repo/hooks/pre-revprop-change
    $  chmod +x /var/spool/raid/svn_repo/hooks/pre-revprop-change
    
  • Set destination repo to version 0 (svnsync —opts dest_repo src_repo)
    $  svnsync --username svnsync  init file:///var/spool/raid/svn_repo/   svn+ssh://root@192.168.11.128/home/repos/projects/  
    Copied properties for revision 0.
    
  • Sync the repositories
    $  svnsync --username=svnsync --non-interactive sync file:///var/spool/raid/svn_repo/
    Committed revision 1.
    Copied properties for revision 1.
    Committed revision 2.
    Copied properties for revision 2.
    Committed revision 3.
    Copied properties for revision 3.
    Committed revision 4.
    Copied properties for revision 4.
    Committed revision 5.
    Copied properties for revision 5.
    Committed revision 6.
    Copied properties for revision 6.
    Committed revision 7.
    .....
    
    
  • Done!!!

Trac Migration

  • Install a Trac enviroment on the destination machine
  • On the source machine, dump the sqlite db:
    $ sqlite3 /path/to/trac/db/trac.db ".dump" >> sqlite_trac.sql
    
  • Adjust the system table (sqlite_trac.sql) to fix the repository_dir if it's different in the destination machine
     INSERT INTO "system" VALUES('repository_dir', 'svn:fc784ba1-7bb2-4f0b-9d6b-749d55304f83:/var/spool/raid/svn_repo');
    

  • Copy the db script to the destination machine
    $ scp sqlite_trac.sql root@192.168.11.125:/root/
    
  • Import the script into a db and copy it to the relevant folder
    $ cat sqlite_trac.sql | sqlite3  trac.db
    $ mv trac.db  /var/spool/raid/trac/db/trac.db
    $ chown -R www-data /var/spool/raid/trac/db/trac.db
    
  • Migrate any attachments that may exist
    $ scp  /home/trac/attachments/wiki root@192.168.11.125:/var/spool/raid/trac/attachments/
    $ chown -R www-data /var/spool/raid/trac/attachments/
    
  • Restart tracd or apache and have fun
Note: See TracWiki for help on using the wiki.