如何在生产中将战争部署到tomcat后运行grails命令? [英] How to run grails commands after deploying war to tomcat in production?

查看:158
本文介绍了如何在生产中将战争部署到tomcat后运行grails命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于grail-2.4.5的应用程序。工件(WAR文件)被部署到生产环境中;该应用程序运行良好。现在我想运行一些与数据库迁移插件相关的grails命令:特别是 grails dbm-tag grails dbm-rollback 。我对如何做到这一点感到不知所措。任何建议都将非常受欢迎;有没有更好的方式来做到这一点?



版本:




  • Grails 2.4 .5

  • Tomcat 8.0.24



限制:


  • 这是一个 12因子风格的应用程序,因此不存储任何配置在应用程序或来源;他们被拉出环境。因此必须从环境中运行。
  • 即使配置文件存储在源文件中,生产环境被锁定,我无法连接到外部运行 grails production ...
  • 理想情况下,因为所有这些服务器都由 salt 管理。
  • 最后,只有我们的CI服务器生成的工件( WAR文件)允许升级到上游环境,如stable,staging和production,以确保测试和运行的版本在发布过程中保持一致。


我正在查看的内容:


  • 将生成的WAR文件修改为包含指向grails命令的清单信息在线应用程序。

  • 查看是否可以通过tomcat管理器以某种方式处理此问题。


解决方案

基本上,您需要一种在生产机器上运行grails代码的方法。选项有 - 远程控制插件,控制台插件,具有触发动作的安全端点的定制控制器,甚至可以使用Quartz显示器插件手动启动的自定义Quartz作业。

所有这些问题都是您在生产环境中打开了一个潜在的漏洞。

由于您正在讨论关于数据库操作的问题,您可能还需要有一个未打包的grails应用程序,它连接到生产数据库并从那里运行这些命令。

I have a grail-2.4.5 based application. The artifact, a WAR file, is deployed to production; the application runs great. Now I would like to run some grails commands related to the database-migration plugins: specifically grails dbm-tag and grails dbm-rollback. I'm at a loss at how to do this. Any suggestions would be very welcome; is there a better way to do this?

Versions:

  • Grails 2.4.5
  • Tomcat 8.0.24

Constraints:

  • This is a 12 Factor style application so no configs are stored in the application or source; they are pulled from the environment. So must be run from the environment.
  • Even if the configs for production were stored in the source; the production environment is locked down and I cannot connect to it externally to run grails production ...
  • Ideally, this would be do-able via the command line as all these servers are managed by salt.
  • Finally, only the artifact produced from our CI server (the WAR file) is allowed to be promoted to upstream environments like stable, staging, and production to ensure that versions tested and run are consistent through the release process.

Things I'm looking at:

  • Have the generated WAR file modified to include manifest information pointing to the grails command line app.
  • Seeing if this can be handled through the tomcat manager somehow.

解决方案

Basically, you need a way to run grails code on a production machine. Options are - remote control plugin, console plugin, your custom controller with a secured endpoint that triggers the action or even a custom Quartz job that you can start manually with a Quartz monitor plugin.

The problems with all these is that you are opening a potential vulnerability in your production environment.

Since you are talking about operations on database, you might as well have an unpackaged grails app that connects to the production database and run those commands from there.

这篇关于如何在生产中将战争部署到tomcat后运行grails命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