Wednesday 4 April 2012

Export specific sub holder from svn on CentOS

Some time project grows in your repository and you may want to move it to separate repository or you want to share you work and open up repository from tight security. The reasons can be many but the process is the same.

(assuming root access, LATEST refers to the latest available version, procedure was tested on 0.5.8)

Install needed components
yum install subversion-devel httpd-devel
wget http://prdownloads.sourceforge.net/rsvndump/rsvndump-LATEST.tar.gz
tar xvfz rsvndump-LATEST.tar.gz
cd rsvndump-LATEST
./configure
make
sudo make install

Exporting your project
With rsvndump you don't need to use filters to extract your subfolder within svn, it will do it for you just in one command
rsvndump -v -u username -p psw  https://ulr/svn/repos/to/subfolder > subfolder

Create svn repository
svnadmin create /path/to/svn/project

Allow Apache to read it
chown -R apache:apache symphony

Import it dumped file
svnadmin load --force-uuid /path/to/svn/project < subfolder

Enable web access in Apache
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
<location svn="">
        SSLRequireSSL
        DAV svn
        SVNParentPath /path/to/svn
        AuthzSVNAccessFile /path/to/svn-acl-conf
        AuthType Basic
        AuthName "Subversion repos"
        AuthUserFile /path/to/svn-auth-conf
        Require valid-user
        SVNIndexXSLT "https://url/svnindex.xsl"
</location>

Enable access in svn-acl-conf
[project:/]
@project_users=rw

[repos:/]
@users=rw

Restart Apache
/etc/init.d/httpd restart

More info
The assumption in example is that all your repositories are in the /path/to/svn/ Then you can use only one conf file for Apache and control access to repositories :) and you are done!

No comments:

Post a Comment