ApplicationStart Deployment Code Delays Pending Use of Node

Hi, I'm new to using Code Deploy. I am trying to run a node application. I have setup.sh, start.sh and app.js in the root directory.

This is my appspec.yml file

version: 0.0
os: linux
files:
 - source: /
   destination: /
hooks:
  Install:
    - location: setup.sh
      timeout: 3600
  ApplicationStart:
    - location: start.sh
      timeout: 3600

setup.sh

yum -y install nodejs npm --enablerepo=epel
npm install

start.sh

node /app.js

app.js (just a basic dummy server)

var express = require("express");
var app = express();

app.get("/",function(req,res) {
    res.send("Hello world")
})


var server = app.listen(8080,function() {
    console.log("Listening at " + server.address().address + ": " + server.address().port);
});

The installation step completed successfully, but Code Deploy is stuck waiting for it to complete the ApplicationStart step.

I am sure of this because the app.js program is running continuously, so how should CodeDeploy know that it is working and moving on?

+4
source share
2 answers

node /app.js , , start.sh script .

node Node.js .

+2

CodeDeploy script stdout stderr. -, , :

node /app.js > /dev/null 2> /dev/null < /dev/null &

. , ( ).

: http://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting.html#troubleshooting-long-running-processes

+5

Source: https://habr.com/ru/post/1610242/


All Articles