简体   繁体   English

部署:是否在生产机器上构建?

[英]Deployment: Build on production machine or not?

I have an automated deployment process for a Java app where currently I'm building the app on a build machine, checking the build into scm, and having the production machine pull the build artifact (which is a zip) and through ant move the class and config files to where they're supposed to be. 我有一个Java应用程序的自动化部署过程,当前在该应用程序上,我是在构建机器上构建应用程序,将构建检查到scm中,并让生产机器拉出构建工件(即zip),并通过ant移动类和配置文件到他们应该在的位置。

I've seen other strategies where the production machine pulls the source from scm and builds it itself. 我已经看到了其他策略,其中生产机器从scm提取源并自行构建。

The thing I don't like about the former approach is that if I'm building for production instead of staging or dev or whatever, I have to manually specify the env in the build. 对于前一种方法,我不喜欢的是,如果我要为生产而构建,而不是暂存或开发等,则必须在构建中手动指定env。 If the target server were in charge of this, though, there would be less thought and friction involved in the build. 但是,如果目标服务器负责此工作,则构建过程中的想法和摩擦会更少。 However, I also like using the exact same build as was being tested on staging. 但是,我也喜欢使用与分阶段测试完全相同的构建。

So, I guess my question is, is it preferred to copy the already build/already tested app to production or to have production build the app again once it's been tested. 因此,我想我的问题是,是将已构建/已经测试过的应用复制到生产环境中,还是在测试完成后让生产部门再次构建该应用程序?

If you already have an automated build system that is creating a testing build, how hard is it to extend that so that it builds both a testing build and a production build at the same time. 如果您已经有一个自动构建系统正在创建测试构建,那么扩展它的难度有多大,以便它可以同时构建测试构建和生产构建。 This way you get the security of knowing they were built from the exact same checked out source and you have less manual labor. 这样一来,您便可以安全地知道它们是由完全相同的签出源构建而成的,并且您的手工劳动更少。 I really cringe at the idea of checking built artifacts into SCM! 我真的很想将内置工件检入SCM的想法!

我始终喜欢在生产服务器上尽量减少人为操作-少更新,少出错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM