Welcome Guest, Not a member yet? Register   Sign In
Switching between local and production environment
#1

[eluser]Maximilian Schoening[/eluser]
Hi,
what would you guys suggest to toggle between local and production environment settings? Like DB, root URL, etc.?

Thanks,
Max
#2

[eluser]n0xie[/eluser]
Put config outside of site root, and symlink it to /application/config.

Then set configvariables for dev, test, uat, and live. Exclude from SCM. Now you can just use any deployment script, rsync or FTP to just copy the whole site. For added bonus do the same for user uploaded/generated content (for example above root in the folder 'userfiles' then symlink to the site root). Now you can rm -rf your whole website whenever you feel like it without losing any settings or destroy usercontent.

For bonus point set error display to 0 on live server in index.php. Then remove all permissions to index.php except read permission from the webserver (which is a good idea anyway), so you don't accidentally overwrite the index file and make the mistake of accidentally turning on error messages
#3

[eluser]pistolPete[/eluser]
Also have a look at this thread:
http://ellislab.com/forums/viewreply/626998/
#4

[eluser]guillermo, out of repose[/eluser]
I trick out my index.php file in a way similar to the manner mentioned here: http://ellislab.com/forums/viewreply/626998/

I change db settings, logging thresholds, URL, and error display settings for my local dev, a staging server and a production server.
#5

[eluser]BrianDHall[/eluser]
I do a little simple check to see if the host is localhost, in which case I set a constant to live or something else.

Then in my database and config files I setup rules I want to be different depending on the constant value. This way I can freely upload/sync files to my heart's content and never have to go "ah crap, I uploaded the production config file and broke the damn site..."
#6

[eluser]Maximilian Schoening[/eluser]
Yep, I also went for the localhost check.

Thanks,
Max




Theme © iAndrew 2016 - Forum software by © MyBB