I do agree with Jake.
It is not a big deal to manage 50 database if you have a good
back-office to do it.
On Mon, Dec 21, 2009 at 11:10 AM, Daniel Latter <[email protected]
<mailto:[email protected]>> wrote:
OK thanks for the replies, I understand your reasons but this too
seems unmanageable, say if you have 50 customers, thats 50
databases!!? or am I missing somthing?
This isn't so terrible, sandboxing accounts to their own databases
makes your model code a lot simpler (for example, you don't need to
pass around an account id, join and filter every single query).
You can also backup and restore whole accounts using mysqldump instead
of some kind of custom built solution. You can also, (very easily)
break off clients to separate boxes should they generate enough
traffic (or pay for the privilege).
The only con is building an administrative interface may be a bit more
complicated, though I'd rather have the majority of bugs in an app I
deal with, than the one my customers work with.
- jake
Thanks again.
Dan
2009/12/21 Guillaume ORIOL <[email protected]
<mailto:[email protected]>>
I had two reasons in mind:
- security (the db user has rights only on its database)
- simplicity (no need to prefix table names or to add a
customer column in every table PK)
--
Guillaume
Le 21/12/09 16:40, Daniel Latter a écrit :
Thanks for the reply,
What was your main reason for using separate databases
instead of one single database?
Dan
2009/12/21 Guillaume ORIOL <[email protected]
<mailto:[email protected]>>
Yes, I have exactly one database per customer and one
more for supervision purpose (where access to customer
databases are defined).
Le 21/12/09 16:08, Daniel Latter a écrit :
Hi,
I have a situation very similar to yours, although I am
not sure about the answer to your question, I have a
quesiton for you: when you say you have several
databases, what do you mean? do you mean one per
customer/application?
Thanks
Dan
2009/12/21 Guillaume ORIOL <[email protected]
<mailto:[email protected]>>
Working on an application that is the same for
multiple customers, I had to face a design option.
I wanted to avoid installing the application as many
times as we had customers (for maintenance reasons).
Therefore I chose to have a unique code installation
but several databases.
Each customer would access its application by adding
its account name to the application base URL:
webapp.domain.com/account1/
<http://webapp.domain.com/account1/>
webapp.domain.com/account2/
<http://webapp.domain.com/account2/>
etc.
Following this URL prefix are the regular MVC
parameters, ie:
webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>
I define a default route replacement in my Bootstrap
including the account parameter (see below) and
retrieve this special parameter from a
FrontController plugin where I setup the default
database adapter.
I encounter a problem with functions that build URLs
(for instance $view->url(...) or
$redirector->gotoRoute(...), etc.).
All of these functions should add the current
account parameter at the beginning of the URL, but
none of them is aware of it.
(It should also apply to other functions like
$page->getHref() for Zend_Navigation.)
What design option would you suggest (overload all
of these functions, change dynamically the base URL
of the application)?
Thanks for any help
- - - - -
Here is the redefined default route:
$route = new Zend_Controller_Router_Route(
':account/:module/:controller/:action/*',
array(
'account' => 'demo',
'module' => 'default',
'controller' => 'index',
'action' => 'index')
);
$router->addRoute('default', $route);
I would also like to make
"webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>"
equivalent to
"account1.webapp.domain.com/module/controller/action
<http://account1.webapp.domain.com/module/controller/action>".
I guess it is possible with the
Zend_Controller_Router_Route_Hostname, but did not
try already.
$route = new Zend_Controller_Router_Route_Hostname(
':account.webapp.domain.com
<http://account.webapp.domain.com>',
array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
)
);
--
Guillaume ORIOL