Software development, photography, jokes, ....

Sites by me

 
tas-logoTransportation Administration System
snoezelkussen-logo-kleinstSnoezelkussens voor verstandelijk gehandicapten
ikzoekeenbegeleider-logoBegeleiders voor gehandicapten
Laat uw hond het jaarlijkse vuurwerk overwinnen
Betuweroute en Kunst
logo 50x50Hey Vos! Je eigen naam@vos.net emailadres?
Kunst in huis? Nicole Karrèr maakt echt bijzonder mooie dingen
nettylogo2Kunst in huis? Netty Franssen maakt ook bijzonder mooie dingen
Professionele opvang bij Gastouderbureau
Kind-Zijn
Salarisadministratie en belastingadvies bij
De Zaak Loont
Zutphense Bomenstichting

Hosting Favorites

 
ANU Internet Services
XelMedia .internet Services
register.com

Blogroll

 
Bomenstichting
LassoSoft
MacFreak
Quality that computes
The Economy of Motion
Wheel 2.0
IntrAktv



Website Hosting bij Xel Media

Marc's Place


 

Relocate SVN Repositories
with SmartSVN



1.  Start either an SSH or VNC session to your old server. For VNC sessions, you can use Chicken of the VNC or Apple Remote Desktop. I do not know if these applications support VNC over SSH. If you may only access your new server via an SSH-tunnel, just use the SSH-command line.

Log in as root. If you cannot log in as root, log in as an administrator and you probably have to use 'sudo' before every command you execute to get the right permissions.

2a.  If you use VNC, start a Terminal application on the remote server to get a command prompt.
2b.  At the prompt ($), execute the following commands:

$ cd [path to main repository folder]

For example, my repositories on MacOS X reside under /Users/svn/, so I do $ cd /users. On CentOS, I have put them in /var/svn/.
To get an exact copy onto the new server, zip all repositories at once. In my case I zipped the svn directory, because that is where I store all repositories:

$ zip -r svn.zip svn

Now send the file to your new server, per FTP or SFTP, whichever you prefer or are able to use:

$ ftp [ip of new server]
ftp> cd /uploadfolder
ftp> bina
ftp> put svn.zip
ftp> close
ftp> exit
$ exit


3.  Now, start either an SSH or VNC session to your new MacOS X or Linux server.
Again, log in as root. If you cannot log in as root, log in as an administrator and you probably have to use 'sudo' before every command you execute to get the right permissions.

4a.  If you use VNC, start a Terminal application on the remote server to get a command prompt.
4b.  Execute the following commands:

$ which svnserve

If this shows nothing, install SVN first.

$ cd /uploadfolder
$ mv svn.zip /var/ (or /someotherfolder/)
$ unzip svn.zip


The svn directory is now completely restored on the new server. Do ls -l to check if the owners and permissions are ok.

5.  I use the standard svnserve daemon to access my repositories. To check if it is already running, execute the following command:

$ ps -ef | grep svnserve

If you only see a line like this:

501 20397 20385 0 7:36pm ttys000 0:00.00 grep svnserve

the daemon is not running.

5a.  For MacOS X we need to make a startup script for it in MacOS X’s application launcher, launchctl. There are various plist files circulating the internet, so I took one and modified a few settings so you will not have permission problems and do not have to modify it again. Unless...
  • your installation of svn is not in /usr/bin/, and/or
  • you want to run svnserve under a different user/group, and/or
  • use a different port.
then edit the file and change the values, prior to loading it into launchctl.

Anyway, I zipped the plist-file and you can download and install it right away in /Library/LaunchDaemons/ (download: org.apache.subversion.svnserve.plist)
After you installed it, and you made your changes (for example change /Users into /var), execute the following command to add the script to launchctl:

$ launchctl load /Library/LaunchDaemons/org.apache.subversion.svnserve.plist

and then start the svnserve daemon:

$ launchctl start org.apache.subversion.svnserve.plist

Check if it is running:

$ ps -ef | grep svnserve
0 92700     1 0 0:00.01 ??       0:00.01 /usr/libexec/launchproxy /usr/bin/svnserve --listen-port=3690 --inetd --root=/var/svn


5b.  For Linux (CentOS in my case) you can simple add the following statement to the file /etc/rc.local:

$ echo "svnserve -d -r /var/svn" >> /etc/rc.local

and start the server manually:

$ svnserve -d -r /var/svn

Check if it is running:

$ ps -ef | grep svnserve
root 1546 1 0 Jul15 ? 00:00:00 svnserve -d -r /var/svn
root 25002 24988 0 12:15 pts/1 00:00:00 grep svnserve


5c.  On my CentOS server, I had to specifically open the port for svnserve in the firewall. Otherwise, SVN-clients cannot connect:

svn-fw-rule



6.  To maintain working copies and repositories, I use SmartSVN, IMHO the best tool out there for SVN.

7.  To point your working copies to the repositories on the new server, simply open a working copy and choose the following menu-item:

Screen Shot 2011-11-08 at 20.30.05

Screen Shot 2011-11-08 at 20.31.29
Only change the IP-address or host-name into the new IP-address or host-name, click Relocate and wait a while.
If everything went ok, you should see the new server name in the Transactions pane, with everything else exactly as it was with the old server.

Screen Shot 2011-11-08 at 20.33.12
That’s it! Do this for all your working copies.

Note: If you created a brand new, empty repository instead of copying an existing one, you can not use Modify-->Relocate... because SmartSVN cannot populate the new repository with your current working copy. The working copy points to another repository. To be able to upload your folder to the new repository, quit SmartSVN, go into Terminal and remove all hidden .svn directories in all (sub)folders:

$ cd ~/Sites/mysite
$ find . -name ".svn" -exec rm -fdR {} \;


Now open SmartSVN again, choose 'Keep open' at the prompt and choose the following:

smsvnimport

and follow the steps to link your folder to the repository.

Next, quit and reopen SmartSVN and reload the project. Select the files and folders you do not want in the repository, for example RapidWeaver’s .rwsw fodders, and choose Modify-->Ignore... for each. Then, select the top folder and commit the site to the new repository.


8.  When you are ready, go back into the Manage Profiles window and delete the profiles that point to the old server.

Screen Shot 2011-11-08 at 19.51.15

9.  If you use Panic’s Coda with SVN, you have to reload your Local Root folder in each site’s settings, so Coda rereads the SVN-settings and loads the new server-URL.

Open Coda and open a Sites-window. Click on the small (i) next to Site’s name you need to update:

Screen Shot 2011-11-09 at 02.36.17

Then, set the Local Root folder to the same folder it contained before, but you must do this via the Set... button, otherwise it won’t work:

Screen Shot 2011-11-09 at 02.35.07

When you’ve done that, you’ll notice the new IP-address or host-name in the SVN-URL at the bottom of the settings-window. Save the settings and do this for each site.


Do not forget to perform the same actions, starting at step 6, for other client computers!
© 1997- Marc Vos (and others) Contact Me