Welcome Guest, Not a member yet? Register   Sign In
Running CI on multiple client servers but core on mine
#1

[eluser]tadtoad[/eluser]
Hi

First, sorry for the long first post. I just started using CodeIgniter and it's cut out a whole bunch of development time. I'm putting the finishing touches on a booking system for a client and realized that I'll never actually finish building it since there's always something I want to tweak here and there. Plus, I'd like to license it to other clients.

Because of the above I thought I'd take the SaaS approach to creating the app which will allow me maintain and update only one application but at the same time having these updates to all clients.

I've linked to an image of how the architecture of the whole thing will work. If you have a better approach please let me know. I've checked other posts that make me believe this is doable but need some guidance.
http://i1244.photobucket.com/albums/gg56...rocess.png

The Application Architecture
1. There is only one "application" folder that resides on my server (www.mydomain.com) which contains Controllers, helpers, and all other files (except the client's public view [see 4])

2. My server has all databases (1 per client). So if there are 10 clients, then 10 databases.

3. Client-1's administrator/sales team sign in through my server (client1.mydomain.com) to access orders

4. The client's server (www.client1.com) contains all public views/template files. I want it this way so that if the client wishes to hire another designer to create a new design, they can do so without messing up my code. Plus I don't want them to have any direct access to my server.

5. The config file dynamically changes the DB based on the incoming URL and a predefined pass-key.

6. Users visit the client's website at www.client1.com and they can place orders.

7. On the diagram, it says "Authentication", "Key". This is a layer that I'd like to place which checks to see if the client's subscription to my service has expired. When a user visits the client's website, just before the view is loaded a key is sent to my server which then checks a Customer database that has all registered clients and checks the table if their subscription is expired or not. If expired, the user gets a message, else the rest of the application is loaded and he can place his orders.

My Issues
As I said, I just got into CodeIgniter so there are still a few things I need to catch up on. But here are the steps and issues I foresee.
1. If I have the application folder on my server but pluck out the views folder and place them on another server, how do I tell CI to look at the new server? Is this even possible?

2. I'll need to check to see where a client request is coming from. That is, I get the URL and the key mentioned above. How do I dynamically change the database based on this info? I found links on the forum and a blog post on this but need to try them out. Do you have any suggestions?

3. What other files do I need to update or be mindful of?

I hope someone can help me out with this. I'll also spend the weekend trying to work this out.

Thanks!

#2

[eluser]tadtoad[/eluser]
I found this and will test it out later: http://stackoverflow.com/questions/76901...stallation

If that works, then I'll just need to work on the "views" relocation aspect.
#3

[eluser]justdo[/eluser]
how is your development coming along? have you got anything we can see, we are interested in something very similar.
#4

[eluser]justdo[/eluser]
Is it always this dead on this board?
#5

[eluser]tadtoad[/eluser]
Hey justdo,

I've been really busy with a product launch.

Since I didn't get a reply early enough I changed the way the application works, so I'm using a modified version of OpenCart for what I need.

Since I've been tinkering with OpenCart, I've come up with a theory on how this can be implemented easily with CI. Please note that I haven't attempted it yet, so I can't guarantee anything.

Step 1: OpenCart allows you too run multiple stores on one OpenCart installation but have them under different domains. To be honest I haven't tried finding out how this is done, but if you can then that's one piece of the puzzle. One a side note, OpenCart also follows MVC so finding what file does what won't be tough.

Step 2: Once you figure out Step 1, I think it's smooth sailing from there. Again this is just a theory and I haven't checked, but since CodeIgniter is an MVC based framework, you can probably alter the "core path" to where view files are located. If you can find such a location, you can probably change it so that instead of searching the "views" folders to view files it searches maybe a folder called "tomato" that you create for testing. If you can do this, then you're in business!

Step 3: In the core file(s) that handles how views are produced, you might be able to add a line or two of code that checks to see the current URL that is calling the CodeIgniter installation exists as one of the allowed domains that are stored in your database. If it is, say www.client1.com, you may be able to make it so that instead of CI checking "applications>views (or tomato)" on the default server, it searches "$variable>application>views". Which should look like: http://www.client1.com/application/views. Here the view files reside on the client's server not yours.

I believe 2 and 3 are easily done. But I have no knowledge on how multiple domains work on OpenCart or other "Multi Store" Systems. If you can find that out, then you're on business. I think this is actually easy to implement, but may be a little confusing at first.

I hope you can get this working. Please post any updates you have.

Cheers.




Theme © iAndrew 2016 - Forum software by © MyBB