Dynamic applications (extending an existing application) with Grails

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic applications (extending an existing application) with Grails

Ruwan Linton
Hi folks,

We have built a great web application with grails, currently running as a service on http://as2gateway.org . Grails fits well into our requirements and it delivered us the RAPID development that we have expected it to give us.

Now we have a requirement such that, we want to distribute this application for private hosting too, with some customization for the specific customers, how ever we do not want to manage the core distribution separately for individual customers (as it is a maintenance headache) and would like to find some means of adding artefacts to the released application.

I did a bit of googling and came across this post to this same list posted in 2009 [1], this is very close if not an exact match to my requirements, but unfortunately I couldn't find any viable solution to this post. One of the responses states that OSGi will solve this in 2.0, but it doesn't seem to be the case, as I have already been using 2.1.0 and no OSGi support seems to be there. [Please bare with me if I am missing some discussion leading Grails to avoid OSGi support]

I am not looking for updating the application at runtime, just the ability to patch an existing built application with some means (possibly with a new plugin)

Thanks,
Ruwan

[1] - http://grails.1312388.n4.nabble.com/Modular-and-Dynamic-Grails-Application-td1384951.html

--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

alxndrsn
On 31 August 2012 15:33, Ruwan Linton <[hidden email]> wrote:

> Hi folks,
>
> We have built a great web application with grails, currently running as a
> service on http://as2gateway.org . Grails fits well into our requirements
> and it delivered us the RAPID development that we have expected it to give
> us.
>
> Now we have a requirement such that, we want to distribute this application
> for private hosting too, with some customization for the specific customers,
> how ever we do not want to manage the core distribution separately for
> individual customers (as it is a maintenance headache) and would like to
> find some means of adding artefacts to the released application.
>
> I did a bit of googling and came across this post to this same list posted
> in 2009 [1], this is very close if not an exact match to my requirements,
> but unfortunately I couldn't find any viable solution to this post. One of
> the responses states that OSGi will solve this in 2.0, but it doesn't seem
> to be the case, as I have already been using 2.1.0 and no OSGi support seems
> to be there. [Please bare with me if I am missing some discussion leading
> Grails to avoid OSGi support]
>
> I am not looking for updating the application at runtime, just the ability
> to patch an existing built application with some means (possibly with a new
> plugin)
>
> Thanks,
> Ruwan
>
> [1] -
> http://grails.1312388.n4.nabble.com/Modular-and-Dynamic-Grails-Application-td1384951.html

We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

smaldini
I guess we should explore the possibilities around an event bus there. Vertx has the concept of hot deployable verticles, and vertx perfectly works inside Grails. I didn't get the chance to publish the plugin since I'm fully taken by customer work.

On Fri, Aug 31, 2012 at 1:47 PM, Alex Anderson <[hidden email]> wrote:
On 31 August 2012 15:33, Ruwan Linton <[hidden email]> wrote:
> Hi folks,
>
> We have built a great web application with grails, currently running as a
> service on http://as2gateway.org . Grails fits well into our requirements
> and it delivered us the RAPID development that we have expected it to give
> us.
>
> Now we have a requirement such that, we want to distribute this application
> for private hosting too, with some customization for the specific customers,
> how ever we do not want to manage the core distribution separately for
> individual customers (as it is a maintenance headache) and would like to
> find some means of adding artefacts to the released application.
>
> I did a bit of googling and came across this post to this same list posted
> in 2009 [1], this is very close if not an exact match to my requirements,
> but unfortunately I couldn't find any viable solution to this post. One of
> the responses states that OSGi will solve this in 2.0, but it doesn't seem
> to be the case, as I have already been using 2.1.0 and no OSGi support seems
> to be there. [Please bare with me if I am missing some discussion leading
> Grails to avoid OSGi support]
>
> I am not looking for updating the application at runtime, just the ability
> to patch an existing built application with some means (possibly with a new
> plugin)
>
> Thanks,
> Ruwan
>
> [1] -
> http://grails.1312388.n4.nabble.com/Modular-and-Dynamic-Grails-Application-td1384951.html

