Grails - Multiple Domain Names Related Sites

I am creating a Grails application that will have several similar sites (each own domain name) with the same code, but with a different design and configuration. (think of a blogger)

What is the best method to use a different kind and even some logic in one application without too much hacking?

I'm new to Grails, and the method I have in mind is to check all the time to find out what a domain name is and to serve the correct controller / view. Is there a better way?

+4
source share
1 answer

I would go with the MultiTenant plugin. You say that the views and logic are different, but I assume that it will differ more from the data? Use MultiTenant to cleanly share data for each site without any noise, and if you store the configuration of views and logic in the database, you get this unique value for each site.

I think MultiTenant is upgrading to the latest version of Grails, at least I saw it in the Grails email list. I think you need to use version 1.2 until then.

I am doing something similar to single data using the Hibernate Filter plugin. My views are the same, but I have texts and messages on the site, first looking at the message "SITE-A.hello.world", and if the default message "hello.world" is not found. Just to give you an idea of ​​how you can customize your views, although you probably need to take it further than for your system ...

+2
source

Source: https://habr.com/ru/post/1314914/


All Articles