You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Eric Johnson <er...@tibco.com> on 2008/09/15 16:40:55 UTC

Multiple apache vhosts with one repo - which host did the commit came from, and how to record?

Looking for some advice on how to solve this problem:

(Subversion 1.4.6, Apache 2.2, Gentoo Linux - although I think all but 
the linux part doesn't change anything.)

I've got two Apache vhosts (different ports on the same server) 
connecting to the same SVN repository.  This configuration lets me use 
Apache LDAP authorization against two different LDAP servers.  This 
configuration works just fine.

We've now gotten to to the point that we want to make sure we record 
which vhost the request came in on, for a small collection of reasons.

Since Subversion specifically removes almost all environment variables 
when executing hook scripts, whatever information Apache might provide 
is not available to the hook scripts that I'm writing.

I've come to the conclusion, that if I want to distinguish between the 
two hosts in the hook scripts, I have to do something like this:

/home/svn/repos/
    myrepo/            <-- the official copy of the repository
       conf/
       dav/
       db/
       format
       hooks/
       locks/
       README.txt
    myrepo-alternate   <-- a "constructed" version
       conf/           <-- soft link to /home/svn/repos/myrepo/conf/
       dav/            <-- soft link ...
       db/             <-- soft link...
       format          <-- soft link ...
       hooks/          <-- this one is *not* a soft link.
       locks/          <-- soft link...
       README.txt      <-- soft link...

In that way, I can customize the hook scripts for each vhost by pointing 
each vhost at the appropriate folder.

Questions:

    * Will this work?
    * Is there a better way?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Multiple apache vhosts with one repo - which host did the commit came from, and how to record?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 15, 2008, at 11:40, Eric Johnson wrote:

> (Subversion 1.4.6, Apache 2.2, Gentoo Linux - although I think all  
> but the linux part doesn't change anything.)
>
> I've got two Apache vhosts (different ports on the same server)  
> connecting to the same SVN repository.  This configuration lets me  
> use Apache LDAP authorization against two different LDAP servers.   
> This configuration works just fine.
>
> We've now gotten to to the point that we want to make sure we  
> record which vhost the request came in on, for a small collection  
> of reasons.
>
> Since Subversion specifically removes almost all environment  
> variables when executing hook scripts, whatever information Apache  
> might provide is not available to the hook scripts that I'm writing.

You could probably abuse my svnhookdispatcher script to solve this  
problem.

http://www.ryandesign.com/svnhookdispatcher/

My script exists so that you can run implement hook scripts after  
checkouts, updates, switches and exports (hooks which Subversion  
doesn't provide). It works by parsing Apache's Subversion access log.  
That log can contain the hostname, port and whatever other standard  
Apache information you're looking for. svnhookdispatcher doesn't pass  
this on to the hooks it implements, though it could be enhanced to do  
so. svnhookdispatcher also doesn't call the standard post-commit or  
post-revprop-change hooks since Subversion already handles that,  
though again it could be changed to do so.

If you end up implementing any of this, I wouldn't be opposed to  
receiving patches. :)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org