Using SVN for web development

Here at my new workplace, there are more than 20 web apps that are being developed in-house. They go through the following workflow: devs use development and staging servers for tests, and after QA, the new builds are pushed to the production servers.

They've employed a custom version control system for coding, but it's not panning out. They need an automated way of pushing updates to the dev and staging servers for a quicker turn-around time.

Enter Subversion. I've used Subversion both in production and in personal projects. (I haven't used CVS so I can't compare the two.) The way I see it, the web apps can be pushed this way:


  1. Install SVN with WebDAV support.

  2. Create the repositories' directory trees:

    mkdir /path/to/repository/projectname


  3. Note that the repositories have to be owned and writeable by the httpd user:

    chown -R httpd:httpd /path/to/repository/projectname;
    chmod g+s /path/to/repository/projectname



  4. Create the SVN repositories:

    svnadmin create /path/to/repository/projectname



  5. Import the current working directories for the projects:

    svn import /path/to/working/project/dir \
    file:///path/to/repository/projectname



  6. Remove the working directories (backup first):

    rm -rf /path/to/working/project/dir



  7. Check out directory trees from the repo:

    svn co file:///path/to/repository/projectname



  8. Edit and commit changes:

    svn ci



  9. Or, pull changes:

    svn update /path/to/working/project/dir




Easy so far. I've also added an HTTP URL for the SVN repos using Apache's WebDAV extensions. In httpd.conf, just add the following:


LoadModule dav_svn_module modules/mod_dav_svn.so

DAV svn
SVNParentPath /path/to/repo/root



Restart the service. Now the repo can be accessed via http://reposerver/repos/projectname.

But I hit a snag: I can't get the post-commit hook to run on commits! I'm leaning on problems with the permissions, but it's eluding me right now. *sigh*

Comments

  1. LoadModule dav_svn_module modules/mod_dav_svn.so

    DAV svn
    SVNParentPath /path/to/repo/root


    You also can use svn ssh://url/repositorypath to skip dav

    ReplyDelete

Post a Comment

Popular posts from this blog

Pull files off Android phone