简体   繁体   中英

AWS CodeDeploy says script missing even though it exists

I am trying to deploy an application onto EC2 instances with AWS CodeDeploy. I am getting up to the point where CodeDeploy errors out at the BeforeInstall hook. The error message I am getting is related to a ScriptMissing . The exact error is:

Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/1bfe51a8-151a-4366-8a3f-c061adb4bb90/d-X8N0B5IOE/deployment-archive/scripts\codedeploy\install_dependencies.sh

The odd thing is the file exists in my version control repository. So far I have tried changing the permissions of the script, and have also tried different method in the appspec.yml file in order to get CodeDeploy to recognize this file. All methods have failed. I tried the other solutions posted relating to this scenario but they do not seem to help me.

Do these script files int he appspec.yml also need to part of the zip file that CodeDeploy uses? Any advice would be appreciated. Below is the appspec.yml file.

Appspec

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/html
    overwrite: true

hooks:
  BeforeInstall:
    - location: scripts/codedeploy/install_dependencies.sh
      timeout: 300
      runas: root
  AfterInstall:
    - location: scripts/codedeploy/install_composer_dependencies.sh
      timeout: 300
      runas: root
    - location: scripts/codedeploy/start_server.sh
      timeout: 30
      runas: root
  ApplicationStop:
    - location: scripts/codedeploy/stop_server.sh
      timeout: 30
      runas: root

I had a similar problem. My paths was scripts/file-name.sh . I just removed 'scripts/' from location path and leave only.sh file names and it works for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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