Tuesday, March 16, 2010

SVN Migration -- V2P

What if... you have a virtual server that is no longer scaling to your current demands?  Meaning the host server has reach its maximum and you need more power to the server that you are running on that machine.  The next logical thing to do will be to move out from a virtual environment to a physical one.

In this section I will give you insights on how you will be able to move your current server configs without the to much hasstle in searching the net.  The technology involved here are three:

1. Linux/Unix -- system to migrate
2. VMware Server centric guest -- the server to migrate
3. SVN -- service that needs to be migrated

Preparing the new box

Regardless of which distribution you use the steps listed here will definitely work well with you current need. Assuming that you don't have any other bizzare configuration in place aside from those I mentioned earlier.

Step 1  Install the OS in my case I used CentOS 5.4 release

Install necessary packages if you used the base installation

$ sudo  yum  install  mod_dav_svn  subversion  subversion-tools

This will create the necessary files needed to configure subversion on this new server.

Now you need to create the new svn repository

$ sudo  mkdir //svn
$ sudo  svnadmin create //svn/repos 

Create a dump of your current svn repo from your existing virtual server (old one)

$ sudo  svnadmin  dump   //repos  > dumpfile
This will effectively dump your current svn repos to a single file, depending on the size it will take awhile before you can move this dump to the new server.

Once you are done with the dump, scp this file to the new server

$ scp   dumpfile  somename@someip:/somehome/

Step 2  Migrate the configs

$ mkdir  svn_configs
$ cp  /etc/svn-acl-conf  svn_configs/
$ cp  /etc/svn-auth-conf   svn_configs/
$ cp  /etc/httpd/conf.d/subversion.conf  svn_configs/
$ tar cvjf svn_configs.tar.gz ///
$ scp svn_configs.tar.gz  someuser@some_ip:/somehome/

From your new box untar the scp'd file and copy them to the desired locations

$ tar xvf svn.tar.gz
$ cd svn_configs
$ sudo cp svn-acl-conf /etc
$ sudo cp svn-auth-conf /etc
$ sudo cp subversion.conf /etc/httpd/conf.d/  (replace the one created by svn installation)

Now you need to load your old repos to the new one.

$sudo svnadmin load   //repos < dumpfile
$sudo svnadmin verify  /somelocation/repos
$sudo svnadmin recover  /somelocation/repos

Step 3  Test your configuration

The easiest way test if you have successfully dumped your repo will be to check this with your browser.


You should see a prompt asking for your username and password.  If you see the repos directory listing your done!

Next would be to test if you could export and commit to this repository, something that is out of scope for this write-up.


No comments:

Post a Comment