简体   繁体   English

如何向 AWS CodeDeploy 解释如何部署我的 NodeJS 应用程序?

[英]How to explain to AWS CodeDeploy how to deploy my NodeJS application?

I'm sorry in advance for asking this question, AWS has countless tutorials (and much blogs tackle AWS in general), but I can't put my hand on a simple tutorial on how to explain to CodeDeploy how to deploy my code.我很抱歉提前问了这个问题,AWS 有无数的教程(而且很多博客通常都在讨论 AWS),但是我不能把我的手放在一个简单的教程上,告诉我如何向 CodeDeploy 解释如何部署我的代码。

I'm fairly confident that I understand the basics of EC2, Auto-scaling groups & CodeDeploy, but what I can't find is how to explain to CodeDeploy how to deploy my app.我相当有信心了解 EC2、Auto-scaling 组和 CodeDeploy 的基础知识,但我找不到如何向 CodeDeploy 解释如何部署我的应用程序。 When I use CodeDeploy, I click on a button 'Deploy', but how come CodeDeploy knows what to do?当我使用 CodeDeploy 时,我单击了“部署”按钮,但 CodeDeploy 怎么知道该怎么做?

In order to deploy effectively, CodeDeploy would need to:为了有效部署,CodeDeploy 需要:

  • Pull the source拉取源头
  • Run npm install运行 npm 安装
  • Run npm start运行npm启动

Nothing fancy, but still, I don't know where to explain that.没什么特别的,但我仍然不知道在哪里解释。 My guess is that there's some configuration file somewhere in the project (most likely in yaml format) to specify those intructions but I find no tutorial clearly explaining such thing.我的猜测是项目中某处有一些配置文件(很可能是 yaml 格式)来指定这些指令,但我发现没有教程清楚地解释这种事情。

Just to be clear, I don't want to:为了清楚起见,我不想:

  • Manually connect to my instance to do such instructions, I need them to be automatic手动连接到我的实例以执行此类指令,我需要它们是自动的
  • Use config files to specify architecture params (I use the console for that purpose).使用配置文件来指定架构参数(我为此使用控制台)。 I just want to explain how to run my app.我只想解释如何运行我的应用程序。

Any help would be welcome, and if I'm completely mistaken on how to do such things, please do not hesitate to point me to the right direction!欢迎任何帮助,如果我在如何做这些事情上完全弄错了,请不要犹豫,指出我正确的方向!

My guess is that there's some configuration file我的猜测是有一些配置文件

Yes, that's correct.对,那是正确的。 When you deploy your app, CD will look for appspec.yml which contains all the build and setup instructions for your app on the instances.当您部署您的应用程序时,CD 将查找appspec.yml ,其中包含您的应用程序在实例上的所有构建和设置说明。

So you have to create such a file tailored to your use-case.因此,您必须创建一个适合您的用例的文件。 AWS docs have example for that. AWS 文档有这方面的例子

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

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