Difference between revisions of "Subversion backup and restore"

From ArchWiki
Jump to: navigation, search
(See Also: Merge to Subvision Setup.)
(Move to Subversion Setup.)
Line 19: Line 19:
 
  chown -R svn:svnusers /path/to/reponame ; chmod -R g+w /path/to/reponame/db/
 
  chown -R svn:svnusers /path/to/reponame ; chmod -R g+w /path/to/reponame/db/
 
   
 
   
Ok these repos should be all set and ready to rock.. however using svn+ssh:// will not work..
+
Ok these repos should be all set and ready to rock..
{{Note|we have to have a wrapper written for svnserve.. PLEASE FOLLOW CLOSELY HERE}}
 
 
 
check your ENV like:
 
{{bc| bash-2.05b# env | egrep "^PATH="
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
 
}}
 
 
 
check where the svnserve binary is located:
 
{{bc| # which svnserve
 
/usr/local/bin/svnserve
 
}}
 
 
 
ok our wrapper is going to have to fall in PATH prior to this location.. /sbin is a good place seeing its our 1st exec path on the system as root.
 
 
 
create wrapper:
 
touch /sbin/svnserve ; chmod 755 /sbin/svnserve
 
 
 
now edit it to look like so:
 
 
 
{{bc| bash-2.05b# cat /sbin/svnserve
 
#!/bin/sh
 
# wrapper script for svnserve
 
umask 007
 
/usr/local/bin/svnserve -r /path/to "$@"
 
}}
 
 
 
{{Note|See the -r /path/to ?? well this is what makes use of the svn co svn+ssh://server.domain.com:/reponame ( SEE THIS :/reponame ).. this sets root PATH.}}
 
You do not need to do: :/path/to/reponame.... this is the big trick here folks.
 
 
 
Start svnserve with new wrapper script like so:
 
/sbin/svnserve -d  ( start daemon mode )
 
 
 
check it with ps:
 
{{bc| # ps auxww | grep svn
 
root  66668  0.0  0.1  3608 1868  ??  Is  12:25AM  0:00.00 /usr/local/bin/svnserve -r /path/to -d
 
}}
 
 
 
we can also check the perms for remote users like this:
 
 
 
{{bc|cdowns:~ ~$ svn ls svn+ssh://server.domain.com:/reponame
 
++server.domain.com++
 
dev/
 
qa/
 
release/
 
cdowns:~ ~$
 
}}
 

Revision as of 05:27, 25 April 2013

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Subversion backup and restore#)

This article deals with how to backup your Subversion data and move it to a new machine. For a detailed article on setting up Subversion, see Subversion Setup.

Instruction

svnadmin dump repo and scp to other machine Do this for each repository you have.

svnadmin dump /path/to/reponame > /tmp/reponame.dump ; scp -rp /tmp/reponame.dump user@server.domain.com:/tmp/

Create the corresponding repositories. Do this for each repository you have.

svnadmin create /path/to/reponame

Load svn dump into new repo on new machine. Do this for each repository you have.

svnadmin load /path/to/reponame < /tmp/repo1.dump

Setting Permissions.. CRUCIAL This is the most common mistake when moving an svn repo. Do this for each repository you have.

chown -R svn:svnusers /path/to/reponame ; chmod -R g+w /path/to/reponame/db/

Ok these repos should be all set and ready to rock..