My Ubuntu server has Apache and Subversion installed. I personally use this server like a staging server, purely for testing reasons. I personally use Apache to host the net application, and Subversion to help keep versioned copies from the source code.

My current workflow:

  • Make changes to some file
  • Commit the file towards the Subversion repository
  • Upload the file new over SFTP towards the Apache public directory
  • See the alterations in my internet browser

I'd considerably more happy if my workflow was such as this:

  • Make changes to some file
  • Commit the file towards the Subversion repository
  • Without anyone's knowledge, Subversion puts a duplicate from the committed file in to the Apache public directory
  • See the alterations in my internet browser

I have little server admin experience, and then any help or pointers are appreciated. I heard that publish-commit hooks are things i need, which I'm able to write party scripts to get this done, but I am unsure how to start and did not really find anything after a great deal of Searching.

Thanks!

It is possible, but instantly pushing every invest in the development website is not usually a good idea. Sometimes you will find other changes that will need to go along, and smashing the site since the new code can there be, however the database schema has not been up-to-date yet is simply embarrassing.

What I am inclined to do rather is result in the server checkout a duplicate of svn, then, once I am ready with anything else that needs to happen, I actually do an svn update onto it.

But when you actually wanted, you are able to put instructions within the publish-commit trigger, that is going to do everything instantly for you personally. This may include managing a migration script around the server (if a person is available with this change), to consider proper care of any non-code changes that require to occur.

I believe the real, overarching question you ought to be wondering---which you might curently have requested yourself obviously---is: "how do i test my code most easily before implementing it?"

I believe a great response is to set up Apache in your development box and run it as being your personal user, with webroot and/or cgi path at /home/richardhenry/src/mywebsite (or whereever you take a look at your code).

This way, you can look at your code without carrying out. Consequently, you will not litter your trunk with damaged or useless commits. Generally, keeping independent things independent is commonly Advisable (TM).

Alternatively, sync the net server against your working directory with rsync, or write a script which pushes your file(s) in the dev box for your staging server and give a Makefile rule which runs your script (or calls up rsync). If you wish to be really fancy, use inotify as well as other file notification monitor to operate your script instantly.