simple way to create patch on deployed grails application

让人想犯罪 __ 提交于 2019-12-05 15:44:55

We build the WAR file, then unzip it locally and synchronize the locally exploded WAR (using RSync) with the exploded WAR on the server (using Cygwin on the developer Windows machines). The RSync protocol is very efficient so the deploy over the internet is very fast, but the WAR file generation still takes a lot of time :(

We have scripts on both the developer machines as well as on the server so our deploy mechanism is pretty painless, if you discount the WAR build time. Also, we don't rsync directly into the production directory, we wait until rsync is done and then run a script on the server which also backs up the previous production version in case something goes horribly wrong.

All we do is a clean

grails clean

Then create a war without jars

grails war --nojars

The upload is then 5mb (which takes a while) but it's quicker than 50/80MB. If we add a plugin tc then we need to do a complete upload/build.

We then unzip the war over the top of the exploded war and restart tomcat/jetty/etc..

Hope this helps.

There is no way to create a patch for a Grails application. If the person you are delivering the application to is willing to put librarys in a tomcat shared library directory see this link for info on how to reduce the war file size to a couple megs instead of 80.

Victor Sergienko

Technically, there is another way to change code in runtime: it's Groovy, so you can reassign class methods in runtime, like

MyDomainClass.metaclass.'static'.'method' = { some closure; }

Though, it's very dangerous and not restart-proof.

You can do it in, say, Groovy Web Console. It's another great security breach to have Web Console exposed.

I'd advice that you check your classes into source control, and build on the target machine/in target network. SVN traffic is compressed, so it won't take long to deliver.

Another alternative would be to use source control (DVCS like mercurial or git work great for this), and have the client pull a read only version of whatever branch of your code you want to give them. Then have a build script (gradle/ant/gant) that can download/install grails and compile the production war file and deploy it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!