我正在嘗試讓 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
uj5u.com熱心網友回復:
根據檔案:
在 Amazon Linux 2 平臺上,檔案夾中的自定義平臺掛鉤
/opt/elasticbeanstalk/hooks/已完全停用。Elastic Beanstalk 不會讀取或執行它們。
這就是跳過腳本的原因。
您將需要遷移到平臺掛鉤。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/482361.html
標籤:亚马逊网络服务 亚马逊-ec2 亚马逊弹性豆茎 amazon-linux-2
下一篇:了解AWSlambda重試機制
