Elastic Beanstalk 未执行挂钩:"skipping hooks scripts under /opt/elasticbeanstalk/hooks/"
Elastic Beanstalk not executing hooks: "skipping hooks scripts under /opt/elasticbeanstalk/hooks/"
我正在尝试让 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 文件已正确生成。但是在部署期间,我看到它记录了“[WARN] skipping hooks scripts under /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
On Amazon Linux 2 platforms, custom platform hooks in the /opt/elasticbeanstalk/hooks/
folder are entirely discontinued. Elastic Beanstalk doesn't read or execute them.
这就是脚本被跳过的原因。
您需要迁移到 platform hooks。
我正在尝试让 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 文件已正确生成。但是在部署期间,我看到它记录了“[WARN] skipping hooks scripts under /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
On Amazon Linux 2 platforms, custom platform hooks in the
/opt/elasticbeanstalk/hooks/
folder are entirely discontinued. Elastic Beanstalk doesn't read or execute them.
这就是脚本被跳过的原因。
您需要迁移到 platform hooks。