Elastic Beanstalk 平台挂钩失败并显示 "permission denied"
Elastic Beanstalk platform hook fails with "permission denied"
部署 Elastic Beanstalk 应用程序时,我的一个挂钩失败并显示“权限被拒绝”。我在 /var/log/eb-engine.log
中得到以下内容:
[INFO] Running platform hook: .platform/hooks/predeploy/collectstatic.sh
[ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPreDeployHooks]. Stop running the command. Error: Command .platform/hooks/predeploy/predeploy.sh failed with error fork/exec .platform/hooks/predeploy/predeploy.sh: permission denied
我该如何解决这个问题?
根据 the docs,平台挂钩需要可执行。值得注意的是,这意味着它们需要根据 git 可执行,因为这是 Elastic Beanstalk 用于部署的内容。
您可以通过 git ls-files -s .platform
; you should see 100755
before any shell files in the output of this command. If you see 100644
before any of your shell files, run git add --chmod=+x -- .platform/*/*/*.sh
检查它们是否可执行以使其可执行。
以正确的顺序在 .ebextensions 文件夹下创建一个文件,并将其命名为:001_chmod.config
# This command finds all the files within hooks folder with extension .sh and makes them executable.
container_commands:
01_chmod1:
command: find .platform/hooks/ -type f -iname "*.sh" -exec chmod +x {} \;
部署 Elastic Beanstalk 应用程序时,我的一个挂钩失败并显示“权限被拒绝”。我在 /var/log/eb-engine.log
中得到以下内容:
[INFO] Running platform hook: .platform/hooks/predeploy/collectstatic.sh
[ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPreDeployHooks]. Stop running the command. Error: Command .platform/hooks/predeploy/predeploy.sh failed with error fork/exec .platform/hooks/predeploy/predeploy.sh: permission denied
我该如何解决这个问题?
根据 the docs,平台挂钩需要可执行。值得注意的是,这意味着它们需要根据 git 可执行,因为这是 Elastic Beanstalk 用于部署的内容。
您可以通过 git ls-files -s .platform
; you should see 100755
before any shell files in the output of this command. If you see 100644
before any of your shell files, run git add --chmod=+x -- .platform/*/*/*.sh
检查它们是否可执行以使其可执行。
以正确的顺序在 .ebextensions 文件夹下创建一个文件,并将其命名为:001_chmod.config
# This command finds all the files within hooks folder with extension .sh and makes them executable.
container_commands:
01_chmod1:
command: find .platform/hooks/ -type f -iname "*.sh" -exec chmod +x {} \;