Multiple projects, one CI codebase?

#1
[eluser]faulky[/eluser]
Hi,

I've just downloaded CI and am running through initial tutorials/HOWTO's.

Looks good, but one issue I don't seem to have a handle on yet is how to structure CI for multiple projects hosted on the same site.

For example, we have up to 5 existing applications that we might port to CI, however what would the file structure be? for example:

Example 1: Duplicating the CI codebase for each project.
=======================================================
site.root
->app1
->system
->application
->index.php
->app2
->system
->application
->index.php
->app3
->system
->application
->index.php

Example 2: Common CI codebase for all projects (my preference!)
=======================================================
site.root
->ci_system_index.php
->system
->app1
->application
->app2
->application
->app3
->application

I would like CI to work like example 2, is this feasible?

If so, what configuration files/issues would I need to be aware of?

Many thanks for any light you can shed on this for us.

Cheers, faulky.

#2
[eluser]theprodigy[/eluser]
The way I have my setup is:
Quote:application
--app1
----config
----controllers
----models
----etc, etc
--app2
----config
----controllers
----models
----etc, etc

system
--171
----codeigniter
----libraries
----database
----etc, etc
--172
----codeigniter
----libraries
----database
----etc, etc


public_html
--site1
----css
----js
----images
----index.php //<----- points to application/app1 and system/171
--site2
----css
----js
----images
----index.php //<----- points to application/app2 and system/171
I split my system folder up into whatever version of codeigniter it is running, that way, I don't have to upgrade legacy systems if I don't want to, just because a patch came out.

I split my application folder up into individual site folders

Each index.php points to it's respective application/[site_name] folder and to system/[version] folder

#3
[eluser]2think[/eluser]
faulky,

I'm not sure if you meant 5 different applications as in things such as a forum, an address book, etc. all belonging to one domain. If that is what you meant, you could check out Modular Separation http://ellislab.com/forums/viewthread/121820/.

From my understanding, it is used by Phil Sturgeon in his Pyro-CMS and seems to be faster than Matchbox (another solution for modules).

#4
[eluser]faulky[/eluser]
[quote author="theprodigy" date="1266306179"]The way I have my setup is:
Quote:application
--app1
----config
----controllers
----models
----etc, etc
--app2
----config
----controllers
----models
----etc, etc

system
--171
----codeigniter
----libraries
----database
----etc, etc
--172
----codeigniter
----libraries
----database
----etc, etc


public_html
--site1
----css
----js
----images
----index.php //<----- points to application/app1 and system/171
--site2
----css
----js
----images
----index.php //<----- points to application/app2 and system/171
I split my system folder up into whatever version of codeigniter it is running, that way, I don't have to upgrade legacy systems if I don't want to, just because a patch came out.

I split my application folder up into individual site folders

Each index.php points to it's respective application/[site_name] folder and to system/[version] folder[/quote]

Thanks theprodigy,

Seems like a lot of code duplication, and if you wanted to apply a patch, say for security reasons, you'd have to go back over a fair chunk of code?

I'm really after one CI code base. Having "RTFM"ed the documentation a little further it seems Controllers may be what I'm after.

Therefore, our site structure could look like this:

root
--&gt;system
--&gt;application
----&gt;controllers
------&gt;app1
------&gt;app2
------&gt;app3

Then, extending from your example above, for different client sites:
public_html
--site1
----css
----js
----images
----&gt;app1/index.php //<----- points to application/app1
--site2
----css
----js
----images
----&gt;app2/index.php //<----- points to application/app2

Think that would work?

Thanks again.

#5
[eluser]faulky[/eluser]
[quote author="2think" date="1266307089"]I'm not sure if you meant 5 different applications as in things such as a forum, an address book, etc. all belonging to one domain. [/quote]

Yes, this is what I meant. Thanks 2think, I'll check out the link.

#6
[eluser]faulky[/eluser]
Hi all,

Obviously I didn't read enough of the documentation before posting this...sorry.

The documentation answers my original question here:

http://ellislab.com/codeigniter/user-gui..._apps.html

Posted for other lazy people like myself who ask questions first!

Thanks to those who helped out.

#7
[eluser]theprodigy[/eluser]
Quote:Thanks theprodigy,

Seems like a lot of code duplication, and if you wanted to apply a patch, say for security reasons, you’d have to go back over a fair chunk of code?
It is quite a bit of code duplication, but that's because these are full websites, not different apps within the same site (forum, blog, news, etc). For the different apps, I tend to favor Matchbox (which adds modularity to CodeIgniter).

But, to apply a patch wouldn't be that hard. If I was to apply a patch, it would be one from EllisLabs, and would more then likely be in the core code, so all I would do is update the system folder, and all apps using that system folder would be updated.

The example I showed you wasn't really good, because it didn't show multiple sites using the same system folders. I was trying to keep my example to a minimum while still showing the flexibility of it. I currently have a couple sites who each have their own folder within the apps directory, but all point to the same folder within the system directory (system/172 for example).


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.