simple way to create patch on deployed grails appl

2019-05-06 16:05发布

i have a deployed grails apps on tomcat6 in my client server machine, but the application is still need many fix, so every bug founded or missing feature on client machine, i creating a patch and delivering to client via ftp on .tar.gz file that will replace on deployed folder.

i can't send a fully .war files because the apps is big (~80M), so sending a changes .class files is the only option i have. but the process to creating a patch is too time consuming, especially on rebuild the project, cleaning up the target folder and start to compile all files on project. after that i search the different .class files using on comparison folder apps on new target/classes folder compared to old target/classes folder, and send it to client.

the creating war process is really took many time just to fix a minor thing, is there a way more simple to get a different .class on compiled code? because i need to create patch on 2-3days each for fixing a little stuff that also routinely client reported.

thanks,

标签: grails patch war
5条回答
虎瘦雄心在
2楼-- · 2019-05-06 16:48

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.

查看更多
戒情不戒烟
3楼-- · 2019-05-06 16:56

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.

查看更多
The star\"
4楼-- · 2019-05-06 17:06

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.

查看更多
你好瞎i
5楼-- · 2019-05-06 17:07

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.

查看更多
趁早两清
6楼-- · 2019-05-06 17:08

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.

查看更多
登录 后发表回答