Find the answer to your Linux question:
Results 1 to 8 of 8
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    per user SVN repos


    I'm attempting to combine the functionality of dav_svn and userdir modules to give all users on my system their own private SVN repo without having to manually add them. I can get each module to work individually (except for authentication), but not together.

    I tried using this as my userdir.conf:

    Code:
    <IfModule mod_userdir.c>
            UserDir SVN
            UserDir disabled root
    <Location /home/*/SVN>
      DAV svn
      SVNParentPath /home/*/SVN
      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/passwd
    </Location>
    
    </IfModule>
    but apache won't even resolve the SVN directory. I'm not even sure if this is the proper way to go about it. Any ideas?

  2. #2
    I asked the very same question in 2006... (subversion mailing lists)
    as I cannot post any URLs in this forum yet, I will not be able to link you to that post or indeed show examples of how I attempted it... (and failed).

    Currently it seems that it is not possible with dynamic virtual hosting but can be done by using individual VHOSTS.

    join this up: svn.haxx.se / users / archive-2006-06 / 0975.shtml

  3. #3
    Thanks, I was sort of affraid of that.

    How did you wind up setting it up? Did you leave the svn folders in the home dirs and manually add vhosts? I'm almost tempted to just put all the repos in one dir and play with mod_rewrite.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    how about something like this
    Per-user web directories - Apache HTTP Server
    per user web directories

  6. #5
    The trouble with per user web directories and dynamic virtual hosting is the way mod_svn handles path translation.

    For per user web directories, the following can be used:
    UserDir /var/www/*/docs

    For Dynamic virtual hosting, the following can be used:
    VirtualDocumentRoot /home/%1/public_html

    The Subversion module within Apache needs an absolute path, so for instance:
    SVNParentPath /home/*/SVN
    or
    SVNPath /home/%1/svn/repos
    (another example would be AuthUserFile /home/%1/svn/conf/svnusers)

    Will not work because the wildcard and domain name part will not be translated within the Subversion module.

    The only way you can accomplish per user SVN in this way is to use the VirtualHost directive for each user with each one containing an absolute path for SVN and/or AuthUserFile... not exactly dynamic.

    It would be possible however to write a script to create the VirtualHosts and then flag apache to reload its configuration using cron or similar methods.

  7. #6
    New idea:

    I create a SVN directory that I set to be the SVNParentPath in dav_svn. Then I create an SVN dir in each user's home dir that I symlink into the SVNParentPath. Now each user still has all of their repos in their home dir, and dav_svn is happy. That symlink would probably be easier to script than creating new vhosts and reloading apache.

  8. #7
    Quote Originally Posted by vortmax View Post
    New idea:

    I create a SVN directory that I set to be the SVNParentPath in dav_svn. Then I create an SVN dir in each user's home dir that I symlink into the SVNParentPath. Now each user still has all of their repos in their home dir, and dav_svn is happy. That symlink would probably be easier to script than creating new vhosts and reloading apache.

    Try using usvn (user friendly svn).

    Is very easy to use. I love it!

  9. #8
    I know this thread is old, but I just wanted to update it with a working solution, since it seems not much progress has been made. I wound up discovering mod_perl, which allows you to dynamically write apache configuration files. This is my working apache config file:

    Code:
    <Perl>
    my @dirs = `ls -1 /home/`;
    chomp(@dirs);
    
    my $i = 0;
    foreach my $dir (@dirs) {
    
      $VirtualHost[$i]{"*:80"} =
          {
            'ServerName'  => "$dir.svn.xxx.xxx",
            'ServerAdmin' => 'xxxxxxxxxxxx',
            'DocumentRoot' => '/var/www/SVN/',
            'AddExternalAuth' => 'pwauth pipe',
            'directory' => {
               "/home/$dir/.repos" => {
                  'Options' => 'Indexes FollowSymLinks MultiViews',
                  'AllowOverride' =>  'None',
                  'Order' =>  'allow,deny',
                  'allow from' => 'all',
                  },
            },
            'Location' => {
               "/repos" => {
                        'DAV' => 'svn',
                        'SVNParentPath' =>  "/home/$dir/.repos/",
                        'SVNListParentPath' => 'on',
                        #'SVNIndexXSLT' => '"/repos-web/view/repos.xsl"',
                        'AuthType' => 'Basic',
                        'Require' => 'valid-user',
                        'AuthName' => '"xxxxxxxxxxxxxxxxxxxxx"',
                        'AuthBasicProvider' => 'external',
                        'AuthExternal' => 'pwauth',
                         },
              },
    
       };
    $i++;
    };
    </Perl>
    This reads all directories in /home and creates a virtual host <username>.svn.domain for the user and sets the SVNParentPath to /home/<user>/.repos, but being perl, you could write it to do whatever you want. The trick is to use properly named hashes to store the parameters. If you need more than one block (Like more than on vhost or location block), then you make an array of those hashes.

    Please note the above code is just my initial alpha code. I haven't locked down any permissions yet, so don't just copy/paste.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •