Search code examples
amazon-web-servicesaws-code-deploy

AWS Code Deploy appspec isn't starting my server


So I'm using AWS Code deploy... Code makes it to the server just fine, I can see everything is where it needs to be. My appspec.yml looks like this:

version: 0.0
os: linux
files:
  - source: ./
    destination: /dmi
hooks:
  ApplicationStart:
    - location: scripts/start_server.sh
      timeout: 500
      runas: root

Pretty basic. The problem is CodeDeploy never seems to execute scripts/start_server.sh

That file just looks like this:

java -jar ../*.jar

If I ssh into that machine and just manually run ./scripts/start_server.sh it runs fine. So why isn't code deploy executing start_server.sh?


Solution

  • In my scripts/start_server.sh script I found I had to redirect stdin and stdout and background the task:

    /var/myservice/scripts/run > /dev/null 2> /dev/null < /dev/null &
    

    otherwise launch seemed to hang.