payara / Payara

Payara Server is an open source middleware platform that supports reliable and secure deployments of Java EE (Jakarta EE) and MicroProfile applications in any environment: on premise, in the cloud or hybrid.
http://www.payara.fish
Other
884 stars 307 forks source link

is there a way to hot deploy of part of application? #886

Closed OndroMih closed 8 years ago

OndroMih commented 8 years ago

I've seen people asking the following question:

is there a way to hot deploy of part of application? If I change just one class, to change it and the server detect a new version, changing the actual running, something like JRebel.

gilbertoca commented 8 years ago

Maybe is time to

I've tried some maven plugins [1]. The best one is the TomEE Embedded Maven Plugin [2]

[1] https://github.com/gilbertoca/jsf-sandbox [2] http://tomee.apache.org/tomee-embedded-maven-plugin.html

lprimak commented 8 years ago

Ugh. I would consider hot-deploy exploded application for development only. In no way that should be the way apps are run in production. This is one of the worse vestiges from the 'old bad days' of doing things, prior to containers, CI and CD.

vkalayda commented 8 years ago

Hello everyone, i want to notice that hot-deploys works very well and should be used only for development purpose. Something like hot-deploys on production environment could be a nightmare. What we should do with currently working transactions/ threads during hot-deploys? Should we use plugins to achieve this? How it could affect to application architecture? I think this is something like crazy things and we should stop discussing them :)

vkalayda commented 8 years ago

But, you can use EJB remote interfaces, split application to some modules and deploy / redeploy these modules separately. It should work. But why do you need this ? :) How this can help to earn more money for your business? :)

vkalayda commented 8 years ago

All these things looks like overengineering. Try to stay lean with Java EE. POJOs save the world! :)

OndroMih commented 8 years ago

I think that the questions about hot-deploy were targeted for development environment. AFAIK, noone uses JRebel in production too. However, for development purposes, hot-redeploy is a very nice thing, reducing development time and increasing programmers' happiness.

Payara Server does not provide a solution for hotdeploy out of the box. However, recently I was testing http://www.hotswapagent.org/ with Payara server, and it work like a charm with my sample application. The configuration to get this running is not straightforward and requires some steps to do, but I was able to get it running in Netbeans. You may see more details in #715. I plan to post a blog about this once I find some time.

OndroMih commented 8 years ago

@gilbertoca, we've noticed your previous suggestion on Twitter, I'm sorry if you received no reply from the Payara team. We certainly consider either to contribute to existing glassfish maven plugins (including the one you mentioned) or derive a plugin supported by Payara, which would be compatible also with GlassFish.

edilmar commented 8 years ago

I think hot deploy is good for...

1) development: save very much time 2) production: I would consider levels of redeploy, one more simple where we need to change some class that do internal logical without connection to database or other kind of servers, and if I just change the .class file in the deployment directory, Payara detects the change and recharge the file in memory. Other more complex situation is to change a Controller/CDI-injected/Database connected/etc .class file, but it would be great in a second moment of Payara devel of hot-deploy to allow changing of any kind of files.

I have an environment where the webapp is deployed in separate files, not just one .war file. This saves much time, allowing uploading new .xhtml/images/etc files fastly without sending all the app again.

The time to redeploy all the app is more than 5 minutes, there are many modules.

vkalayda commented 8 years ago

On my opinion deploy / re-deploy classes to application server is bad idea, really.

As was mentioned earlier:

What we should do with currently working transactions / threads during hot-deploys?

As you say:

one more simple where we need to change some class that do internal logical without connection to database or other kind of servers

Ok, but i think this internal logic may be used for some calculations or something else and finally will affect database.

If you want to customize some logic (formulas, some algorithms) look at Nashorn. Moreover with Nashorn questions are the same (working threads, transactions....)

So there is no silver bullet to achieve partial re-deploy. Application modularity can be easily achieved with remote EJB interfaces and you can to deploy these modules separately. But the same story with (threads and transactions) :)

vkalayda commented 8 years ago

Ohh, i have an idea :) Before re-deploying module you can freeze the transaction service, and unfreeze after deploy. :) But this looks like crazy thing.

OndroMih commented 8 years ago

To summarize:

rsoika commented 5 years ago

Take also a look to the Manik-Hot-Deploy Eclipse plugin supporting hot deploy https://github.com/imixs/manik-hot-deploy/wiki

ld75 commented 5 years ago

Just a remarck, Payara Micro supports hot redeployment (in exploded war with a touch on a .reload file in the root directory). But if you hadve a user session, it will be lost.