Try ERPNext Buy Support Partners Foundation

Would it be possible to have Multi-Tenant using a Tenant DocType instead of Multi-Sites?

I would like to use Frappé to develop a specific domain SaaS App (and connect the App features to some ERPNext Core Modules).

But I would not like to have one site for each customer, due to these reasons:
a) Most customers will have about 1 - 3 users, and more than 1K customers are expected, so I would have 1K sites (with not so much table records in each one)

b) Every time I would update the app (including bug fixes), I will have to update 1K sites. I would like to have one single site to update all customers at once.

c) I want customer users to logging with their email address at app.saas-solution.com instead of each one going to a <customer/side-id>.saas-solution.com (like you do at Gsuite or Office365).

I have read that multi-company user permission for restricting Item Master Record (and other site wide DocTypes) is possible but quite tricky and can raise problems with such DocTypes.

So I was wondering if it would be possible, and make sense, to have instead of a new site for each tenant, a Tenant DocType and all other DocTypes would be “child” DocTypes of the tenant. Of course, some of them could spam all the Tenants, for entities like (just for example) Language, TimeZones.

Is there any plans to implement such a feature for Frappé/ERPNext?

Anyone with a similar scenario (SaaS solution) have any suggestion on how to manage 1K (or more) Tenants?

Regards

Hi Krammel,

I have similar scenario (1 customer with 1-3 users and 400 customers).
I am using multi-tenant setup.

Having Tenant doctype, for me, is similar to Company. The issue, like you mentioned before, is there are doctypes that shared across Company/Tenant
so have to identify which one can be shared or per tenant basis.
And you have to fix the known, filtering & validation, issues in ERPNext for multi-company/tenant setting.

Updating should not be an issue for multi-tenant. In Frappe/ERPNext, update/upgrade will update all sites/tenants.

Regards,
Subhajit

1 Like

Isn‘t the nature of multitennancy that all sites share the same codebase? Then a single update updates all sites at once .

2 Likes

I’m not the expert but I want to give my view on this matter:

I believe Frappe and ERPNext is capable of handling 1k sites. It leaves
you with the server configuration.
The consideration you must take is how those users will have their data separated. It might be possible with user permissions, but I think it will be a nightmare to manage.
Another option is to use company. One company for each user. But again it depends on how you want to separate user data.

All the sites will have same apps repository which is in the frappe-bench/apps. So you can update 1 app and it will affect all sites that have that app installed. This also give other side of advantage: you can have different custom app that are only installed in some sites and have only those sites affected by that app.

This is also my interest :slight_smile: but I believe it is also possible to do with multi sites by connecting user account (in 1 Frappe site) with their own site. Centralized login but open each sites respectively.

Correct, the app codebase is a shared one.
But what happens when a new version of an already installed app have DocTypes changes that requires site migration?
Do I have to run bench migrate for each site? For sure it is possible, I am just wondering how to do it, and if I need to manage migration result (success/failure) for every single site.

Hi SubhajitDey,

Thanks a lot.
From your scenario (experience) it seems that it is not so difficult to have multi-tenant with multi-sites.

As I mention in my reply to @vrms , my concern from a deployment perspective is about the need to apply migrations on each site.

Hi rahy,

Great.
Does that mean that Users from the Centralized login site would need: (a) to be replicated to the tenant site (to be used as the logged user at the tenant site) or users from each tenant to the centralized login site?; (b) To create a dynamic user-based routing after user logging to the site URL (with a AuthToken to avoid requesting Login again?

Hi Krammel,

That’s the thing with multi tenant site.
But for me, applying migration on each site, which can be done via script (python/sql), is less work than customizing frappe/erpnext to have multi tenant ready in one site :slight_smile:

ERPNext itself maybe have around 5-6K sites (cloud clients). Upgrading takes time :smiley:

1 Like