0

I'm trying to deploy my spring boot application with AWS CodeDeploy in a EC2 linux machine but the process is stoping in BeforeInstall and throwing the message error: Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/eb41ddde-ad23-492e-b3a0-203e1f77fb93/d-JIGRR5O5J/deployment-archive/server_clear.sh

my appspec.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ec2-user/server
permissions:
  - object: /
    pattern: "**"
    owner: ec2-user
    group: ec2-user
hooks:
  BeforeInstall:
    - location: script/server_clear.sh
      timeout: 300
      runas: ec2-user
  AfterInstall:
    - location: fix_privileges.sh
      timeout: 300
      runas: ec2-user
  ApplicationStart:
    - location: server_start.sh
      timeout: 20
      runas: ec2-user

  ApplicationStop:
    - location: server_stop.sh
      timeout: 20
      runas: ec2-user

buildspec.yml

version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto11
  build:
    commands:
      - mvn clean install
  post_build:
    commands:
      - echo Build completed
artifacts:
  files:
    - target/*.jar
    - scripts/*.sh
    - appspec.yml
  discard-paths: yes
2
  • Well, does the file exist or not? Only you can check that. Commented Aug 2, 2022 at 0:23
  • Yes, the appspec.yml file exists and I think the script should be in the appspec but I'm gettingh this error message when starting the pipeline Commented Aug 2, 2022 at 12:36

1 Answer 1

0

We see you have an AppSpec.yml but you did not mention about "server_clear.sh". Does it exists?

If your answer is not, just create a "script" folder and put a "server_clear.sh" in it with all the commands you need.

If you don't need this, just erase "BeforeInstall" hook from your AppSpec.

It looks like you have copied an AppSpec example but you actually don't need all the hooks it has in it, so you'll have the same problem with the other hooks. If you don't need them, just erase them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.