I'm just getting started with Symfony.
I'm using Git/github as a way of managing my project. I've set up two ignores for log and cache which is fine.
I now need to set up a production site. At the moment on this small project I've development and production on the same server but with different file locations and databases.
e.g.
www.example.com/mysymfonyproject_dev/ < development area
&
www.example.com/mysymfonyproject/ < Live / Production site
On server its /homes/sites/example.com/www/mysymfonyproject_dev
& /home/sites/example.com/www/mysymfonyproject
So now I have cloned my project to the new production folder.
It of course ignores the log and cache folders but now I need to change the database.yml
file for example and possible more to get the production area to work.
What is the best method of dealing with this?
Is there some other file I should add to .gitignore
that can state what version this site is e.g. development or production.
OR is there a whole other way I can do this with out using git?
Which is best practice?
As you can imagine I don't want to have to update the database.yml file everytime I do a git push to my production site.
UPDATE:
I've got a development environment. What I'm looking for is a step by step guide to deploy to production. I could use git to do it but for example how do I go about setting up the environments in such a way that all setting will be right when i deploy. I do see that database.yml can have different settings for staging and production but where then do I tell symfony what site is what? as in how does symfony know that www.example.com/kickboxing is production and www.example.com/kickboxing_dev is staging?
UPDATE 2:
In the end for my specific requirements this seemed to work well.
1 <?php
2
3
4 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
5
6 $theurl = explode('/', $_SERVER['PHP_SELF']);
7 $mydir = $theurl[1];
8
9
10 if ($mydir == "mysymfonyproject") //live
11 {
12 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
13 sfContext::createInstance($configuration)->dispatch();
14 }
15 else // dev
16 {
17 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
18 sfContext::createInstance($configuration)->dispatch();
19 }
I think using $_SERVER['SERVER_NAME'] would be better on local machines where you might config your hosts file e.g. mysymfonyproject.local just add to the index file and git repository is ffine then and all files are portable.