Multi Tenancy

27 views
Skip to first unread message

Andrew Fam

unread,
Aug 9, 2018, 10:18:01 PM8/9/18
to Django users
Hi all, I have a saas solution currently sitting in 1 instance using a postgres db.
Due to recent expansions, I need to keep the data in the country of which it came from. e.g Malaysia or Philippines will have a database of their own. 
In addition, some companies are asking for on - prem versions and I was thinking it might be good for them to own their database while we keep the application server.
Does anyone have an idea of how to solve this issue and what is the most elegant way of doing this?

Some background to this.
I have a tenant model that is storing the country using countryfield.
Some models directly link to the tenant model, others reference a field which is tied to a model with the tenant model.


Mike Dewhirst

unread,
Aug 9, 2018, 10:32:47 PM8/9/18
to django...@googlegroups.com, Andrew Fam
On 10/08/2018 11:45 AM, Andrew Fam wrote:
Hi all, I have a saas solution currently sitting in 1 instance using a postgres db.
Due to recent expansions, I need to keep the data in the country of which it came from. e.g Malaysia or Philippines will have a database of their own. 
In addition, some companies are asking for on - prem versions and I was thinking it might be good for them to own their database while we keep the application server.
Does anyone have an idea of how to solve this issue and what is the most elegant way of doing this?

It is an interesting problem I'm going to have to solve one day. So no I can't help but I'll watch this thread.

I'm particularly interested in security aspects.



Some background to this.
I have a tenant model that is storing the country using countryfield.
Some models directly link to the tenant model, others reference a field which is tied to a model with the tenant model.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/be6fb573-50fa-4f48-be37-712d1a279859%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Fam

unread,
Aug 9, 2018, 10:36:54 PM8/9/18
to Django users
Yeah it'll be good to leave some ideas here so that ppl don't have to make painful changes down the line to fit the system later.
The current solutions require too much work and are not that flexible.

Mike Dewhirst

unread,
Aug 10, 2018, 1:21:06 AM8/10/18
to django...@googlegroups.com, Andrew Fam
On 10/08/2018 12:36 PM, Andrew Fam wrote:
Yeah it'll be good to leave some ideas here so that ppl don't have to make painful changes down the line to fit the system later.
The current solutions require too much work and are not that flexible.


On Friday, August 10, 2018 at 10:32:47 AM UTC+8, Mike Dewhirst wrote:
On 10/08/2018 11:45 AM, Andrew Fam wrote:
Hi all, I have a saas solution currently sitting in 1 instance using a postgres db.
Due to recent expansions, I need to keep the data in the country of which it came from. e.g Malaysia or Philippines will have a database of their own. 
In addition, some companies are asking for on - prem versions and I was thinking it might be good for them to own their database while we keep the application server.
Does anyone have an idea of how to solve this issue and what is the most elegant way of doing this?

Don't know about your application but mine generates its main benefit for clients in sharing the public side of their information while keeping their proprietary info safe. That means some models in the public schema and some in private/tenant schemas. Django will let me do that if I understand the router docs correctly. However, some clients want all their data in their own private database and shared publically via their own website. That is a retrograde solution so it means when they discover that they really want to put their public facing info into the main public database I'll need a REST API so they can publish it.


It is an interesting problem I'm going to have to solve one day. So no I can't help but I'll watch this thread.

I'm particularly interested in security aspects.



Some background to this.
I have a tenant model that is storing the country using countryfield.
Some models directly link to the tenant model, others reference a field which is tied to a model with the tenant model.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/be6fb573-50fa-4f48-be37-712d1a279859%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Gagan Kalia

unread,
Aug 10, 2018, 7:09:21 AM8/10/18
to django...@googlegroups.com
Andrew,

Even if you keep the application servers in another geography, wouldn't it be a performance hit in terms of accessing the Database hosted in another geography? My take would be to keep the systems in the same geography to avoid the performance issues down the line and making the customer dissatisfied.

Secondly, when companies are asking for on-prem versions, you are not left with much of the options as they would be reluctant to open their DB server firewalls to the public cloud where your applications servers would be hosted. 

This is a compliance thing and every country would have their own rules and regulations anyways wrt to the data security and retention. You are in the best position to assess what your app does and what kind of data it stores and processes, so make a good judgement and don't just think about a middle way to avoid re-architecting some parts of you SaaS design. 

Sorry if I couldn't understand the complete problem though...

Regards,
Gagan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages