Welcome Guest, Not a member yet? Register   Sign In
A SaaS Application
#1

[eluser]alejandronanez[/eluser]
Hi everybody

I've been developing an application to manage some clinic's information.

The thing is that I want to offer this app as a SaaS and I don't know how to manage the access to the application, I've been thinking about 2 ways to implement this:

1) SUBDOMAINS : like http://clinic1.myapplication.com/control.../parameter
2) Or like this: http://myapplication.com/clinic1/control.../parameter

Can you help me out with this, has anyone worked with a SaaS application with CI?

Ps.

I will have 1 DB per Clinic, and also I will have another DB with all the clinics and the payment information, is that Ok?

Thanks in advice.
#2

[eluser]cmgmyr[/eluser]
Yes, I have a SAAS site but I use full domain names instead of sub-domains or sub-directories. It all really depends on how you want the application to work. There really is no right or wrong way to deal with the URL.

However, you need to rethink your database handling decision. Having multiple databases, at least in my opinion, is a bad idea. You need to think about scalability for your application. Making 1 change to 3 databases isn't that bad, but what happens when you have 25, 50, or even 1,000 databases. You don't want to make one change 1,000 times. By reworking your database a little bit you will be able to handle all users/domains/accounts. In my database I have a table for domains with an ID associated with it, in just about every other table I have a "domain_id" field where this matches up. Within the application I see what domain id the request is coming from and query against that.

I hope this helps,
-Chris
#3

[eluser]alejandronanez[/eluser]
Hi, thanks for answer my question.

I like your database approach, but if I only manage 1 DB and one client has 10.000 registers and another client has just 30 registers and the second client (30 registers) wants to take data from the DB it will take too much time (the system will need to check all the registers, 10.030, to find what he's looking for) am I clear?

Do you mean working with domains like: www.myclient_1.com , www.myclient_2.com, www.myclient_N.com, etc... If i work that way, should I have N installation of my application? (1 installation per domain)

Thank you very much!
#4

[eluser]cmgmyr[/eluser]
No problem at all, this is what forums are for Smile

For the database, as long as you design them correctly, they are very fast. When you make your additional tables make sure you add an INDEX to your domain_id, client_id, or what ever ID name that you are using. There are a number of other things you can do to optimize your database but that will give you a good start. By adding indexes it will make your queries faster with that much data.

Yes, I have multiple domain names pointed to the same application. Everything is running from the same spot. In my config.php file I have:
Code:
$config['base_url'] = "http://". $_SERVER["HTTP_HOST"];
to make sure I get the actual domain and don't have to set it manually.

I have made a "startup" library that runs a few queries to get the data for the specific domain:
1. Get the current domain name (base_url)
2. Get the domain_id from the database
3. Get all config information for that ID

You might also need to make specific templates for each domain, but once you have the ID from the database you will be able to use that for many purposes. There are MANY more thing that I had to do in order to get this to work for my purposes, but this should get you to a starting point. You can also do a Google search for "codeigniter multiple domains" and find additional resources.

If you have any other questions, please let me know.

-Chris
#5

[eluser]umefarooq[/eluser]
really nice topic and really want to work on SAAS application if you want to handle multiple domains these link will help you

http://net.tutsplus.com/tutorials/php/ba...deigniter/

if you are dealing with multiple site and multiple databases then try this

http://philsturgeon.co.uk/news/2009/06/H...ter-Set-up

this link can also work for single database with multiple domain and data




Theme © iAndrew 2016 - Forum software by © MyBB