持续部署 Grails 应用程序
我正在开发一个 grails 应用程序,需要定期将修补程序部署到远程服务器。我使用 jenkins 和 grails 插件来实现自动化。
我的观点如下:
大多数时候我修复了一些类,应用程序中没有大的更改(例如新的数据库架构、新的插件......)。然而,每次我创建补丁时,我都必须通过 ssh 上传一个 75M 的 war 文件,这需要 15 到 20 分钟。大部分数据是不需要的(即所有打包的jar)。只需从 WEB-INF/classes/ 上传新编译的类并重新加载 servlet 容器(在我的例子中为 jetty)就足够了。
有人有这方面的经验吗,最好是詹金斯?
I am working on a grails app and need regularly to deploy hot fixes to a remote server. I am using jenkins with grails plugin for automation.
My point is the following:
Most of the time i fix a few classes, with no big changes in the app (such as new database schema, new plugins....). However each time i create a patch i have to upload trough ssh a 75M war file, which takes between 15 to 20 min. Most of the data is not needed (ie all the packaged jars). What would be sufficient is to upload only the fresh compiled classes from WEB-INF/classes/
and reload the servlet container (in my case jetty).
Anybody experienced with this, preferably with jenkins?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
检查 war 任务的 nojars 参数:http://www.grails.org/doc/1.3.7/ref/Command%20Line/war.html
这样你就可以放置所有的 .jar(通常是最大的文件.war)位于服务器上的其他目录中,只需在 Jetty 类路径中引用该目录即可。
或者您可以编写一个 shell 脚本来分解 .war 文件(毕竟它只是一个常规的 .zip 文件),添加已编译的类,然后重新打包它。
Check the nojars argument for the war task: http://www.grails.org/doc/1.3.7/ref/Command%20Line/war.html
This way you can place all your .jars (which are usually the biggest files inside a .war) in some other directory on the server and just reference that directory in your Jetty classpath.
Or you could write a shell script to explode the .war file (after all it's just a regular .zip file), add the compiled classes and then re-package it.
您可以尝试使用 CloudBees 进行持续交付发布。他们还使用增量来上传您的更改,并且部署根本不会影响用户体验。
一个易于使用的插件可以使 Grails 应用程序和 Jenkins 构建中的流程无缝衔接。我写了一篇博客文章如何让这一切轻松运作。
You could try using CloudBees to do continuous delivery releases. They also use deltas to upload your changes, and deployments don't affect the user experience at all.
An easy to use plugin is available to make the process seamless from within your Grails app and in a Jenkins build. I've written a blog post about how to get it all working easily.
我记得在邮件列表上看到过这个主题...
http://grails .1312388.n4.nabble.com/Incremental-Deployment-td3066617.html
...他们建议使用 rsync 或xdelta3 仅传输更新的文件。没试过,但可能对你有帮助?
I remember seeing this subject on the mailing list...
http://grails.1312388.n4.nabble.com/Incremental-Deployment-td3066617.html
...they recommend using rsync or xdelta3 to only transfer updated files. Haven't tried it, but it might help you?
也许 Cloudfoundry Micro Cloud 是一个选项,部署仅传输增量而不是整个 war 文件。
Maybe the Cloudfoundry Micro Cloud is an option, a deployment just transfers the deltas and not the whole war file.