7

No matter what I put inside the stop_server file the CodeDeploy ends up with the error as above. I even commented out all the lines to simplify debugging, so now it looks inside like this

#!/bin/bash
# pkill -f node

My appspec.yml:

version: 0.0
os: linux
files:
  - source: /app.js
    destination: /home/ec2-user/node-website
  - source: /package.json
    destination: /home/ec2-user/node-website
  - source: /public/
    destination: /home/ec2-user/node-website/public
  - source: /node_modules
    destination: /home/ec2-user/node-website/node_modules

permissions:
  - object: /
      pattern: "**"
      owner: ec2-user
      group: ec2-user

hooks:
  AfterInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: ec2-user
    #- location: scripts/codestar_remote_access
    #  timeout: 300
    #  runas: ec2-user
    - location: scripts/start_server
      timeout: 300
      runas: ec2-user

  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: ec2-user

Any sugestions highly appreciated!

0

2 Answers 2

3

When you do a deployment, it will actually use the ApplicationStop from your last successful deployment, not your current deployment. I resolved the problem by deleting the application that I have problem with and creating a new one.

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

1 Comment

Thanks for sharing this. It took me a while to figure that out. It's possible to redeploy ignoring errors from stop script. With AWS cli: aws deploy create-deployment --ignore-application-stop-failures, AWS web console offers a toggle too. So no need to delete the app per se.
0

You can check the code-deploy logs to find more details, the logs is normally located in:

/opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log 

Find more detailed error logs and let me know if you still cannot figure it out

2 Comments

i dont have this folder of logs why still i have /opt/codedeploy-agent/deployment-root
@shareef you need to clean up everything inside that folder. use sudo rm -r -f * and restart the codedeploy-agent again.

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.