Coldfusion Report Builder - 如何在 prod/staging/dev 之间从外部设置不同的数据源?
Coldfusion Report Builder 非常棒。
一个小问题。我们使用ANT+CFANT来部署。
当我们创建报告时,假设在开发盒上名为 MyApp_dev 的数据源中。
我们的另一台服务器是生产服务器。它还包含一个暂存版本,以确保在我们发布上线之前一切顺利。 (感谢 Al Everett 让我注意到这一澄清。)
创建报告后,一切都运行良好。
我们将报告部署到临时服务器,该服务器具有 MyApp_Staging 数据源。该服务器也可能或可能没有在 MyApp_Live 下运行实时应用程序。 Ant 将更新推送到 Staging 非常棒。
运行报告,崩溃并烧毁。为什么?
尽管应用程序正在使用 MyApp_Staging 数据源,但报告似乎正在寻找 MyApp_Dev 数据源。
在挖掘过程中,我发现了一些方法,我想从一开始就采用这种最终的、理想的方法,而不是当我有一个新的啊哈时必须回去做几十份不同的报告!片刻。
1) 显而易见:将数据源传递到 cfreport 标记中。不适用于 v8 或 v9(在 Linux 上测试)的 ColdFusion Builder Reports。
2) 迄今为止最现实的选择(但痛苦):将查询作为对象传递到 ColdFusion Builder 报告中。让我们考虑一下:
- 在我的本地机器上使用 RDS 等,使用报告生成器创建报告。
- 完成后,将查询复制到代码片段中,或复制到数据库列中,以便在运行时使用正确的数据源动态注入。
- 修改我的“运行报告”事件以从数据库列中查找查询,将其插入到另一个动态 cfquery 中,并可能...评估(!?!)它?有趣的一面是我可以将 cfquery 数据源设置为每个环境所需的数据源。
- 当我在 CF Report Builder 中修改报告的列时,我总是必须更新数据库中的查询。有一段代码可以为我提取这个吗?唔。
3) 不太理想。忍住,让暂存中的所有报告在实时服务器上运行。也许将实时数据复制到暂存中(无结构变化)以使其看起来相似。
有什么雄辩的方法可以实现上述目标吗?
提前致谢!
Coldfusion Report Builder is great.
One small issue. We use ANT+CFANT to deploy.
When we create the report, say in a datasource called MyApp_dev on a dev box.
Our other server is the production server. It also contains a staging build to ensure everything is going smoothly before we publish to live. (thanks to Al Everett for bringing this clarification to my attention.)
Everything works great when the report is created.
We deploy the report to our staging server, which has a datasource of MyApp_Staging. That server also, may or may not, have the live app working under MyApp_Live. Ant pushes the update to Staging just great.
Run the report, crashes and burns. Why?
It seems the report is looking for the MyApp_Dev data_source, even though the application is using the MyApp_Staging datasource.
In digging around I found a few approaches, I would like to do this one, final, ideal way from the beginning instead of having to go back to do dozens of reports differently when I have a new Aha! moment.
1) Obvious: Pass in the datasource in to the cfreport tag. Doesn't work for ColdFusion Builder Reports as of v8, or v9 as tested on Linux.
2) Most realistic option (but painful) so far: Pass in the query as an object into the ColdFusion Builder report. Let's think about this:
- Create the Report with the report builder to my heart's content using the RDS, etc on my local box.
- When I'm done, copy the query into a snippet of code, or into a database column to be dynamically be injected at runtime with correct datasource.
- Modify my "run report" event to find the query from the database column, insert it into another dynamic cfquery and potentially... evaluate (!?!) it? Fun side is I can set the cfquery datasource to what I would need for each environment.
- When I modify the report's columns in CF Report Builder, I always have to update the query in the database. Is there a snippet of code that can extract this for me? Hmm.
3) Less than ideal. Suck it up and let all the reports in staging run off the live server. Maybe copy the live data into staging (sans structural changes) to let it seem similar.
Are there any eloquent ways to accomplish the above?
Thanks in Advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有不同的开发/登台/生产设备,为什么不在每个设备上使用相同的数据源名称呢?这将使您免于让代码找出它在哪里。
由于我当前任务的安全问题使我无法使用 RDS,因此我理所当然地使用选项 2。我也喜欢它,因为它更容易调试。
If you have different dev/staging/production boxes, why not just use the same datasource name on each? That'll save you from having the code figure out where it is.
Because security concerns at my current assignment preclude me from using RDS, I use option 2 as a matter of course. I also like it as it makes it easier to debug.