Deploying web applications or websites is a terrible thing when done manually, especially if the same change has to be deployed on multiple servers. I hope I have released by the time I come to the end of this article.
Every application should be contained in a source code repository. There is almost no overhead in using one and the pros are always outweighing the the cons. The problem is that not all applications are put into a source code repository, but they should.
When starting a new program or project you start out with a bit of code that is to small to put in a repository. It can be that you aren't even working on a project at that moment, but just a small script someone needs. To make the process less painful now and later, you have to put the code in a source code repository.
But now you ask what has all this to do with deploying web applications. Source code in a repository is easier to deploy than anything else.
Steps to deploy a webapplication on a server. Go to the right directory and do a checkout of the project. So that's all there is to it. If you want to get really fancy and will want that, you can do the following:
- Do a checkout of your repository in a directory named like the version
or revision of the project (for subversion this could be something like
r1004). - Next make or change the symlink from the previous version, to the new version
- Restart your webserver
- This version is now online
In a perfect world this is the version that would like to use until the next release. In the imperfect world we live in, where programmers make little mistakes (and big ones), you can now change the symlink back to an older version, fix the bug, redeploy, and change the sumlink again. Great right. Your customers never know that there was a bug, just some features are missing for a few minutes.
If you want to get really fancy, you can make a special "the website undergoes some scheduled maintenance" directory, that can be shown be changing the symlink to that same directory.
The process of changing the symlink can and should be automated, so that it can be repeated over and over on every server that you like.
In my opinion every program or projects needs it's own source code repository. And I can't think of any reason that will stop anyone from using it. Everybody that says, no you can't use a repository, will probably not work with or use it and is probably not the one needing to fix all the problems that will appear because of not using it.
Also every programmer, webdesigner, tester or documentation person should be able to use the repository, so that no one can reject the repository for not knowing how to use it. It's all part of the job.
Not letting a programmer use a source code control system, because it takes to much time to set up is like not letting a contracter and his workmen use scaffolding to help him get to the upper parts of the roof. It's like saying to a mechanic that he can't use wrench and that he can only use his hands to fix a car.
Without our tools we're just savages, and we don't have to be. Please don't make your job harder than it already is.