[英]Angular 4 Production Deployment Workflow
I have a lengthy discussion with a colleague about how we should deploy our angular 4 app to production server. 我和一位同事进行了很长的讨论,讨论如何将angular 4应用程序部署到生产服务器。
Would like practical advise and guide on this issue from the community, if possible. 如果可能,希望社区提供有关此问题的实用建议和指南。
Premise 1 前提1
At production server, 在生产服务器上,
git pull
npm install
{set up production configuration}
ng build --prod --aot
Premise 2 前提2
At production server, 在生产服务器上,
git pull
The best way to do it, is to build and compile in the local development Workstation, and deploy only the output of the build. 最好的方法是在本地开发工作站中构建和编译,并仅部署构建的输出。
The git repo master branch needs to contain the source code not the only compiled&built one. git repo master分支需要包含源代码,而不是唯一编译和构建的源代码。
You can deploy in the production server using other method rather then the git pull command but if you insist on using it, you can init a new repo in the /build file and pull this repo to the production server. 您可以使用其他方法而不是git pull命令在生产服务器中进行部署,但是如果您坚持使用它,则可以在/ build文件中初始化一个新的存储库,然后将该存储库拉到生产服务器。
If you really can't afford the build farm yet and if it enables the testing or other activites, yeah sure. 如果您真的负担不起构建服务器场,并且可以启用测试或其他活动,那么可以。 Test the workflow you describe and see it for yourself, but it's definitely not a good long term practice.
测试您描述的工作流程并亲自查看,但这绝对不是一个好的长期实践。
If eventually you're gonna use the CI in your workflow, I would suggest to just start trying to set it up instead of wasting time/money setting up something temporary. 如果最终您将在工作流中使用CI,我建议您开始尝试进行设置,而不要浪费时间/金钱来临时设置。 Moreover, 5 minutes isn't a big deal trust me.
而且,5分钟对我来说并不重要。
As a side note: If you would have spent time trying your suggestion instead of writing your SO question and talking with your colleague, you probably would already have figured out the answer yourself. 附带说明:如果您将时间花在尝试您的建议上,而不是写下您的SO问题并与同事交谈,您可能已经自己想出了答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.