Results 1 to 8 of 8
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-15-2010 #1Just Joined!
- Join Date
- Jan 2007
- Posts
- 15
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:
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?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>
- 01-16-2010 #2Just Joined!
- Join Date
- Dec 2008
- Posts
- 4
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
- 01-16-2010 #3Just Joined!
- Join Date
- Jan 2007
- Posts
- 15
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.
- 01-16-2010 #4
how about something like this
Per-user web directories - Apache HTTP Server
per user web directories
- 01-16-2010 #5Just Joined!
- Join Date
- Dec 2008
- Posts
- 4
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.
- 01-17-2010 #6Just Joined!
- Join Date
- Jan 2007
- Posts
- 15
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.
- 01-19-2010 #7Just Joined!
- Join Date
- Jan 2010
- Posts
- 2
- 01-09-2011 #8Just Joined!
- Join Date
- Jan 2007
- Posts
- 15
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:
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.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>
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.


Reply With Quote

