• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subversion workflow - Should your production site be a working copy?

Hi all,

Ive not been working with subversion long, but so far ive been impressed with the changes its made (things like not re-uploading changes that you fixed 3 weeks ago...). So far what ive been doing is having a working copy on my local server, making changes to that, and commiting them back to the repository. Then, when we want to send it into production we just do an export, and then upload the resulting files ftp as normal.

However, ive mapped some of my FTP servers as drives on my computer for some of our bigger projects, and i was thinking why i cant just put a working copy onto the prodcution server and update it via svn, instead of having to upload a load of files by FTP every time. Is there any pitfalls in this method? or should i continue using ftp?

Any help would be appreciated.

That's what the export function is for.

Why shouldn't you use a 'working copy' (i.e. revision) as your production version? Take a look at tagging.

We tag a 'stable' revision, and push that to our production servers.

Our development cycle basically looks like this: make some changes, commit. Make some more changes, commit. Then if you are satisfied, tag that revision, and push that to production. Repeat Ad infinitum.

In case something breaks, role back to a previous 'stable' revision and fix the problem. Just make sure you never overwrite config files. A good habit is to exclude the config folder as well as the index.php from SVN.

I get around the config file problem by just writing everything so it's $_SERVER['HTTP_HOST'] independent. Something like:

if($_SERVER['HTTP_HOST'] == 'localhost') {
  // do localhost config
} elseif($_SERVER['HTTP_HOST'] == 'dev.server') {
  // do dev server config

So the same config files will work on all of the machines. There are only 2-3 config changes that are in blocks like this, so it's not as bad as it looks.

The dev server is a working copy that is automatically updated on a successful commit.

I hadn't thought of tagging a revision as 'stable' and exporting that to the live site...that's a great idea.

What we've been doing is just committing/updating the dev server working copy and then after testing that, cp the files to the production server directory.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.