I 2nd this style. Works a charm. Also check out Symfony, multiple environments are a core part of the framework.
--------------------------------------------------- Keri Henare [e] [email protected] [m] 021 874 552 [w] www.kerihenare.com On 27/05/2009, at 12:59 PM, Mark Rickerby wrote: > > It has nothing to do with branches (branches are separately forked > versions of the entire codebase). > > You will need to make your own decision on a deployment strategy for > config files... > > One method, which is compatible with keeping the same files through > svn co / svn up is to have multiple environments in a single config > file, eg: > > if (ENVIRONMENT == 'production') { > // live database , settings, etc > } elseif (ENVIRONMENT == 'dev') { > // dev settings > } ... > > Another method is to keep separate files for each environment in a > support dir and svn ignore the application level config. To do this, > you would need to upload your files via a script that copies the files > for the correct environment into place. > > An example using Fabric (Python), which is my preferred tool for > deploying PHP sites these days (assuming that a 'config.php' file was > expected in the webroot, and this was ignored via svn): > > def deploy(): > run('cd /var/webroot/mysite; svn up; cp dev/config/live.config.php > config.php') > > Essentially, this is no different to what Paul suggested, but for the > fact that it is automated. I recommend automating these kinds of > things as much as possible, because the extra time spent on setting it > up at the beginning, is much greater amounts of time saved further > down the track, and decreased stress levels. > > I also recommend using svn switch rather than svn up for any site that > is updated frequently or has more traffic - if you need to reverse > things, it's going to be a bit easier that way. > > Hope that helps. > > Mark > > > --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
