1

I think I have this almost figured out. I'm going to be using GIT and my live file structure and I'm trying to figure out how I should be doing this. My question is I'll be having a branch for the development(dev) and one for the production site(public_html). Should they be having a same index.php file because of how the index.php file is for CI there's if statements that handle what environment you are currently in.

 /root
    /application
    /dev
        /site1
            /assets
            index.php
    /public_html
        /assets
        index.php
    /system
plain jane
  • 1,009
  • 1
  • 8
  • 19
Kevin Smith
  • 731
  • 2
  • 7
  • 21

1 Answers1

2

Yes, you can have one index.php file and let it decide how to set the constant for each environment. More important is your database.php file. You should exclude database.php from your GIT repository using methods like this:

Our current set up includes these branches:

/master
/test
/beta

We also have three server environments:

  • Production
  • QA
  • Development

We are using a release system on SpringLoops to auto-deploy on beta and test branches, but to use a manual-deploy on the master branch. That way, we are able to have an up-to-date version for development and QA testing (which matches our current build state), and to also be able to easily deploy our production code.

All of this uses the same exact code base except for the database.php file.

Good luck!

Update: You shouldn't share dev data with test/prod data. You're likely to do things to your testing and prod data that is undesirable. This is also true for code and is why you should have 3 different copies of the code at any given time. Each copy is a safeguard against you overwriting yourself, and/or introducing a bug to production that can be found during development.

Therefore, your environment should be more like:

/root
    /dev
        /application
        /assets
        /system
        index.php
    /test
        /application
        /assets
        /system
        index.php
    /public_html
        /application
        /assets
        /system
        index.php

Now, your GIT repo is only tracking anything under the /dev folder, because all three are copies of each other, only at different commit states.

Hope this all makes sense. One codebase. Three separate places to dev, test, then release to production.

Community
  • 1
  • 1
seangates
  • 1,467
  • 11
  • 28
  • Okay but where should the location of that one index file be placed properly. – Kevin Smith Apr 26 '13 at 21:27
  • Also since the images are all the same for the dev subdomain and the production domain where should the assets folder be located. – Kevin Smith Apr 26 '13 at 21:29
  • @KevinSmith I'm not sure what you mean by "where where should the location of that one index file be placed properly"? Have you moved the index.php file in the CI project you're working on? In response to the question about assets: are you planning on having production data shared between your dev and production? That's a recipe for disaster for your production data. I would avoid it. Keep all code and data separate. – seangates Apr 29 '13 at 22:33
  • @KevinSmith Looking more closely at your folder structure, I would not mix any code. I'll update my answer to make it more clear what I mean. – seangates Apr 29 '13 at 22:34