I'm going to start a new project and I want to keep things under control from the beginning. Version control is one of the things I want to do right.
I'm planning to use Git and here is a draft of what I'm thinking:
1- There is a base repository on the server.
2- Live site is a clone of that repository.
3- A folder called deploy holds build scripts and db deltas.
4- Developers clone the base repo. and make their changes. For any database operation, a new delta file is checked in.
5- To update the site, live clone pulls from the base repository and then deltas are executed by using dbdeploy via phing.
How does this sound? As I don't really have any experience in this area, your suggestions are welcome.
That is the way we implemented Moovur, it is basically managed by SVN. We work in a branch (even DB scheme), and when we are happy, we merge back and the site is automatically deployed. And it is not even that difficult to set up.
A question: How should configuration.php be handled? If it's in the repository, developers will need to update it for their local copies and it can be committed by mistake.
I tend to use capistrano for deploy, but that's ruby-based, and you might have some issues with that.
It looks like your system will work (don't have much experience with phing so I can't comment on it). Here are some alternatives to think about (they aren't so much "better ways" as "different ways"):
Live site is in a subdirectory that is set to be document root for apache. Can be called anything, I'll refer to it as "current". There will also be a directory tree of x other copies, each directory named with a version number or a date. The "current" directory is a symlink to the most recent of those. (Using a symlink makes it easy to quickly roll back to a previous working version. Keep the last x versions on the site.) Your "deploy" script does the checkout to a new version and as a final step, replaces the symlink with the newest version.
Use a checkout instead of a clone. If you want to use clone, remember the --depth switch.
Don't forget to build scripts to roll back the db changes as well as make them.
You can always ignore the configuration.php, thus allowing each user to have their own configuration.php file and plus it keeps it from being committed.
As far as I know, you can't ignore the file that you've checked out from the repository. I had the same question some time ago and didn't find the right solution. So I still check each time to prevent some "configuration" file to be committed.
@Arlen, what do you mean by checkout instead of clone? I didn't understand that. I read about this symlinking structure somewhere else. Tags can also be an option there maybe.
It also looks like dbdeploy in phing does not have rollback capabilities. I'll need to rewrite some of it.
For configuration.php I'm thinking of adding a configuration.custom.php as ignored file and then merging this file, if present, in configuration.php. So developers can create this file and enter their own database credential. Not a brilliant idea, but it seems to work.