首页 文章

CodeDeploy超时错误和损坏的EC2

提问于
浏览
0

我有一个问题,我的最新CodeDeploy由于超时而失败,现在无法连接或加载我的EC2实例 . 它没有't rollback to the previous working version and since I can't连接我可以__74316_ t任何明显的错误日志和我不知道't think it is related to the timeout error, but I'我不知道在我的shell脚本中可以创建超时 . 我的设置可能有什么问题吗?我应该在运行sudo npm install之前检查 node_modules 文件夹吗?

Error:

Error Code: ScriptTimedOut
Script Name:scripts/npm-install.sh
Message: Script at specified location: scripts/npm-install.sh failed to complete in 300 seconds
Log Tail:

LifecycleEvent - AfterInstall
Script - scripts/npm-install.sh
[stderr]npm WARN deprecated lodash-node@3.10.2: This package is discontinued. Use lodash@^4.0.0.
[stderr]npm WARN deprecated sendgrid@4.10.0: Please see v6.X+ at https://www.npmjs.com/org/sendgrid
[stderr]npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
[stderr]npm WARN deprecated mailcomposer@4.0.1: This project is unmaintained
[stderr]npm WARN deprecated socks@1.1.9: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
[stderr]npm WARN deprecated buildmail@4.0.1: This project is unmaintained
[stderr]npm WARN deprecated sendgrid@1.9.2: Please see v6.X+ at https://www.npmjs.com/org/sendgrid
[stderr]npm WARN deprecated mailparser@0.6.2: This project is unmaintained
[stderr]npm WARN deprecated mimelib@0.3.1: This project is unmaintained
[stderr]

这是我的 appspec.yml:

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/app/
hooks:
  AfterInstall:
    - location: scripts/npm-install.sh
      runas: ec2-user
      timeout: 300
  ApplicationStart:
    - location: scripts/npm-start.sh
      runas: ec2-user
      timeout: 60

npm-install.sh:

#!/bin/bash
source /home/ec2-user/.bash_profile
cd /var/www/app
sudo npm install

npm-start.sh:

#!/bin/bash
source /home/ec2-user/.bash_profile
cd /var/www/app
npm start

1 回答

  • 0

    您可能知道,在 appspec.yml 文件中配置了300秒超时 . 我假设 npm install 应该在不到300秒的时间内完成 .

    根据提供的信息,我们无法知道出了什么问题 . 根据您对 node_modules 目录不存在的关注,它无关紧要,因为 npm install 将创建该目录,如果它没有_574331可能NPM对此不满意 .

    至于您的实例,您提供的脚本中没有任何内容可以杀死您的实例 . 如果您无法连接到您的EC2实例,您可能想要回收它并获得一个新实例 . 如果您无法连接到EC2实例上实际运行的某些内容,则可以使用新实例创建新的CodeDeploy部署组,部署代码并查看实例是否保持 Health 状态 . 这可能是一种间歇性的奇怪现象,如果问题变得可重复,那么排除故障会更有 Value .

相关问题