I've started using subversion to keep track - and be able to reverse - of our website changes related to its development and maintenance. Loving this feeling of security it provides!
I would like to know if there would be a tool / a way to be able to automate the synchronisation between the "live" website and the subversion repository. It would be great to be able to both commit a bug patch to the repository and to the live version (right now i manually upload via ftp the corrected file, then commit it to the subversion repository).
I'm sure this must exist somewhere, but under which name ? What set up does it need?
Thank you for your feedback, A.
You can create a post-commit hook that will export your repository at the latest revision to your webserver directory:
#!/bin/sh
# Delete Old site
rm -R /var/www/website
# Export Repository
svn export --force file:///var/svn/website /var/www/website
# Make sure Apache Owns the website
chown -R www-data:www-data /var/www/website
(credits to this forum thread)
Save this in a file called post-commit
, in the hooks
directory of your repository, and make it executable.
If the repository and website are not on the same server, you'll want to export in a temporary directory, and then push it via ftp or scp
EDIT: found also this perl module that could do the job: SVN::Notify::Mirror