我应该对 j2ee 应用程序服务器配置文件实施源代码控制吗?

发布于 2024-07-12 05:53:27 字数 135 浏览 6 评论 0原文

对于典型的 J2EE Web 应用程序,数据源连接设置存储为应用程序服务器配置的一部分。

有没有办法对这些配置细节进行版本控制? 我想要对数据源和其他应用程序服务器配置更改进行更多控制。

这样做的标准做法是什么?

For a typical J2EE web application, the datasource connection settings are stored as part of the application server configuration.

Is there a way to version control these configuration details? I want more control on the datasource and other application server config changes.

What is the standard practice for doing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

初心未许 2024-07-19 05:53:27

通过版本控制跟踪应用程序服务器的配置更改是一件好事。 但是,它确实意味着所有更改都是通过脚本完成的,而不是管理 Web 界面。 我推荐

http://www.ibm .com/developerworks/java/library/j-ap01139/index.html?ca=drs-

作为有关此主题的很好的背景信息文章。

更新:最近,第 2 部分已在此处发布:http://www.ibm.com/developerworks/java/library/j-ap02109/index.html?ca=drs-

Tracking configuration changes to your application server through version control is a good thing to ask for. However, It does imply that all changes are done via scripting, instead of the administrative web interface. I recommend

http://www.ibm.com/developerworks/java/library/j-ap01139/index.html?ca=drs-

as a good background information article on this topic.

Update: Just recently, part 2 has been published here: http://www.ibm.com/developerworks/java/library/j-ap02109/index.html?ca=drs-

土豪 2024-07-19 05:53:27

在使用 WebSphere 时,我们发现最好的方法是编写部署脚本并将脚本置于版本控制之下,并加上每个目标环境的响应文件。

When working with WebSphere we found the best approach was to script the deployment and place the script under version control plus the response files for each of the target environments.

不醒的梦 2024-07-19 05:53:27

Websphere 可能很棘手,因为目录结构是一堆文件 - 通常看起来有重复项,并且很难确定哪个是您需要备份/恢复的神奇文件。 如何解决这个问题的问题不应该削弱这样做的必要性。 ——这是肯定的。

Websphere canbe tricky as the directory structure is a mess of files - often there appears to be duplicates and it's hard to figure which is the magic file you need to backup / restore . The question of how to go about this should not detract from the need to do it. - which is a definite yes.

迷途知返 2024-07-19 05:53:27

我们的(Spring)应用程序在 spring 配置文件中有一个硬编码的 jndi 名称。 这样,同一个 Ear 就可以部署到 dev、qa 和 prod 环境中,并且您不必担心数据库连接细节。

应用程序服务器管理员确保根据该 jndi 名称注册数据源,并使用适合每个环境的连接详细信息。

Our (Spring) apps have a hardcoded jndi name in the spring config file. That way, the same ear can be deployed to dev, qa and prod environments, and you don't have to worry about database connection details.

The app server admins ensure that a datasource is registered against that jndi name, with the connection details as appropriate on each environment.

奶茶白久 2024-07-19 05:53:27

但这如何让我管理应用程序服务器中数据源配置的更改。 下面是一个场景:

  1. DBA 更改数据库服务器的连接密码。

  2. Webspehere/Weblogic 管理员通过管理员控制台对服务器配置进行相应更改。

上述更改不受版本控制,因此没有干净的方法来了解此类更改的历史记录。

问题不在于如何配置应用程序,而在于如何对配置更改进行版本控制。 也许对于简单的项目来说这听起来有点大材小用,但对于某些项目来说,控制这样的变化确实成为一个问题。

But how does this let me manage changes to datasource configurations in the application servers. Here's a scenario:

  1. DBAs change the connection password of the database server.

  2. Webspehere/Weblogic administrator makes corresponding changes to server configuration through administrator console.

The above change is not version controlled so there is no clean way of knowing the history of such changes.

The problem is not about how the application should be configured but about how the configuration changes should be version controlled. Perhaps it sounds like an overkill for simple projects but for some projects, controlling changes like these really becomes a problem.

怼怹恏 2024-07-19 05:53:27

任何时候你问自己“X 是否应该在版本控制中”,默认答案都是“是”。

要获得更精确的答案,请问问自己:该文件是由人创建的(如源文件或文档)还是由另一个程序生成(如目标文件或分发 PDF)?

由人类创建和/或维护的文件应该处于配置控制之下。

Any time you ask yourself "should X be in version control" the default answer is "yes".

For a more refined answer, ask yourself this: is the file created by a person (like a source file or a document) or is it generated by another program (like an object file or a distribution PDF)?

File that are created, and/or maintained, by a human should be under configuration control.

情域 2024-07-19 05:53:27

我们始终对应用程序服务器设置使用版本控制。 它是一个名为 WLST(weblogic 脚本工具)的工具,它是 weblogic 服务器发行版的一部分。 域配置存储在 Jython 脚本中,可以通过命令行轻松执行,因此与我们的构建工具 maven 完美集成。

创建预配置的运行weblogic域只需要执行maven目标。 所有这些恼人的错误配置的 jdbc 连接或错误的 jms 目标参数问题都消失了。 您将始终拥有与给定时间的源代码相匹配的应用程序服务器配置。 您永远不需要记住必须为您正在处理的项目的特定版本应用哪个应用程序服务器设置。

我真的推荐这个。

我还想知道其他应用程序服务器是否有类似的解决方案。 据我所知,有一种通过蚂蚁处理玻璃鱼的方法。 JBoss 如何实现这一目标?

We are always using version control for our app server settings. It's a tool called WLST (weblogic scripting tool) which is part of the weblogic server distribution. The domain configuration is stored within a Jython script, which can easily be executed via command line and therefore integrates superb with our build tool maven.

Creating a preconfigured running weblogic domain only needs to execute a maven goal. All those annoying problems of misconfigured jdbc connections or wrong jms destination parameters are gone. You will always have a appserver configuration which matches the source code at a given time. You will never need to remember which app server setting must be applied for this specific version of the project you are working on.

I really recommend this.

I also would like to know, if there are similar solutions for other application server available. As far as i know there is a way for glassfish via ant. How this can be achieved for JBoss?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文