[nflug] Apache + SVN

Erek Dyskant erek at blumenthals.com
Mon Dec 3 12:59:28 EST 2007


You want to use subversion hooks, which are scripts that svnserve runs
whenever a specific action gets made to a repository.  In my case, I
have a hook that automatically checks commits out to my development
server.   To push an update live I tag the final version and do a
manual svn export on the production server.

Here's an example of one of my post-commit scripts (some details have
been changed to avoid leaking internal information).  It runs on the
subversion server and sshes into the development server, running a
command to check the repository out to the proper location.

As a sidenote, put some thought into whether to use svn checkouts or
svn exports.  In my case I used svn co, because I want to have the
option to make live changes to the development server and check them
back into the repository.  If you know that you won't do that, use
export, as it avoids all the annoying .svn directories in your source.
  If you do use co, make sure that you configure apache not to allow
requests to .svn, or you could end up leaking our sourcecode.

Cheers,
Erek


/var/subversion/repos/hooks/post-commit:
REPOS="$1"
REV="$2"

commit-email.pl "$REPOS" "$REV" erek at blumenthals.com
log-commit.py --repository "$REPOS" --revision "$REV"

#Check out the change to the development section of the website
/bin/sh /etc/profile
/usr/bin/ssh -o 'PasswordAuthentication no' -i
/var/subversion/.ssh/id_rsa dev at dev.blumenthals.com '/usr/bin/svn
revert; /usr/bin/svn co
svn://svnserver.blumenthals.com/repos/harken/trunk/
/home/ddbainbr/harken/dev/'




Quoting Franklin Kumro Jr <fkumro at gmail.com>:

> I was wondering if anything exists for apache that will help me do the
> following:
>
> Apache uses a repo (checkout) for its document root and it updates the
> files when new versions are committed. Right now I have a checkout that
> I manually checked out and updating.
>
> Thanks,
>
> -Frank_______________________________________________
> nflug mailing list
> nflug at nflug.org
> http://www.nflug.org/mailman/listinfo/nflug




More information about the nflug mailing list