我有一个运行PHP的弹性beanstalk环境。在我的项目中,我有一个.ebextensions文件夹和一个名为'15 -memorymonitor.config'的文件,其中包含以下内容;
container_commands:
00download:
command: "wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip"
ignoreErrors: true
01extract:
ignoreErrors: true
02rmzip:
command: "rm CloudWatchMonitoringScripts-v1.1.0.zip"
ignoreErrors: true
03cdinto:
command: "mv aws-scripts-mon/ /home/ec2-user"
ignoreErrors: true
04cron:
command: "crontab -l | { cat; echo '* * * * * /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --mem-avail'; } | crontab -"
ignoreErrors: false
问题是在部署应用程序时,这些命令似乎都没有执行。我已经检查了cfn.init文件,以获取配置文件中命令的引用,但没有。
这是cfn.init文件的内容。
2017-01-03 15:02:21,666 [INFO] -----------------------Starting build-----------------------
2017-01-03 15:02:21,689 [INFO] Running configSets: _OnInstanceBoot
2017-01-03 15:02:21,690 [INFO] Running configSet _OnInstanceBoot
2017-01-03 15:02:21,692 [INFO] Running config AWSEBBaseConfig
2017-01-03 15:02:21,697 [INFO] Command clearbackupfiles succeeded
2017-01-03 15:02:21,744 [INFO] Running config AWSEBMessageOfTheDay
2017-01-03 15:02:21,749 [INFO] Command 01clearoriginal succeeded
2017-01-03 15:02:21,753 [INFO] Command 02createbanner succeeded
2017-01-03 15:02:21,809 [INFO] Command 03updatebanner succeeded
2017-01-03 15:02:21,815 [INFO] Running config AWSEBULimitConfig
2017-01-03 15:02:21,818 [INFO] Command 00removebackup succeeded
2017-01-03 15:02:21,823 [INFO] Running config Infra-InstallContainerHooksPkg
2017-01-03 15:02:21,827 [INFO] Command 00mkdir succeeded
2017-01-03 15:02:21,939 [INFO] Command 01download_container_hooks succeeded
2017-01-03 15:02:21,976 [INFO] Command 02install_container_hooks succeeded
2017-01-03 15:02:21,980 [INFO] Command 03cleanup succeeded
2017-01-03 15:02:21,986 [INFO] Running config Infra-WriteLeaderTestScript
2017-01-03 15:02:21,991 [INFO] Running config Infra-WriteTailLogsConf
2017-01-03 15:02:21,996 [INFO] Running config Infra-WriteSystemTailLogsConf
2017-01-03 15:02:22,002 [INFO] Running config Infra-WriteBundleLogsConf
2017-01-03 15:02:22,006 [INFO] Running config Infra-WritePublishLogsConf
2017-01-03 15:02:22,009 [INFO] Running config Infra-WritePublishLogsCron
2017-01-03 15:02:22,011 [INFO] ConfigSets completed
2017-01-03 15:02:22,099 [INFO] -----------------------Build complete-----------------------
2017-01-03 15:02:50,301 [INFO] -----------------------Starting build-----------------------
2017-01-03 15:02:50,397 [INFO] Running configSets: Infra-EmbeddedPreBuild
2017-01-03 15:02:50,398 [INFO] Running configSet Infra-EmbeddedPreBuild
2017-01-03 15:02:50,398 [INFO] ConfigSets completed
2017-01-03 15:02:50,401 [INFO] -----------------------Build complete-----------------------
2017-01-03 15:02:52,690 [INFO] -----------------------Starting build-----------------------
2017-01-03 15:02:53,496 [INFO] Running configSets: Infra-EmbeddedPostBuild
2017-01-03 15:02:53,497 [INFO] Running configSet Infra-EmbeddedPostBuild
2017-01-03 15:02:53,497 [INFO] ConfigSets completed
2017-01-03 15:02:53,500 [INFO] -----------------------Build complete-----------------------
2017-01-03 15:09:21,577 [INFO] -----------------------Starting build-----------------------
2017-01-03 15:09:21,599 [INFO] Running configSets: Infra-EmbeddedPreBuild
2017-01-03 15:09:21,600 [INFO] Running configSet Infra-EmbeddedPreBuild
2017-01-03 15:09:21,600 [INFO] ConfigSets completed
2017-01-03 15:09:21,603 [INFO] -----------------------Build complete-----------------------
2017-01-03 15:09:24,358 [INFO] -----------------------Starting build-----------------------
2017-01-03 15:09:24,472 [INFO] Running configSets: Infra-EmbeddedPostBuild
2017-01-03 15:09:24,473 [INFO] Running configSet Infra-EmbeddedPostBuild
2017-01-03 15:09:24,473 [INFO] ConfigSets completed
2017-01-03 15:09:24,475 [INFO] -----------------------Build complete-----------------------
有谁知道为什么这些命令不会执行?
我通过AWS Web控制台部署我的应用程序(作为zip文件)。
答案 0 :(得分:1)
我设法解决了这个问题。我正在通过AWS控制台部署我的应用程序,由于某种原因,它没有提取配置文件。
为了使它工作,我通过eb cli工具部署了应用程序,而且它有效!
您可以在下面的链接中阅读有关eb cli的更多信息; http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html