I have setup circleCI, AWS CodeDeploy and EC2 to work together so that after I push code to git, it relays to circleCI and then EC2 and starts a server there.
Everything is working fine except the server is running correctly and circleCI won't give me a successful build status. It is always in "running" state
appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu
permissions:
- object: /home/ubuntu/scripts
pattern: "**"
mode: 777
type:
- file
hooks:
ApplicationStart:
- location: scripts/start.sh
timeout: 3800
start.sh
#!/bin/bash
node server.js
anyone know how to solve this?
The host agent is waiting for your script to exit. You need to run node as a daemon.
#!/bin/bash
node server.js > /var/log/my_node_log 2> /var/log/my_node_log < /dev/null &