I have the following defined in the appspec file -
hooks:
AfterInstall:
- location: afterInstall.sh
Following is the content of afterInstall.sh (I am trying to invoke a php file from the sh file) -
php afterInstall.php
Both the files afterInstall.sh and afterInstall.php are at the same level (outermost level) in the zip archive that I am uploading to S3 -
appspec.yml
afterInstall.sh
afterInstall.php
I am getting the following error -
Error Code ScriptFailed
Script Name afterInstall.sh
Message Script at specified location: afterInstall.sh failed with exit code 1
Log Tail LifecycleEvent - AfterInstall
Script - afterInstall.sh
[stderr]Could not open input file: afterInstall.php
I also tried by adding the following to the permissions section of the apppsec file -
permissions:
- object: .
pattern: "**"
owner: sandeepan
group: sandeepan
mode: 777
type:
- file
Note - I have the login credentials of the deployment instances using the sandeepan
user.
I am a bit confused with what exactly the permissions section does. From http://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref-permissions.html,
The permissions section specifies how special permissions, if any, should be applied to the files and directories/folders in the files section after they are copied to the instance.
I also tried by specifying owner/group as root/root and runas: root against the afterInstall hook, but still getting the same error.
Update
I also tried by specifying the afterInstall.php file in the files section, and ensuring its permission and ownerships are correct -
- source: afterInstall.php
destination: /var/cake_1.2.0.6311-beta
At /var/cake_1.2.0.6311-beta -
-rwxrwxr-x 1 sandeepan sandeepan 26 Aug 1 08:55 afterInstall.php
I have no other clue what else should be done to fix this.
Note - I am able to deploy successfully if I do not call a php file from the afterInstall.sh