Multi tenancy application

58 views
Skip to first unread message

senasa...@gmail.com

unread,
Jul 22, 2020, 7:45:43 AM7/22/20
to Fusio
Hi,
how fusio can host a multi tenant app ? what things we need to consider?

Christoph Kappestein

unread,
Jul 26, 2020, 3:17:46 PM7/26/20
to Fusio
Hi,

so in general it depends on what you exactly understand by multi tenant app, in general we recommend to create a separate app per customer, with a separate database etc.

best regards
Christoph

senasa...@gmail.com

unread,
Jul 28, 2020, 9:39:32 AM7/28/20
to Fusio
Hi Christoph
Beside separating the app and database, how we exactly manage  the API resource that can shared between different tenants?
for example, if we have 2 Application API ( i.e.  API for CMS and  API for E-commerce ).
How about if in 1 application has several users role? is that mean, all users in 1 tenant should be registered in Fusio Server users account too?

This is what I thought :

FUSIO API server
------- App 1 Shared API resource (CMS)  
---------------- tenant 1 App  (DB-CMS1)
--------------------------  user role Admin
--------------------------  user role editor
---------------- tenant 2  App (DB-CMS2)
--------------------------  user role Admin
--------------------------  user role editor

------- App 2 shared API resource (Ecommerce)
---------------- tenant 3  App (DB-Ecommerce1)
--------------------------  user role Admin
--------------------------  user role editor

and so on.
do you think this is a wise approach for implementing in Fusio?


Christoph Kappestein

unread,
Jul 29, 2020, 1:25:57 PM7/29/20
to Fusio
Hi,

yes so to share the resources the instances must be on the same database. You could also write the API for the CMS and E-Commerce into one Fusio instance. So you have one API for both apps. With Fusio you can also connect to multiple different databases so this should be no problem.

best regards
Christoph

senasana

unread,
Aug 25, 2020, 9:55:19 AM8/25/20
to Fusio
Hi Christoph,
Back to this topic, I also need, every tenant user can manage their tenant member users too. I study the consumer/* API, but I cant figure out how the current user that already registered can register other user (as a member). I need your advice what approach should I take to achieve this?  my current idea is to create the service that call backend API with internal user that has a privilege as same as admin user (say that a robouser that available in the service class) , so I will not touch the fusio core impl  backend / consumer class to allow me to get any fusio update in the future.

senasana

unread,
Nov 30, 2020, 7:18:44 AM11/30/20
to Fusio
Hi 
This is what I have done to achieve my goal for multi tenancy in fusio , 
1. I already create a service let say "tenancy" service, 
    this service will support for member creation by tenant owner, 
    the principle is just create an user that have backend scope. and then in "tenancy" service, I create a function which will call to  /backend/user  route to help create a user (tenant member) on behalf of current tenant owner user.
    by this way, the tenant owner is just a common user who registered it self from developer app (tenant owner have a consumer scope only, no admin access to backend app)
   every tenant member that have been created,  also own a custom user attributes ( tenant_id ) inherit from tenant owner (tenant_id)

2. I have changes developer app by adding 1 submenu for listing tenant member and button for member creation. 
    All request header from developer app, has been added by tenant_id header.

3. (TO DO), Monetization part. My challenges now is how to make a contract that has been selected by tenant owner will also apply to all of its members. And the points owned by the tenant owner will also decrease every time tenant member makes a request to API endpoints.

at least by this way, I reduce to touch the core of fusio for future update. 
Reply all
Reply to author
Forward
0 new messages