How to migrate from hosted SVN using Amazon’s EC2 - January 25, 2011 at 11:24 am

In this post I will show how to launch a EC2 server, install the tools needed to sync svn repos with a paid svn repository then create a dump file that can be imported to a new SVN server. We were migrating from Codesion, now a CollabNet company to a server that we had built in AWS. Nothing against Codesion they are awesome, we just got to big to continue using it and needed to have more control. I will use codesion again in the future.

Step 1) Launch a EC2 server-

Step 2) Pick your AMI, I like the FC8

Step 3) Picking the FC8 AMI

Step 4) Choosing the small

Step 5) No advanced instance options

Step 6) Adding a tag

Step 7) Selecting the correct key

Step 8) Selecting the correct security group

Step 9) All looks good

Step 10) It's launched

Step 11) Connecting to the new AMI

Step 12) Logging in over SSH

Step 13) Ok now on to the command line stuff. First we are going to install SVN

Administrators-MacBook-Pro-2:PEM justinwaite$ ssh -i MMJWaite.pem root@ec2-184-72-79-138.compute-1.amazonaws.com

The authenticity of host 'ec2-184-72-79-138.compute-1.amazonaws.com (184.72.79.138)' can't be established.

RSA key fingerprint is a2:4c:65:97:2d:c5:3d:56:9d:51:b4:73:e4:0c:05:3f.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ec2-184-72-79-138.compute-1.amazonaws.com,184.72.79.138' (RSA) to the list of known hosts.

__|  __|_  )  Fedora 8

_|  (     /    32-bit

___|\___|___|

Welcome to an EC2 Public Image

:-)

Base

–[ see /etc/ec2/release-notes ]–

[root@ip-10-204-213-7 ~]# yum install svn
Loaded plugins: fastestmirror
Determining fastest mirrors
* updates-newkey: kdeforge.unl.edu
* fedora: kdeforge.unl.edu
* updates: kdeforge.unl.edu

updates-newkey                                           | 2.3 kB     00:00
fedora                                                   | 2.1 kB     00:00
updates                                                  | 2.6 kB     00:00

Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package subversion.i386 0:1.4.4-7 set to be updated
–> Processing Dependency: perl(URI) >= 1.17 for package: subversion
–> Processing Dependency: libneon.so.27 for package: subversion
–> Running transaction check
—> Package perl-URI.noarch 0:1.35-3.1 set to be updated
—> Package neon.i386 0:0.27.2-2 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package             Arch            Version              Repository       Size

================================================================================

Installing:
subversion          i386            1.4.4-7              fedora          2.3 M

Installing for dependencies:
neon                i386            0.27.2-2             fedora          109 k
perl-URI            noarch          1.35-3.1             fedora          116 k

Transaction Summary

================================================================================

Install      3 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 2.5 M

Is this ok [y/N]: y

Downloading Packages:
(1/3): neon-0.27.2-2.i386.rpm                            | 109 kB     00:00
(2/3): perl-URI-1.35-3.1.noarch.rpm                      | 116 kB     00:00
(3/3): subversion-1.4.4-7.i386.rpm                       | 2.3 MB     00:00

——————————————————————————–

Total                                           3.3 MB/s | 2.5 MB     00:00

============================== Entering rpm code ===============================

Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction

Installing     : neon                                                     1/3
Installing     : perl-URI                                                 2/3
Installing     : subversion                                               3/3

=============================== Leaving rpm code ===============================

Installed:
subversion.i386 0:1.4.4-7

Dependency Installed:
neon.i386 0:0.27.2-2                perl-URI.noarch 0:1.35-3.1

Complete!

14. Next we are going to create the repo-
[root@ip-10-204-213-7 ~]# svnadmin create /tmp/mm_framework

15. Now we need to create the pre-revprop-change in the hooks directory –
[root@ip-10-204-213-7 ~]# touch /tmp/mm_framework/hooks/pre-revprop-change

16. Next change permissions –
[root@ip-10-204-213-7 ~]# chmod +x /tmp/mm_framework/hooks/pre-revprop-change

17. Next we need to run the initial sync against the SVN server -
[root@ip-10-204-213-7 ~]# svnsync init file:///tmp/mm_framework/ https://mmetrics.svn.cvsdude.com/MM_2GO_frameworkFieldService

Authentication realm: <https://mmetrics.svn.cvsdude.com:443> mmetrics login

Username: mmetrics
Password for 'mmetrics': XXXXXX

Copied properties for revision 0.

18. Now we are going to sync the EC2 svn with the hosted SVN-
[root@ip-10-204-213-7 ~]# svnsync sync file:///tmp/mm_framework/

Authentication realm: <https://mmetrics.svn.cvsdude.com:443> mmetrics login
Password for 'root':

Authentication realm: <https://mmetrics.svn.cvsdude.com:443> mmetrics login
Username: mmetrics
Password for 'mmetrics':
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.
Copied properties for revision 7.
Committed revision 8.
Copied properties for revision 8.
Committed revision 9.
Copied properties for revision 9.
Committed revision 10.
Copied properties for revision 10.
Committed revision 11.
Copied properties for revision 11.
Committed revision 12.
Copied properties for revision 12.
Committed revision 13.
Copied properties for revision 13.
Committed revision 14.
Copied properties for revision 14.
Committed revision 15.
Copied properties for revision 15.
Committed revision 16.
Copied properties for revision 16.
Committed revision 17.
Copied properties for revision 17.
Committed revision 18.
Copied properties for revision 18.
Committed revision 19.
Copied properties for revision 19.
Committed revision 20.
Copied properties for revision 20.

19. Now we need to export the data using the SVN dump command-
[root@ip-10-204-213-7 ~]# svnadmin dump file:///tmp/mm_framework/ > ~/mmdump.dmp

svnadmin: 'file:///tmp/mm_framework' is an URL when it should be a path
[root@ip-10-204-213-7 ~]# svnadmin dump ///tmp/mm_framework/ > ~/mmdump.dmp
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
* Dumped revision 3.
* Dumped revision 4.
* Dumped revision 5.
* Dumped revision 6.
* Dumped revision 7.
* Dumped revision 8.
* Dumped revision 9.
* Dumped revision 10.
* Dumped revision 11.
* Dumped revision 12.
* Dumped revision 13.
* Dumped revision 14.
* Dumped revision 15.
* Dumped revision 16.
* Dumped revision 17.
* Dumped revision 18.
* Dumped revision 19.
* Dumped revision 20.

20. Last we will verify the file –

[root@ip-10-204-213-7 ~]# ls -la ~

total 328

drwxr-x—  3 root root   4096 Jan 12 18:06 .
drwxr-xr-x 22 root root   4096 Jan 12 16:57 ..
-rw-r–r–  1 root root     24 Feb 22  2008 .bash_logout
-rw-r–r–  1 root root    327 Feb 22  2008 .bash_profile
-rw-r–r–  1 root root    184 Dec 11  2007 .bashrc

drwx——  2 root root   4096 Jan 12 16:57 .ssh
-rw-r–r–  1 root root 303870 Jan 12 18:06 mmdump.dmp

21. Well we have an snv dump of the repo on the hosted server and we can import to a new server.

RSS

Leave a Reply