0

我已经设置 circleCI、AWS CodeDeploy 和 EC2 一起工作,这样在我将代码推送到 git 后,它会中继到 circleCI,然后是 EC2,并在那里启动服务器。

一切正常,除了服务器运行正常并且 circleCI 不会给我一个成功的构建状态。它始终处于“运行”状态

应用规范.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

启动.sh

#!/bin/bash
node server.js

有谁知道如何解决这个问题?

4

1 回答 1

1

主机代理正在等待您的脚本退出。您需要将节点作为守护程序运行。

#!/bin/bash
node server.js > /var/log/my_node_log 2> /var/log/my_node_log < /dev/null &

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

于 2015-10-30T14:03:25.000 回答