We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Stéphane MALDINI
--


Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Ruwan Linton
In reply to this post by alxndrsn
Hi Alex,

Thanks for the reply.

We are already using that paradigm, where as our application is a bare one, which has nothing in it but depends on a set of plugins. However in this case, the custom extension is (supposed to be) managed by the customer, in which case we cannot ask them to have the application itself under them, rather just a plugin or some sort of an extension.

What I am looking at is some sort of a patching mechanism for a released application (war)

Thanks,
Ruwan

On Fri, Aug 31, 2012 at 6:17 PM, Alex Anderson <[hidden email]> wrote:

We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Ruwan Linton
We could I guess, assume an expanded war, as our servlet container is tomcat (at least for the time being) and it anyway explode the war into a directory structure, and run on that. So I am effectively looking at dropping some zip file into a specific location.

I could even write some code to load this bit on the restart by using a mechanism like what db-migration plugin does to keep track of the extension point changes, if anybody can provide me some insight on how grails internally does this. If my understanding is correct, Grails does the plugin source compilation at the build time of the application, (I am referring to regular plugins and not binary plugins). Can some one shed some light on some possibility of loading a new extension through the code?

Ruwan

On Fri, Aug 31, 2012 at 6:35 PM, Ruwan Linton <[hidden email]> wrote:
Hi Alex,

Thanks for the reply.

We are already using that paradigm, where as our application is a bare one, which has nothing in it but depends on a set of plugins. However in this case, the custom extension is (supposed to be) managed by the customer, in which case we cannot ask them to have the application itself under them, rather just a plugin or some sort of an extension.

What I am looking at is some sort of a patching mechanism for a released application (war)

Thanks,
Ruwan


On Fri, Aug 31, 2012 at 6:17 PM, Alex Anderson <[hidden email]> wrote:

We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

phone: <a href="tel:%2B94%2011%20251%206899" value="+94112516899" target="_blank">+94 11 251 6899
email: [hidden email]; cell: <a href="tel:%2B94%2077%20341%203097" value="+94773413097" target="_blank">+94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton




--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

alxndrsn
In reply to this post by Ruwan Linton
On 31 August 2012 16:05, Ruwan Linton <[hidden email]> wrote:

> Hi Alex,
>
> Thanks for the reply.
>
> We are already using that paradigm, where as our application is a bare one,
> which has nothing in it but depends on a set of plugins. However in this
> case, the custom extension is (supposed to be) managed by the customer, in
> which case we cannot ask them to have the application itself under them,
> rather just a plugin or some sort of an extension.
>
> What I am looking at is some sort of a patching mechanism for a released
> application (war)

Would versioned releases of the core "plugin" be suitable?  Then they
could just roll the version number, rebuild their war and redeploy.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Ruwan Linton
In reply to this post by smaldini
Hi Stephane,

Thanks for the information, I am not familiar with Vertx, could you please share some reading material for a beginner?

Ruwan

On Fri, Aug 31, 2012 at 6:30 PM, Stephane Maldini <[hidden email]> wrote:
I guess we should explore the possibilities around an event bus there. Vertx has the concept of hot deployable verticles, and vertx perfectly works inside Grails. I didn't get the chance to publish the plugin since I'm fully taken by customer work.


On Fri, Aug 31, 2012 at 1:47 PM, Alex Anderson <[hidden email]> wrote:
On 31 August 2012 15:33, Ruwan Linton <[hidden email]> wrote:
> Hi folks,
>
> We have built a great web application with grails, currently running as a
> service on http://as2gateway.org . Grails fits well into our requirements
> and it delivered us the RAPID development that we have expected it to give
> us.
>
> Now we have a requirement such that, we want to distribute this application
> for private hosting too, with some customization for the specific customers,
> how ever we do not want to manage the core distribution separately for
> individual customers (as it is a maintenance headache) and would like to
> find some means of adding artefacts to the released application.
>
> I did a bit of googling and came across this post to this same list posted
> in 2009 [1], this is very close if not an exact match to my requirements,
> but unfortunately I couldn't find any viable solution to this post. One of
> the responses states that OSGi will solve this in 2.0, but it doesn't seem
> to be the case, as I have already been using 2.1.0 and no OSGi support seems
> to be there. [Please bare with me if I am missing some discussion leading
> Grails to avoid OSGi support]
>
> I am not looking for updating the application at runtime, just the ability
> to patch an existing built application with some means (possibly with a new
> plugin)
>
> Thanks,
> Ruwan
>
> [1] -
> http://grails.1312388.n4.nabble.com/Modular-and-Dynamic-Grails-Application-td1384951.html

We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Stéphane MALDINI
--





--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Ruwan Linton
In reply to this post by alxndrsn
Well that is the ultimate solution, if what I am thinking of doing is absolutely impossible, :-( as some of our clients might not like to build there own war, even though it is just collecting the plugins provided by us with one or 2 of there plugins. It is a business mindset problem that we have to solve in that case.

Ruwan

On Fri, Aug 31, 2012 at 6:49 PM, Alex Anderson <[hidden email]> wrote:
On 31 August 2012 16:05, Ruwan Linton <[hidden email]> wrote:
> Hi Alex,
>
> Thanks for the reply.
>
> We are already using that paradigm, where as our application is a bare one,
> which has nothing in it but depends on a set of plugins. However in this
> case, the custom extension is (supposed to be) managed by the customer, in
> which case we cannot ask them to have the application itself under them,
> rather just a plugin or some sort of an extension.
>
> What I am looking at is some sort of a patching mechanism for a released
> application (war)

Would versioned releases of the core "plugin" be suitable?  Then they
could just roll the version number, rebuild their war and redeploy.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Lari Hotari -
In reply to this post by alxndrsn
31.08.2012 15:47, Alex Anderson wrote:
We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).
We are doing this too. If you do this (a grails application is a application and plugin at the same time), you have to exclude the plugin from starting up when it's run as an application. Otherwise the application will start it self twice: as an application and as a plugin. The "grails.plugin.excludes" configuration setting (explained here) prevents this from happening. I have documented this special use case in this jira issue: http://jira.grails.org/browse/GRAILS-6751 "Allow a Grails application to be used as a Grails plugin besides using it as an application" This has turned out to be a killer feature for us in many cases. We have been able to reuse applications as plugins in other use cases and combine several separate applications to one with this feature. Of course there are some restrictions (like name conflicts) but that hasn't been a problem for us. The most common use case is to reuse a full application and just override the views in another one. Since an existing application can be an application and plugin at the same time, there is no extra work in extracting "common parts" to a separate plugin. To make an existing Grails application a plugin you just have to add a MyAppNameGrailsPlugin.groovy file to the root directory and add this configuration value to grails-app/conf/Config.groovy: grails.plugin.excludes = ['myAppName'] (application name in camel case starting with lower case letter) Regards, Lari

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Ruwan Linton
Hi Lari,

This is quite useful information for me. I didn't know that we could declare an application as a plugin, and use that application plugin to build another application. Although not perfect this will work for my case too, as we have a single standard application (which is also a plugin) and a set of customer specific applications which uses the standard application. The only catch is customer or (we, on-behalf of customer) has to manage an application, but I think there is no way to get around that in the current grails version.

Thanks a lot for pointing this out, I haven't tried this yet, but it seems to solve my issue...

Thanks,
Ruwan

