In this 10 minute audio training session, Cal Henderson (Flickr.com) discusses the following topics:
- What you should put in version control
- How to deploy code rapidly
- How you can use development, staging and production environments for easy and safe deployment
- How to test
This session is from the 1-day workshop Building Enterprise Web Apps on a Budget - How We Built Flickr, hosted by Carson Workshops.



Not to be too critical– the tips in the audio are useful– but suggesting that the above topics are well-covered in the 10 minute slot is overselling it a bit.
Hey Jeremy,
I’m not sure where we said the topics were “well covered”. We intend for these training snippets to be small doses of goodness, not full masterclasses :)
You do too!!!
[…] “The Secret to Perfect Version Control” By Cal Henderson http://www.thinkvitamin.com/training/webapps/enterprise-web-apps/ […]
You can’t call it “perfect version control” when they use cvs for version control, and directly edit files on a server via ftp. Cvs should be retired.
Lorewarden,
They don’t edit files directly on the server. That’s exactly what Cal said not to do ;-)
They use CVS (or Subversion) and then deploy to Dev, then Staging, then Production.
These are kind of the procedures I’ve always assumed would be the right way of working with version control and web applications, but what I feel is perhaps missing are less theoretical concepts but more simply nitty-gritty implementational details, and how to get around the headaches and gotchas that deploying version control can bring up.
For instance, at a previous employer I set up Subversion with our development server (there was no staging server, unfortunately) and then had a post-commit script updating a working copy which resided in the local server’s document root. The downside here is that in order to see changes (no matter how minor they were) a commit is necessary first. Synchronising the live site with this working copy was then performed using rsync, but this left the problem of there being no guarantee that site-breaking changes would be included in the update unless everyone in the team knew exactly what development changes were being made at the point an update was performed. Having a staging server sat in the middle mitigates this to an extent, but doesn’t remove the problem entirely, as bugs in staging could again be elevated to live with an inopportune sync.
One possible solution which I considered was in making each user’s working copy a fully functional document root for a personal, individual development virtual host. In a unix environment this could be relatively easily achieved if you use your ~/public_html/whatever (or equivalent) directory as your working copy, and then have this configured to point to http://username.somehost/, but this would be a pain to administrate. Basically this seems to be the crux of the problem; the easier you make it for the developer, the harder it becomes for the administrator, and frequently in a lot of smaller shops these two people are one and the same.
I’m still convinced that version control is absolutely vital for web application development, but I’m not yet convinced that shoehorning tools which are traditionally aimed at compiled software management is the answer.
Great! I’ve always used Subversion on my PHP projects myself. My staging sites (in a local network/machine) is always under SVN version control, I found it a really nifty thing to keep track of changes.
One little caveat I’ve been trying to deal with, though, is updating the production site in a web host, when the host only offers updating files via FTP. (No shell access to do a
svn checkout.) Anyone got any tips for a situation like this? :)a good way to handle it, presuming your app isn’t *too* big, is to script it on your end to create a new folder, perform an svn export, upload the folder to your production server via ftp, then swap the current webroot with the newly uploaded one. this can be done in a few lines of perl (use activeperl on windows, regular perl comes with osx).
this can take a while, so you probably only want to push changed files. this can be done with the ftp-rsync script which comes with the Net-FTP-Common package.
What we did was have:
Dev, Staging, Public Staging (non-IP restricted, for client viewing) and Production - all identically set up barring system upgrades.
A DSL (Definitive Software Library) set up with SVN.
People had local web servers for developmental testing, and used Tortoise SVN to check them into the DSL. They could then SFTP the files to the Dev server (or use WinSCP’s sync to automatically keep dev in sync with local, set up to not copy .svn files) for Dev system testing. We then had a migration application (PHP/ UNIX) that would migrate repositories between the DSL and Staging/ Public Staging and Production. It’d keep a record of all versions that made it to what environments so roll-back for changes was a breeze. It auto-tagged changes going to those environments so that we had a record of Tag releases and Trunk developments. Autotags had to be specified as Major/Minor or Bugfix releases - giving each tag a vM.m.b name as standard.
Migrations can be chosen to be Full Repository or Files Changed Since Current Version On Target Environment for speed/ data integrity. They could be scheduled and had a mini-workflow so only Approver Authorised migrations made it to production.
Seems to work real well.
Nah, it is the most low down and bullshit way of version control using CVS.
Hello!
I like the articles on thinkvitamin very much and thank for this one!
So I’d like what kind of programs do people use to control versions? The platform is Windows, the opensourse or freeware is mostly appreciated.
Thanks in advance.
To answer for my question by myself :)
I tried one of most opensource CVS systems - WinCVS. I coudn’t say that I am charmed, but I think it can help a lot. It’s enough complicated (at least for me) but if you spend enough time to understand it you will be awarded.
Thanks for the article anyway.
HiI have been using Win CVS for a number of years and it’s use of binary files is downright horrible. We have been thinking of changing to Subversion.Is it any better? Anyone?
I recommend you try one of the distributed SCM’s
Mercurial is an excellent (opensource) SCM
http://selenic.com/mercurial
I’ve described my usercase, similar to this one, but with the differences that I store in the version control the db structure too.
Here is the post:
http://lpetrov.mylo.bg/index.php/2007/08/23/version-control-svn-php-and-mysql/
[…] http://www.thinkvitamin.com/training/webapps/enterprise-web-apps/ […]
I saw a post about Perfect Version Control and then realized it wasn’t about Accurev. Odd.
you should enable “view source” code on example projects
tesekkürler
I Think İt is Very good information ….
Thanks…
I think you did a great job of pointing out the major strengths and weaknesses of the book.