AWS Elastic Beanstalk Amazon Linux 2 - 如何设置自定义 NodeCommand
AWS Elastic Beanstalk Amazon Linux 2 - How to set a custom NodeCommand
Migrating your Elastic Beanstalk Linux application to Amazon Linux 2 - AWS Elastic Beanstalk
根据文档,不再支持 aws:elasticbeanstalk:container:nodejs
命名空间,设置 NodeCommand
的新方法是“在 package.json 文件中使用 Procfile 或脚本关键字指定启动脚本。".
我从来没有处理过 Procfiles,“package.json 文件中的脚本关键字”部分不是很清楚,他们是按顺序执行脚本,直到出现问题还是什么?
有人知道如何在 Amazon Linux2 中设置自定义 NodeCommand 吗?
您可以在 package.json
中使用 script 选项。例如,如果您启动 EB 提供的示例 node.js 应用程序,则文件为:
package.json
{
"name": "Elastic-Beanstalk-Sample-App",
"version": "0.0.1",
"private": true,
"dependencies": {},
"scripts": {
"start": "node app.js"
}
}
更新
Docs 有如何使用 Procfile:
的示例
You can add a Procfile to your source bundle to specify the command that starts your application, as the following example shows. This feature replaces the legacy NodeCommand option in the aws:elasticbeanstalk:container:nodejs namespace.
web: node index.js
When you don't provide a Procfile, Elastic Beanstalk runs npm start if you provide a package.json file. If you don't provide that either, Elastic Beanstalk looks for the file app.js or server.js, in this order, and runs it.
Migrating your Elastic Beanstalk Linux application to Amazon Linux 2 - AWS Elastic Beanstalk
根据文档,不再支持 aws:elasticbeanstalk:container:nodejs
命名空间,设置 NodeCommand
的新方法是“在 package.json 文件中使用 Procfile 或脚本关键字指定启动脚本。".
我从来没有处理过 Procfiles,“package.json 文件中的脚本关键字”部分不是很清楚,他们是按顺序执行脚本,直到出现问题还是什么?
有人知道如何在 Amazon Linux2 中设置自定义 NodeCommand 吗?
您可以在 package.json
中使用 script 选项。例如,如果您启动 EB 提供的示例 node.js 应用程序,则文件为:
package.json
{
"name": "Elastic-Beanstalk-Sample-App",
"version": "0.0.1",
"private": true,
"dependencies": {},
"scripts": {
"start": "node app.js"
}
}
更新
Docs 有如何使用 Procfile:
的示例You can add a Procfile to your source bundle to specify the command that starts your application, as the following example shows. This feature replaces the legacy NodeCommand option in the aws:elasticbeanstalk:container:nodejs namespace.
web: node index.js
When you don't provide a Procfile, Elastic Beanstalk runs npm start if you provide a package.json file. If you don't provide that either, Elastic Beanstalk looks for the file app.js or server.js, in this order, and runs it.