【问题标题】:CodeDeploy: Script at specified location: scripts/stop_server run as user root failed with exit code 1CodeDeploy:指定位置的脚本:以 root 用户身份运行的脚本/stop_server 失败,退出代码为 1
【发布时间】:2019-08-17 11:35:33
【问题描述】:

无论我在 stop_server 文件中放入什么内容,CodeDeploy 最终都会出现上述错误。 我什至注释掉了所有行以简化调试,所以现在它看起来像这样

#!/bin/bash
# pkill -f node

我的appspec.yml

version: 0.0
os: linux
files:
  - source: /app.js
    destination: /home/ec2-user/node-website
  - source: /package.json
    destination: /home/ec2-user/node-website
  - source: /public/
    destination: /home/ec2-user/node-website/public
  - source: /node_modules
    destination: /home/ec2-user/node-website/node_modules

permissions:
  - object: /
      pattern: "**"
      owner: ec2-user
      group: ec2-user

hooks:
  AfterInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: ec2-user
    #- location: scripts/codestar_remote_access
    #  timeout: 300
    #  runas: ec2-user
    - location: scripts/start_server
      timeout: 300
      runas: ec2-user

  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: ec2-user

任何建议都非常感谢!

【问题讨论】:

    标签: amazon-web-services amazon-ec2 continuous-deployment aws-codepipeline


    【解决方案1】:

    当您进行部署时,它实际上会使用您上次成功部署的 ApplicationStop,而不是您当前的部署。我通过删除有问题的应用程序并创建一个新应用程序解决了问题。

    【讨论】:

      【解决方案2】:

      您可以查看代码部署日志以了解更多详细信息,日志通常位于:

      codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log

      查找更详细的错误日志,如果您仍然无法弄清楚,请告诉我

      【讨论】:

      • 我没有这个日志文件夹为什么我还有/opt/codedeploy-agent/deployment-root
      猜你喜欢
      • 1970-01-01
      • 2019-05-17
      • 1970-01-01
      • 2018-04-17
      • 1970-01-01
      • 1970-01-01
      • 2019-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多