I recently started using SVN with Apache for my web development, although I find it really annoying that I have to issue two SVN commands (one local, one remote) to update my web site. I have been looking into SVN post-commit hooks to solve this problem. The only problem is that apache does not have permission to modify files in my user directory...
So here is how everything is setup. I am running Slackware 13 full install. There have been no installations overriding any of the default installs.
From httpd.conf
Code:
# Enable user directories
#
UserDir public_html
<Directory "/home/*/public_html">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
# Enable svn support:
#
LoadModule dav_svn_module lib/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module lib/httpd/modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /home/svn/repositories
AuthName "blueSerf SVN Repository"
AuthType Basic
AuthUserFile /home/svn/.svn-auth-file
Require valid-user
</Location>
# Disallow browsing of SV working copy admin dirs.
<DirectoryMatch "^/.*/\.svn/">
Order deny,allow
Deny from all
</DirectoryMatch>
I have setup an SVN repository in my home directory (~blueAlien/public_html). Currently I have to issue "svn commit -m 'message'" from my local machine, and then "svn up" from the server to get the web site updated. I want to modify to post-hook script to do something similar to the following.
Code:
cd /home/blueAlien/public_html/
/usr/bin/svn up
Although, Apache does not have write permissions in my user directory. I have looked at a few different options for solving this issue. The
first one involves writing a C script to handle calling svn, compiling it, giving it special permissions (chmod +s), and then running that from the post-commit hook. I really do not like this solution, as I would either have to compile one for each SVN repository that I create or modify it two handle multiple repositories. I am not a C developer, so this is really all over my head...
The
second option is to change the permissions on my home directory and public_html folder to allow Apache to write files, which could also help in other future development projects I have. This is the route that I would like to take. So, my question is... what are your suggestions for accomplishing this in a secure manor? Please note the linked references I have supplied above.
Thanks.
Peace!