简体   繁体   English

EB 无法访问文件 in.ebextensions

[英]EB not able to access file in .ebextensions

I have the following container_command in my django.config that points to a script at path .ebextensions/supervise.sh :我的django.config中有以下container_command ,它指向路径.ebextensions/supervise.sh中的脚本:

container_commands:
  01-supervise:
    command: .ebextensions/supervise.sh

However when I deploy I get a permission error.但是,当我部署时,出现权限错误。 Command failed on instance. Return code: 126 Output: /bin/sh: .ebextensions/supervise.sh: Permission denied.

I'm wondering what is required to set permissions correctly?我想知道正确设置权限需要什么? What is causing this error?是什么导致了这个错误? As far as I can tell the issue isn't well documented.据我所知,这个问题没有得到很好的记录。 Thanks!谢谢!

If you are using Windows, it looks like scripts lose their executable bit when packing/unpacking them. 如果您使用的是Windows,则脚本在打包/解压缩时似乎会丢失其可执行位。

Try resetting the executable bit before running them: 在运行可执行文件之前,请尝试将其重置:

container_commands:
  01-set-exec-bit:
    command: chmod +x .ebextensions/deployschema.sh
    test: "[ -f .ebextensions/deployschema.sh ]"
  02-create-table:
    command: ".ebextensions/deployschema.sh"
    leader_only: true

From: https://forums.aws.amazon.com/thread.jspa?threadID=262121 来自: https : //forums.aws.amazon.com/thread.jspa?threadID=262121

First of all do not put you.sh files in.ebextensions folder.首先不要将.sh 文件放在.ebextensions 文件夹中。 Create a separate folder in your app root and put it there.在您的应用程序根目录中创建一个单独的文件夹并将其放在那里。 And update the.config file with following:并使用以下内容更新 .config 文件:

container_commands:
  01-supervise:
    command: "sh scripts/supervise.sh"

I know i am late in answering this but hopefully this will help someone struggling with this.我知道我迟迟不能回答这个问题,但希望这能帮助那些为此苦苦挣扎的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM