Best Web Infrastructure for SAAS Multi-Site / Multi-Page Application

I am creating a new SAAS application and have been looking for some recommendations regarding the most suitable structure to use. I understand that no structure is likely to be able to do this, but I thought that I would ask the community and try to find one that solves the most difficult problems.

Requirements

  • Source of a single code. (each client will have either a subdomain or a separate domain, but each should work with the same code base and the same servers).
  • Should be able to update the programming source once and provide all tenants with its subscription.
  • Session information should be stored in cached storage or simply in cookies (without a general state).
  • Built-in Multi-tenant database function (based on the domain used to access the application, the infrastructure should automatically use the database connection information assigned to this domain)
  • Each client / domain can have its own template for web pages. Templates must be assigned based on each client and stored outside the application code.
  • Safety and rapid prototyping over speed
  • There will be many CRUD screens, so simple built-in functionality is required for this.

I have a fairly long experience with Java and PHP, but consider only PHP as a last resort. My experience with Scala, Python, and Ruby is a little more solid, but I would not mind approaching speed if they offer a significant advantage. I watched the game! Frames and the like (perfectly matches # 1, # 2, # 6), but the multiplayer aspects are not very strong. I have done several projects using Grails, and it handles everything except # 3 and # 5, and can be hacked to do the rest.

+4
source share
4 answers

I would say that the third point is pretty independent of grails / play / what in general. If you need a shared cache, there are many providers for it, and most of them have plugins in Grails.

The apartment building in the grail is quite mature and much less intrusive than the solution from the blog in Sebastiens's answer. Regardless of whether you use a single lease (several databases) or several tenants, they are more or less transparent to your code, and most headaches are abstracted. Keep in mind that you need to do some smart indexing (for example, include the tenant ID in the index of several columns, etc.), so as not to get very sad speeds when your data starts to grow.

As for external views, you can either tickle them in the database, or symbolically link them to your webapp and simply save them in separate numbered folders. Then, from the tenant's plugin, you can use TenantUtils.getCurrentTenant() and simply visualize from the corresponding folder "/" + (tenantID ?: "default") + "/whatever/view/path" . Thus, layouts, etc. Can be transferred between tenants, if you so wish, and simply add the specific material of the tenant to the folders for the tenants.

Perhaps you can do it in the game, too, or, but I don’t see anything that would prevent you from doing this just fine in Grails.

My $ 0.02 for that matter.

+3
source

Actually play! Well suited to what you are looking for.

Read this post: http://www.lunatech-research.com/archives/2011/03/04/play-framework-writing-multitenancy-application-hibernate-filters

It works great. You can even make this filter work so that you can expose the crud module to clients, and they will only get their own data ...

For very large applications, the fragments do not seem to be supported yet (without sleeping fragments processed, but I think). There is a multi-board plugin for working with multiple db, but it seems that it does not work very well ...

+1
source

I heard that the Grails Multi-Tenant plugin offers several useful tools for several different multi-tenant methods.

"Each client / domain can have its own template for web pages. Templates must be assigned based on the client and stored outside the application code."

I assume that you mean that each of them has its own layout / skin. There are several methods for this:

  • You can manually assign layouts based on the tenant. <meta name="layout" content="${tenantName}/main" />

  • Create your own LayoutDecoratorMapper layout and override the default GrailsLayoutDecoratorMapper in sitemesh.xml

  • Learn how to override and improve Some internal tools dynamically allow views (per tenant) or resources (GrailsViewResolver, GrailsConventionGroovyPageLocator, GrailsResourceLoader, etc.)

0
source

In PHP, you can use the Innomatic Platform to create multi-tenant applications (isolated databases): http://www.innomatic.org

0
source

All Articles