'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:
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!
Solution 1:[1]
If you are using Windows, it looks like scripts lose their executable bit when packing/unpacking them.
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
Solution 2:[2]
First of all do not put you .sh files in .ebextensions folder. Create a separate folder in your app root and put it there. And update the .config file with following:
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Daniel Compton |
| Solution 2 | Nabeel |
