I am trying to do auto deployment from bitbucket to an ec2 instance using codedeploy but Codedeploy always fails on "ApplicationStop" phase.
Here is my appspec.yml
version: 0.0
os: linux
files:
- source: /quickdeal.zip
destination: /home/ubuntu/quickdeal/
hooks:
BeforeInstall:
- location: scripts/install_dependencies.sh
runas: root
ApplicationStop:
- location: scripts/stop_server.sh
runas: root
ApplicationStart:
- location: scripts/start_server.sh
runas: root
and following is the stop_server.sh
#!/bin/bash
# stop any old running servers
killall -s KILL node -q || echo 'no node process was running'
But this is the error I get in aws
Error CodeScriptFailed
Script Namescripts/stop_server.sh
MessageScript at specified location: scripts/stop_server.sh run as user root failed with exit code 1
Log TailLifecycleEvent - ApplicationStop
Script - scripts/stop_server.sh
Things I have already tried
[1] Deleted and re-created the application [2] Emptied stop_server.sh so that it doesn't give out any exit codes at all (still got exit code 1)