Apache2, Subversion and Webdav

Multi user subversion works completely differently to how i expected. I assumed i would be setting up an ldap server and have unix users for each developer. Turns out you configure developers using htpasswd files and run apache as svn user for repo access.

install required modules (assumes subversion is already installed and projects are located in /svn

$ sudo apt-get install libapache2-svn

create a new virtual host

<VirtualHost *:80>
    ServerAdmin sysadmin+svn+projectname@initsix.co.uk
    ServerName svn.initsix.co.uk
#    User steev
#    Group steev
<Location />
  DAV svn
  SVNParentPath /svn
  AuthType Basic
  AuthName "initsixrepo"
  AuthUserFile /etc/subversion/passwd
  Require valid-user
  AuthzSVNAccessFile /etc/subversion/authz

  </Location>
    ErrorLog /var/log/apache2/error.svn.projectname.initsix.co.uk.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.svn.projectname.initsix.co.uk.log combined
    ServerSignature Off

</VirtualHost>

create users using htpasswd

$ htpasswd -c username /etc/subversion/passwd

Connect to your host and you should have http webdav + svn. Lock it down with ssl and all sorted.

N.B. if you get a problem like this

commit -m "" /home/username/workspace/sitename/file.php
    svn: Commit failed (details follow):
    svn: Commit failed (details follow):
svn: Can't open activity db: APR does not understand this error code
svn: MKACTIVITY of '/sitename/!svn/act/0a1bbb1c-2601-0010-b7ad-c94de5f17ce3': 500 Internal Server Error (https://svn)

when you're trying to commit, then I managed to resolve this by going into the individual repos, creating a dav folder, making sure the svn could read and write to it, re-run the commit, svn re-creates the activities bdb in the folder, and jobs a good un. Although having said that, i did have to create the dav folder, and im sure i read that bdb is no good for nfs...

Add new comment