SVN mirroring
Steps1: Get uuid from master repo
sudo svnlook uuid /reposan/sepg
Steps2: Create new repo
sudo svnadmin create /3TB/G-Cube_IT
Steps3: Set old uuid to mirror repo.
sudo svnadmin setuuid /3TB/sepg 3ca5459c-980d-42cb-bb04-bbd9b7c7a919
Steps4: Change ownership of the repo
sudo chown -R www-data:root /3TB/sepg
Steps5: Provide authz file access.
sudo vim /3TB/sepg/conf/authz
[/]
manager = rw
save and exit
Steps6: Configure LDAP setting
sudo vim /etc/apache2/mods-available/dav_svn.conf
<Location /content3>
DAV svn
SVNPath /8TB/content3
SVNIndexXSLT "/svnindex.xsl"
AuthBasicProvider ldap
AuthLDAPUrl ldap://192.168.2.2:389/ou=Users,dc=gc-solutions,dc=net
# AuthzLDAPAuthoritative off
AuthType basic
AuthzSVNAccessFile /8TB/content3/conf/authz
AuthName "Central Repository For content3"
# AuthUserFile /etc/subversion/passwd
Require valid-user
<Location >
Save and exit
Steps7: Restart Apache
sudo /etc/init.d/apache2 restart
Steps8: Now create two files at /3TB/sepg/hooks
sudo vim /3TB/sepg/hooks/start-commit
#!/bin/sh
USER="$2"
if [ "$USER" = "manager" ]; then exit 0; fi
echo "Only the manager user may commit new revisions as this is a read-only, mirror repository." >&2
exit 1
save and exit
sudo vim /3TB/sepg/hooks/pre-revprop-change
#!/bin/sh
USER="$3"
if [ "$USER" = "manager" ]; then exit 0; fi
echo "Only the syncuser user may change revision properties as this is a read-only, mirror repository." >&2
exit 1
save and exit
Steps9: Now make these files executable using the command as below.
sudo chmod +x /3TB/sepg/hooks/pre-revprop-change
sudo chmod +x /3TB/sepg/hooks/start-commit
Steps10: Register Mirror Repository for Synchronization.
EXP: sudo svnsync initialize URL_TO_MIRROR_REPO URL_TO_MASTER_REPO --username=manager --password=password
sudo svnsync initialize http://192.168.2.29/sepg http://192.168.2.4/sepg --username=manager --password=R@hul@123
Perform Initial Synchronization:
EXP: sudo svnsync synchronize URL_TO_MIRROR_REPO --username=manager --password=password
sudo svnsync synchronize http://192.168.2.29/sepg --username=manager --password=R@hul@123
It's Done
Automate Synchronization with post-commit Hook
Now with the initial synchronization out of the way, all that needs to happen now is to write a script to be ran either as a scheduled process or as a post-commit hook to synchronize your mirror repository with the master repository. I suggest the post-commit option as it gives you the best chance of having a mirror repository as up-to-date as possible. Here is an example hook that might be used on the master repository to synchronize a mirror repository as part of the post-commit hook. As a shell script:
On the master repo:
sudo vim /5TB/sepg/hooks/post-commit
# Example for synchronizing one repository from the post-commit hook
#!/bin/sh
SVNSYNC=/usr/local/bin/svnsync
$SVNSYNC synchronize URL_TO_MIRROR_REPO --username=svnsync --password=svnsyncpassword &
exit 0