Contents

Create working svn-trac repository

Backup existing subversion repository from old server

To backup your existing Svn project /opt/ciws/var/svn/project you need to issue the followin command in a shell.

svnadmin dump /opt/ciws/var/svn/project > svn.dump-date

svn.dump-date is the dump file (replace date with the current date).

Import svn dump into new repository on new server

You then need to import your dump file into the new svn project on an other server:

Copy svn.dump-date on the new server and issue the following command in a shell. svnadmin load /opt/ciws/var/svn1/project < svn.dump-date

To make Trac aware of new modifications, issue the following command (/opt/ciws/var/trac/project/ is your Trac path) sudo trac-admin /opt/ciws/var/trac/project/ resync

Import old Trac project into new server

If you want to backup your old trac project you need to copy the directory that contains your Trac data into the new server.

You could use scp to copy file through network or manually copy the files.

let's say that your old trac project is on /var/trac/project on server with ip address 192.168.100.7.

Let's say also that your run the following on your new server and that the path of your new trac project is /opt/ciws/var/trac/

Replace "user" with the old server user name.

sudo scp -r user@192.168.100.7:/var/trac/project /opt/ciws/var/trac/

You then need to grant access to web server user to the new copied file

sudo chown -R www-data /opt/ciws/var/trac/project/

If the path of your project is different from the old server, you need to edit the trac config file and specify it in the right section.

sudo nano /opt/ciws/var/trac/project/conf/trac.ini

Replace /opt/ciws/var/svn1/project with the new path: [trac]

repository_dir = /opt/ciws/var/svn1/project

You need to resync Trac as well to make it aware of new changes.

sudo trac-admin /opt/ciws/var/trac/project/ resync


Create backup mirror of your trac-subversion project

You could make a backup mirror of your existing trac - subversion repository on a separate server.

Duplicate the server

Duplicate the server on a new usb media so that you have another fresh install of your Trac subversion repository.

Grant permissions to user

To make subversion work on mirror mode you need to add a hooks to grant your user the appropriate right to update the backup mirror. Copy this code into /opt/ciws/var/svn1/project/hooks/pre-revprop-change of your subversion path

USER="$3"

if [ "$USER" = "admin" ]; then exit 0; fi

echo "Only the admin user can change revprops" >&2

exit 1

Grant execute access rights to your new file

chmod +x /opt/ciws/var/svn1/project/hooks/pre-revprop-change

Initialize the subversion repository

Execute the following code in a shell to initialize the subversion mirror.

svnsync init --username svnsync file:///opt/ciws/var/svn1/project http://your_existing_server_path/source/repos

Create backup script on your mirror

copy the following code in a file and execute the file when you want to grab last modifications

svnsync sync file:///opt/ciws/var/svn1/project