Implement version control for webdevelopment

I'm trying to switch to version control, as my projects are getting bigger. Currently, my development is going something like this:

  • I have a live version posted on the Internet.
  • I have a local version as well as a local web server
  • I am editing the local version and am testing on my local web server
  • Finally, I launched Unison , which updates the current version from my local version (and also updates my local version using any changes in the live version)

My local platform is Gentoo, Linux . I looked at SVN a bit, but I think this may not appeal to my needs, since my local web server (and Unison) can only access the code currently registered, etc. Maybe I'm wrong, but I don’t know much about it.

Can someone please guide me through setting up some kind of version control on existing code that will make the latest version available to the local web server and that will not use the access time for unedited files? (I don't want Unison to upload every file every time I make changes)

+6
version-control svn
source share
4 answers

I use subversion for this and it works well.

Usually I turn around until I have something cleaned up for release.

At this point, I will create a branch with a name like release. I will jump onto the production system and check out my newly created branch. For several projects, I will have an intermediate area that works on the production system.

For example, I might have a directory tree that looks like this:

/web/sites/release-1 /web/sites/release-2 /web/sites/release-3 /web/sites/release-4 /web/sites/stage ==> release-4 /web/sites/live ==> release-3 

"stage" and "live" are symbolic links, and this is what Apache has for DocumentRoot for the virtual hosts www.example.com and stage.example.com)

This setting allows me to thoroughly test things in a real production environment, and then cut them by exchanging symbolic links.

Branching out before deployment, I can make disaster fixes during production in the rare case that I need to do this. Then I can combine these changes back into the trunk when it is convenient and appropriate.

Last tip: if you use working copies of subversion projects in a production environment, you need to ensure that apache does not allow users to browse .svn directories in your project:

in httpd.conf:

 <Directory ~ "\.svn"> Order allow,deny Deny from all </Directory> 
+2
source share

Here is my current setup, I'm sure you could do something like this:

I use SVN, which is hosted on the core server. There are two servers, development and production. I do all my editing work at the checkout on the development server, and then, when the changes are ready to work live, I take them on myself and then update the check on the production server, which is a live site.

0
source share

Mercurial style:

 > cd ~/code > hg init > hg add * > hg commit -m "Initial checkin" 

This will give you a working mercury repository. Read the link for more information on how to use it.

You can clone from the local web server and your web server in real time to keep it up to date.

0
source share

To extend the answer to @Nathon. Do you want to:

 cd ~/code # this is where your code lives now # set your local webserver to run from *this* directory hg init hg add * hg commit -m "Initial checkin" hg clone ~/code ~/staging cd ~/staging # set Unison to run from *this* directory 

Make your development in ~ / code by checking it on the local server. Mandatory when you want. When you get something that works, tag it. Then do:

 cd ~/staging hg pull hg update your-tag-name # run unison. 

I get the impression that you also want your local server to start from an intermediate area, but this seems like a bad idea, because you want to use it to verify your work as you go. If you need some kind of QA environment, you can start the second web server from the stage, but I would only do this in addition to, not in preference, dev.

0
source share

All Articles