【问题标题】:CodeDeploy Timeout Error and Corrupted EC2CodeDeploy 超时错误和损坏的 EC2
【发布时间】:2018-07-25 03:03:17
【问题描述】:

我最近的 CodeDeploy 由于超时而失败,现在无法连接或加载我的 EC2 实例。它没有回滚到以前的工作版本,由于我无法连接,我无法更深入地查看 CodeDeploy 日志。查看日志尾部时,错误日志没有任何明显的地方,我认为它与超时错误无关,但我不确定我的 shell 脚本中的什么可能会创建超时。关于我的设置可能有什么问题的任何想法?我应该在运行 sudo npm install 之前检查 node_modules 文件夹吗?

错误:

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

【问题讨论】:

    标签: shell npm sh npm-install aws-code-deploy


    【解决方案1】:

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

    根据所提供的信息,不可能知道出了什么问题。根据您对node_modules 目录不存在的担忧,这无关紧要,因为npm install 将在该目录不存在时创建该目录。如果可能,我强烈建议升级已弃用的软件包。 NPM 可能对此不满意。

    对于您的实例,您提供的脚本中没有任何内容可以杀死您的实例。如果您无法连接到您的 EC2 实例,您可能需要回收它并获得一个新实例。如果您无法连接到 EC2 实例上实际运行的东西,您可以使用新实例创建一个新的 CodeDeploy 部署组,部署代码并查看该实例是否保持健康。这可能是间歇性的异常,如果问题变得可重复,排除故障会更有价值。

    【讨论】:

      猜你喜欢
      • 2018-12-18
      • 2013-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-07
      • 1970-01-01
      • 2015-07-19
      相关资源
      最近更新 更多