在amazon linux实例中运行时出现Codedeploy-agent错误

时间:2017-04-23 23:34:11

标签: shell aws-code-deploy amazon-linux

当我使用GitHub在AWSCodeDeploy中创建新部署时,我收到此失败消息:

Error CodeScriptFailed
Script Namescripts/stop_server.sh
MessageScript at specified location: scripts/stop_server.sh run as user ubuntu failed with exit code 1
Log TailLifecycleEvent - ApplicationStop
Script - scripts/stop_server.sh
[stderr]su: user ubuntu does not exist

但是,我的实例是一个亚马逊Linux实例,没有ubuntu用户,有人对此有所了解吗?

尝试运行的脚本是:

# scripts/stop_server.sh
#!/bin/bash
forever stop .

我的appspec.yml文件:

version: 0.0
os: linux
files:
   - source: /
     destination: /home/ec2-user
hooks:
  AfterInstall:
    - location: scripts/install_dependencies.sh
      timeout: 5
      runas: root
  ApplicationStart:
    - location: scripts/start_server.sh
      timeout: 5
      runas: root
  ApplicationStop:
    - location: scripts/stop_server.sh
      timeout: 5
      runas: root

Codedeploy-agent版本agent_version: OFFICIAL_1.0-1.1095_rpm

2 个答案:

答案 0 :(得分:0)

Application stop通常在先前成功的部署档案中引用appspec.yml。要么空/opt/codedeploy-agent/deployment-archive/deployment-instructions/,要么可以使用BeforeInstall挂钩来执行停止脚本。

答案 1 :(得分:0)

代码部署在/ opt / code-deploy / .... path中创建临时应用程序。如果部署正常失败,则下次从临时目录开始。如果要删除部署指向的错误,则应检查临时目录中的特定脚本文件并进行编辑。