Welcome Guest, Not a member yet? Register   Sign In
Multiple Environments


I'm trying to understand the best course of action with using multiple environments, such as development, testing, production for my application with codeigniter.

As of right now I have one folder for my application. I'm seen places that talk about in the config file doing a folder for each of the environments and placing for example a copy of the database file in each of the environment folders.

Is this the best method of handling multiple environments? The reason I'm asking is because if I work on my dev subdomain I'd still have to reupload to the main root folder all the same files. Is this the best workflow?

So basically I have two sites.

dev.siteurl.com siteurl.com

I'm trying to figure out the best option of handling this. Because I'm wondering if I'm going to just have to reupload all the files again to the main level so that it can handle the production server or is there an easier way.


[quote author="CroNiX" date="1363064654"]GIT[/quote]


Find out about Git here

Awhile ago answered a similar type question here

The Codeigniter has some information handling multiple environments here

Hope that helps


But what if I have two separate sites. One is development and the other is production.

I have a development site (local), testing site (remote) and live site (remote). All share a single codebase and use the environment settings as described in the user manual.

Basically, in index.php, if $_SERVER['SERVER_NAME'] == 'my.development.server', it sets environment to development. Then it will load the config for my environment (settings, db settings, etc) as described in the manual. The same for the other environments.

Then I use git to maintain the versions.
I develop on my local machine and make commits. When they are ready to test, I use git to push the changes to the testing server. After I verify everything is working correctly, I push the changes to the live server.

I'm sorry, but I don't want to explain how GIT works as it's very powerful and there is plenty of info on the web. But you don't have to "upload" your codebase to 3 different servers using ftp or anything. It maintains that for you and uses ssh. When you push a git commit, it only sends the changes of the files to the server and not reupload all files. It's very efficient and allows you to create new "branches" in git so you can work on different features separately and not always working on the main branch. This is very handy for "hotfixes", where there is an immediate emergency on the live server that needs to be fixed - but if you were days into a new feature how do you do that without uploading all of your (incomplete) current work? With a new branch for a hotfix. Bam. done.


That is the perfect response. I use Coda on my MacBook Pro for programming. I don't know how I can use Git with the program though. I tried doing a search but didn't find a good one to help me understand how to. Do you know of one, or do you have a better idea?

Git itself is command line and there are GUIs available for all platforms. A lot of free ones and some commercial. I use Zend Studio for an IDE myself, and while it does have git support I still prefer the command line or other gui tool. Git has GitGUI built in which is more than sufficient for most GIT operations, although learning the CLI is really best.

There is a plethora of tutorials on the web on how to set it up on your mac.

Whenever you switch branches in git, all of your code in coda should update to that version of the code automatically. Not sure how coda works, but you might be able to just refresh the project or something if it doesn't. Whenever I switch branches and use Zend Studio, when I try to open a file that has changed it asks if I want to reload the file to the current version. So I'm assuming Coda is similar in that it knows when the file was changed outside of coda.

I thought Zend Studio was just for mobile apps?

Actually, googling "coda+git" pointed out this as the first result:

Theme © iAndrew 2016 - Forum software by © MyBB