M
M
marrs2019-08-10 15:55:06
PHP
marrs, 2019-08-10 15:55:06

How to organize a simple multi-tenancy model?

What is the easiest way to get multi-tenancy at the application (script) level from a regular web application? One application with separate databases for each tenant.
Simply put: there is a web application in php + mysql + js, n-companies want to rent it. The application develops and changes, so it will not work to install a separate copy for each tenant.
It is necessary that the scripts be for all tenants in one place, in a single copy.
I see it in such a way that my service is located on the myservice.ru domain, and the tenants are on user1.myservice.ru, user2.myservice.ru, and so on. Each tenant (user1) will only have its own configuration file that specifies connections to the database, and all other scripts (all web applications) should be the same for everyone.
Glad for any help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mamontm, 2019-08-10
@mamontm

1 additional parameter in DB tables in total.
And be sure to filter the data by this parameter and require it everywhere.
This parameter goes through the backend code everywhere.
In the frontend - you can also resolve it at the entrance to the web server by the name of the (sub)domain (unique for each tenant)

The application develops and changes, so it will not work to install a separate copy for each tenant.
It is necessary that the scripts be for all tenants in one place, in a single copy.

That's just how you can customize the look in a simple way ....
Limiting yourself to the logo of the tenant is perhaps - it's easy.
More essential things will force to change the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question