Question

I have an exploded www folder containing my whole php website.

I wonder if something like this is possible:

  • developers don't work directly on the files
  • changes are tested locally or on a staging server
  • svn commits trigger an event which synchronizes latest changes made to the repo, to the www folder

I heard about svnsync / svnexport tools but how can I trigger them on commits or make them "listening" to my repo?

In addition, can they update just the changed files? My repo is very big.

Was it helpful?

Solution

People do this so often that it's in the official Subversion FAQ

Short version:

  1. Make your www directory a working copy
  2. Create a post-commit hook which executes svn update against that working copy.

If your repository server doesn't have direct access to the web server (which it shouldn't), you'd be better off with this:

  1. Create a working copy on the repository server or an intermediate server
  2. Create a post-commit hook which executes svn update against that working copy
  3. rsync that working copy to your web server (this could be part of the post-comit hook script)

Yet another option would be to use a Continuous Integration server to monitor the repository changes and deploy them. In fact, that is the best way to go for most shops. You'd use the CI server to update a staging server and then only push to the live server after testing is completed. Then your developers will work only in a local, private-to-them working copy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top