Elasticbean Talk中命令和容器命令之间的区别是什么

问题描述:

在aws Elasticbean谈话中.

In aws elasticbean talk.

当我们在.ebextensions中设置扩展名

When we setup extensions in .ebextensions

我想知道commandscontainer_commands

我的命令就是这样

container_commands:
  04_insert_app:
    command: "cat .ebextensions/insertapp_job.txt > /etc/cron.d/insertapp_job && chmod 644 /etc/cron.d/insertapp_job"
    leader_only: true

container_commands有效.

container_commands is work.

命令:找不到错误.ebextensions/insertapp_job.txt

这两部分之间的主要区别是在Elastic Beanstalk部署过程中何时运行它们.

The major difference between these two pieces is when in the Elastic Beanstalk deployment process they are run.

这些命令在部署过程的早期,在设置Web服务器之前以及在解压缩应用程序代码之前运行:

These commands are run early in the deployment process, before the web server has been set up, and before your application code has been unpacked:

这些命令按名称的字母顺序进行处理,它们在设置应用程序和Web服务器并提取应用程序版本文件之前运行.默认情况下,命令在根用户的主文件夹中运行.可以通过与命令一起传递的选项(工作目录,是否继续出错,环境变量传递给命令等)来更改EB的这种行为以及其他各种行为.

By default, the commands run in the root user's home folder. This and various other pieces of EB's behavior can be changed via options (working directory, whether to continue on error, environment variables to pass to commands, etc.) that can be passed along with the command.

这些命令在部署过程的稍后部分,设置Web服务器之后,将您的应用程序代码解压缩到暂存文件夹之后,但在部署"应用程序之前(通过移动暂存文件夹)运行到其最终位置):

These commands are run later in the deployment process, after the web server has been set up, and after your application code has been unpacked to the staging folder, but before your application has been "deployed" (by moving the staging folder to its final location):

容器命令在设置了应用程序和Web服务器并提取了应用程序版本存档之后但在部署应用程序版本之前运行.在提取应用程序源代码之前,先执行非容器命令和其他自定义操作.默认情况下,这些命令在暂存文件夹中运行,因此,在部署应用程序后,对当前文件夹所做的任何更改都将保留(尽管路径会更改,因此请注意相对链接!).

By default, these commands run in the staging folder, so that any changes you make to the current folder will persist once your application is deployed (the path will change though, so be careful about relative links!).

容器命令支持与(非容器)命令相同的所有选项,但它们还支持"leader_only"选项:

Container commands support all the same options as (non-container) commands, but they also support a "leader_only" option:

您可以使用leader_only仅在单个实例上运行命令,或将测试配置为仅在测试命令评估为true时运行命令.仅领导者的容器命令仅在环境创建和部署期间执行,而其他命令和服务器自定义操作则在每次供应或更新实例时执行.2