【问题标题】:Elastic Beanstalk not executing hooks: "skipping hooks scripts under /opt/elasticbeanstalk/hooks/"Elastic Beanstalk 未执行挂钩:\"跳过 /opt/elasticbeanstalk/hooks/\ 下的挂钩脚本"
【发布时间】:2022-05-28 16:02:07
【问题描述】:

我正在尝试让 Elastic Beanstalk(Amazon Linux 2、Node.js 16)运行一些预部署挂钩。我正在使用 .ebextensions 在 /opt/elasticbeanstalk/hooks/ 中创建一个挂钩。

在 .ebextensions 中,我有一个文件 04_use_yarn.config:

files:
    \"/opt/elasticbeanstalk/hooks/appdeploy/pre/49yarn.sh\":
        mode:    \"000775\"
        owner:   root
        group:   users
        content: |
            #!/bin/bash

            # <Contents of the script I\'m trying to run>

当 SSH 进入实例时,我可以看到 /opt/elasticbeanstalk/hooks/appdeploy/pre/ 中的 49yarn.sh 文件已正确生成。但是在部署过程中,我看到它记录了 \"[警告] 跳过 /opt/elasticbeanstalk/hooks/ 下的钩子脚本\"。我找不到任何关于是什么让它跳过该目录中的钩子的文档。

我怎样才能让它不跳过我的钩子?

以下是来自 eb-engine.log 的相关日志:

2022/05/26 20:28:29.538686 [INFO] Executing instruction: StageApplication
2022/05/26 20:28:30.060239 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2022/05/26 20:28:30.060268 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2022/05/26 20:28:36.070529 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2022/05/26 20:28:36.176851 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2022/05/26 20:28:36.176873 [WARN] skipping hooks scripts under /opt/elasticbeanstalk/hooks/
2022/05/26 20:28:36.176890 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2022/05/26 20:28:36.176934 [INFO] The dir .platform/hooks/prebuild/ does not exist
2022/05/26 20:28:36.176946 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/prebuild

    标签: amazon-web-services amazon-ec2 amazon-elastic-beanstalk amazon-linux-2


    【解决方案1】:

    根据documentation

    在 Amazon Linux 2 平台上,/opt/elasticbeanstalk/hooks/ 文件夹中的自定义平台挂钩已完全停用。Elastic Beanstalk 不会读取或执行它们。

    这就是跳过脚本的原因。

    您将需要迁移到 platform hooks

    【讨论】:

      猜你喜欢
      • 2014-07-09
      • 2016-02-27
      • 2020-10-18
      • 1970-01-01
      • 2018-07-11
      • 2012-11-13
      • 2011-11-06
      • 1970-01-01
      相关资源
      最近更新 更多