【问题标题】:Elastic Beanstalk ebextension config not running for new instance in autoscaling groupElastic Beanstalk ebextension 配置未针对自动缩放组中的新实例运行
【发布时间】:2015-05-14 22:04:57
【问题描述】:

希望知道如何解决这个问题!

我有一个在 Elastic Beanstalk 中运行的 .NET Web 应用程序,需要通过 ebextensions 对其进行一些处理。它在创建实例后始终如一地工作,但在创建实例时,似乎存在问题。

在日志文件中,有以下内容:

2015-03-12 15:44:36,901 [INFO] Running config postbuild_0_MyConfig
2015-03-12 15:44:38,309 [ERROR] -----------------------BUILD FAILED!------------------------
2015-03-12 15:44:38,309 [ERROR] Unhandled exception during build: [Error 267] The directory name is invalid
Traceback (most recent call last):
  File "cfn-init", line 123, in <module>
  File "cfnbootstrap\construction.pyc", line 117, in build
  File "cfnbootstrap\construction.pyc", line 502, in build
  File "cfnbootstrap\construction.pyc", line 513, in run_config
  File "cfnbootstrap\construction.pyc", line 125, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 104, in apply
  File "cfnbootstrap\util.pyc", line 468, in call
  File "cfnbootstrap\util.pyc", line 454, in call
  File "subprocess.pyc", line 679, in __init__
  File "subprocess.pyc", line 896, in _execute_child
WindowsError: [Error 267] The directory name is invalid

失败后,我将使用 AWS 控制台中的相同代码版本再次运行部署,我得到:

2015-03-12 16:00:42,526 [INFO] Running config postbuild_0_Umbraco
2015-03-12 16:00:44,558 [INFO] Command 01-changeperm succeeded
2015-03-12 16:00:44,558 [INFO] Waiting 60 seconds for reboot
2015-03-12 16:01:47,322 [INFO] Command 02-createvirtualdirectory succeeded
2015-03-12 16:01:47,338 [INFO] Waiting 60 seconds for reboot

正如预期的那样。

我相信它一定是由于配置文件本身而失败,因为个别命令本身的问题会导致不同的错误。

这是部署到 .ebextensions 文件夹中的我的 .config 文件,以及引用的脚本:

container_commands:
  01-changeperm:
    command: "permissions.bat > ../eblog.log"
    cwd: "C:/inetpub/wwwroot/.ebextensions"
  02-createvirtualdirectory:
    command: "powershell.exe -noprofile -executionpolicy bypass -file ./virtualdir.ps1 > ../vd.log"
    cwd: "C:/inetpub/wwwroot/.ebextensions"

希望有人可以帮助我,因为我不知所措!如果有人想了解更多信息,请问!

提前致谢。

【问题讨论】:

    标签: amazon-web-services amazon-elastic-beanstalk


    【解决方案1】:

    由于 webdeploy 包的部署方式,配置的执行在 Windows 上略有不同。

    因此,您不能指望磁盘上存在的 .ebextensions 文件夹(或捆绑包中的任何内容)中的任何文件(实际上不是从其中执行脚本的位置)。

    .ebextensions 配置中的命令在您的任何位被放置在磁盘上之前执行(甚至是 container_commands)。

    因此,您可能需要内联您的 bat 文件和 ps1 脚本,或者将它们放在 S3 中,然后使用 file: 指令放置它们。

    【讨论】:

    • 您好,谢谢。如果我从 s3 下载文件作为文件部分的一部分,那么它是否可以从容器命令部分访问?获得文件后,亚马逊文档中并不清楚如何运行它。
    • 现在可以正常工作了。是的,container_commands 在 files 指令生成的文件上运行良好。感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 2018-10-13
    • 2018-04-01
    • 2018-01-29
    • 2019-03-07
    • 2014-08-17
    • 2016-04-05
    • 2013-12-04
    • 2017-01-30
    相关资源
    最近更新 更多