On Mon, Sep 3, 2012 at 11:00 PM, Lari Hotari <[hidden email]> wrote:
<a href="tel:31.08.2012%2015" value="+13108201215" target="_blank">31.08.2012 15:47, Alex Anderson wrote:
We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).
We are doing this too. If you do this (a grails application is a application and plugin at the same time), you have to exclude the plugin from starting up when it's run as an application. Otherwise the application will start it self twice: as an application and as a plugin. The "grails.plugin.excludes" configuration setting (explained here) prevents this from happening. I have documented this special use case in this jira issue: http://jira.grails.org/browse/GRAILS-6751 "Allow a Grails application to be used as a Grails plugin besides using it as an application" This has turned out to be a killer feature for us in many cases. We have been able to reuse applications as plugins in other use cases and combine several separate applications to one with this feature. Of course there are some restrictions (like name conflicts) but that hasn't been a problem for us. The most common use case is to reuse a full application and just override the views in another one. Since an existing application can be an application and plugin at the same time, there is no extra work in extracting "common parts" to a separate plugin. To make an existing Grails application a plugin you just have to add a MyAppNameGrailsPlugin.groovy file to the root directory and add this configuration value to grails-app/conf/Config.groovy: grails.plugin.excludes = ['myAppName'] (application name in camel case starting with lower case letter) Regards, Lari




--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic applications (extending an existing application) with Grails

Ruwan Linton
Folks,

I have phased few issues while trying to implement this;
  1. I was using Maven to build as I have a multi module project structure, how ever I couldn't figure out a way around to build my application as a plugin too, as the packaging needs to be defined in the pom.xml either as grails-app or grails-plugin which prevents one of the artifacts (war application or the plugin zip) from being built. I wanted the build to be automated and should produce my generic application as well as custom applications based on that generic app at the same build.
  2. I couldn't find a way around to include my migration changelog files in the generic application into the custom application. This actually drills down to a problem of "How to include DB migration changelogs of a plugin into an application"
Did anyone have an experience in resolving these issues?

Thanks,
Ruwan

On Mon, Sep 3, 2012 at 11:11 PM, Ruwan Linton <[hidden email]> wrote:
Hi Lari,

This is quite useful information for me. I didn't know that we could declare an application as a plugin, and use that application plugin to build another application. Although not perfect this will work for my case too, as we have a single standard application (which is also a plugin) and a set of customer specific applications which uses the standard application. The only catch is customer or (we, on-behalf of customer) has to manage an application, but I think there is no way to get around that in the current grails version.

Thanks a lot for pointing this out, I haven't tried this yet, but it seems to solve my issue...

Thanks,
Ruwan


On Mon, Sep 3, 2012 at 11:00 PM, Lari Hotari <[hidden email]> wrote:
<a href="tel:31.08.2012%2015" value="+13108201215" target="_blank">31.08.2012 15:47, Alex Anderson wrote:
We're doing similar - a core application which is also a grails
plugin, and customer-specific extensions which use the core
application as a plugin.

It works, but we run into strange behaviour quite often (e.g.
inconsistencies between run-app vs. run-war).
We are doing this too. If you do this (a grails application is a application and plugin at the same time), you have to exclude the plugin from starting up when it's run as an application. Otherwise the application will start it self twice: as an application and as a plugin. The "grails.plugin.excludes" configuration setting (explained here) prevents this from happening. I have documented this special use case in this jira issue: http://jira.grails.org/browse/GRAILS-6751 "Allow a Grails application to be used as a Grails plugin besides using it as an application" This has turned out to be a killer feature for us in many cases. We have been able to reuse applications as plugins in other use cases and combine several separate applications to one with this feature. Of course there are some restrictions (like name conflicts) but that hasn't been a problem for us. The most common use case is to reuse a full application and just override the views in another one. Since an existing application can be an application and plugin at the same time, there is no extra work in extracting "common parts" to a separate plugin. To make an existing Grails application a plugin you just have to add a MyAppNameGrailsPlugin.groovy file to the root directory and add this configuration value to grails-app/conf/Config.groovy: grails.plugin.excludes = ['myAppName'] (application name in camel case starting with lower case letter) Regards, Lari




--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org

phone: <a href="tel:%2B94%2011%20251%206899" value="+94112516899" target="_blank">+94 11 251 6899
email: [hidden email]; cell: <a href="tel:%2B94%2077%20341%203097" value="+94773413097" target="_blank">+94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton




--
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Director of Engineering; http://adroitlogic.org