Grails Multi-Tenancy with Multiple Databases

I can’t find any updated resource / guide, plugin or example about Grails multiuser work with several databases (one for each tenant). I am stuck right now with https://grails.org/plugin/multi-tenant-single-db and deprecated https://grails.org/plugin/multi-tenant-core .

How to perform database switching, which depends on the user registered in the system?

+5
source share
1 answer

Grails allocates a lot of Hibernate materials, so there is an impedance mismatch between Gorm and Hibernate. One of these problems is loading multiple tenant-based data sources. If you are a tenant going to a DB strategy, be prepared for a tough battle . In addition to the difficulties, there is a long way forward, since database maintenance is quite expensive in this strategy. Most modern applications use the Single Single Single Schema approach, and I also used this approach in my plugin . This plugin currently allows tenants to use Spring Security. The reason for this approach was the application I was working on, the SaaS application for service from one domain. If you need to serve several domains, this plugin requires minor modification.

Regarding migration to grails3, it was released in March 2015 and within one year it went through various improvements and bug fixes. It is stable enough to rely on him, and in addition, he has almost all the necessary plugins already transferred. If you are creating a new application, you must follow the path of grails3. If you have an existing application, you can upgrade to grails3.

+3
source

All Articles