1

i've got ubuntu installed with lamp.

im using webdav to upload/download files to/from the ubuntu web server, after i have edited the php source files in netbeans. however, i wonder what is best practice for editing source files and committing these changes to the new website.

cause if we are 2-3 developers, i guess we have to use svn. but i have never used it before so i wonder how it works.

should i install it and then select the /var/www (apaches webroot) as the repository folder? then when i check in, all the changes will apply immediately?

could someone please explain following steps: how to download, edit the source files, upload the files and see the new changes in the website.

cause i have only worked with a local apache before, and it was only me. now there will be some more programmers so i have to set up a decent, central environment for this, and have to know how netbeans, svn, webdav and apache works all together.

thanks!

ajsie
  • 1,215
  • 4
  • 20
  • 28

1 Answers1

2

Here's what I do, in case this helps. I create an SVN repo for every project on the server, under a domain specifically for SVN (svn.mycompany.com). I check the repo out to my machine (and all other developers working on the project do the same). When I make changes, I commit them from my local machine to the repo on the server. For the public website (/var/www from your question) I check out a copy of the source code the same as I would for my local development machine. Then, I have a subversion "commit hook" on the server which runs svn update on the remote website. So the procedure for making changes looks like:

  1. Use svn checkout (if this is the first time) or svn update or NetBeans to check out/update to the latest source code to the developer's local machine.
  2. Make some changes
  3. use svn commit or NetBeans to commit the changes (includig a commit message detailing what changed and why, of coure)
  4. The changes are committed to the SVN repo on the server and the server runs svn update to apply my changes to the actual website.
  5. Test changes on the website, if more work needs to be done, repeat.

The only thing I would add is, I have my SVN hook update a staging site. When the client approved the sgaging site I can use subversion to update the live site.

Josh
  • 9,190
  • 28
  • 80
  • 128
  • thanks. this is exactly what i needed to know! one thing..so the svn respository is a folder for each project and its files. and then we got the /var/www (apache's webroot) folder. when you check in the files, you got a "commit hook" that senses this, and perform a "svn update" so that the /var/www get the latest versions in the svn repository? one more question, what exactly is your "commit hook"? cause maybe i should have one too? – ajsie Mar 30 '10 at 16:28
  • Yes, that's about right. I'll post the SVN commit hook script tomorrow. – Josh Mar 30 '10 at 23:47