如何在客户处升级/更新 Web Java 项目?
假设我们正在开发一个新的客户端/服务器 Java Web 应用程序。我们最终发布了1.0版本并出售给少数客户。客户在他们的服务器上自行部署了我们的项目。一段时间后,我们发现了一些错误,我们想更新我们的应用程序。
是否有任何框架/技术/模式/库/服务器可以帮助开发可以自动更新的应用程序,包括以下步骤:
- 复制新项目版本
- 取消部署旧版本
- 部署新版本
- 更新数据库
目前我们有VPN客户和我们正在手动执行上述所有步骤。 是否可以将我们的客户端版本与我们的存储库同步?
Let say we are developing a new client/server Java web application. We finally released 1.0 version and sold to few clients. Clients deployed our project on their own at their servers. After some time we found a few bugs and we would like to update our application.
Is there any framework / technology / pattern / library / server that can help in developing app that can update itself automatically including such steps:
- copying new project release
- undeploying old release
- deploying new release
- updating db
At the moment we have vpn to our clients and we are doing all above steps manually.
Is it possible to synchronize our clients version with our repositiory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您所说的技术是安装程序。并且存在应用程序安装程序框架。
然而,当您的应用程序将重要状态存储在数据库或其他任何内容中时,自动迁移数据是棘手且有风险的......并且在通用安装程序产品的上下文中几乎不可能做到。如果您的应用程序可以由客户定制,情况也是如此。 (自定义总是有可能破坏您的自动迁移代码。)
现在,如果您当前手动执行的步骤很简单,并且不需要针对不同的客户站点进行调整,那么自动化是可能的。但您需要确保拥有防弹机制来备份客户当前的安装和数据,并在自动升级过程失败时(如有必要)恢复它。
The technology you are talking about is an installer. And application installer frameworks exist.
However, when you application stores important state in a database or whatever, automating the migration of the data is tricky and risky ... and next to impossible to do in the context of a generic installer product. The same is true if your application can be customized by your customers. (There is always a chance that the customization will break your automated migration code.)
Now, if the steps that you currently perform manually are straightforward, and don't need to be adapted for different customer sites, then automation may be possible. But you need to make sure that you have a bomb-proof mechanism for backing up the customer's current installation and data and (if necessary) restoring it when your automated upgrade procedure fails.
JavaWebstart 可以帮助部署客户端,但是如果数据库还需要升级,我认为除非所有客户端都关闭,否则无法安全完成。
JavaWebstart can help to deploy the client, but if the database also needs an upgrade, I don't think it can be done safely unless all clients are closed.
对于数据库部分,您可以使用 liquibase。 Liquibase 是一个用于管理数据库迁移(将数据库升级到更新版本)的 Maven 插件/库。使用 liquibase 执行此操作的一种方法是部署一个特殊的 servlet,它将查询包含当前数据库版本的架构表。
如果您可以执行远程部署(例如:通过 tomcat 管理界面或任何其他界面),您始终可以设置一个自定义脚本来为您执行部署。然后,您可以将此脚本提供给客户,以便他们可以按照自己的计划应用更新。
我不建议在有可用更新时立即向客户推出更新,因为他们(和您)可能不想立即更新它们。
For the DB part, you can use liquibase. Liquibase is a maven plugin/lib to manage database migrations (upgrading your database to more recent versions). One way to do this with liquibase is to deploy a special servlet that will inquire a schema-table that contains the current db version.
If you can perform a remote deploy (eg: via tomcat admin interface or any other), you can always set up a custom script that performs the deploy for you. You can then offer this script to the client so they can apply the updates following their own schedule.
I don't recommend immediately rolling out updates to clients whenever they are available simply because they (and you) may not want to update them immediately.