Amazon Web Service CodeDeploy的appspec.yml问题 [英] Amazon Web Service CodeDeploy appspec.yml problems

查看:987
本文介绍了Amazon Web Service CodeDeploy的appspec.yml问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Node.js应用程序,通过自动部署到Amazon Web Service 代码,使用 CodeDeploy AWS部署系统



在部署过程中,我在 appspec.yml 中设置了当前正在运行的Web应用程序。一旦部署完成,我想要重新启动Web应用程序。

  os:linux 
文件:
- source:/
destination:/ var / www / app2
hooks:
AfterInstall:
- location:bash_scripts / stop_forever.sh
runas: ec2-user
ApplicationStart:
- location:bash_scripts / start_forever.sh
runas:ec2-user

但是,我还没有能够在部署期间从appspec.yml文件中成功调用这些脚本。



我在AWS部署代理日志中看到的当前错误是

 错误CodeScriptMissing 
脚本名称/ var /scripts/stop_forever.sh
MessageScript在指定位置不存在:/var/scripts/stop_forever.sh
Log TailLifecycleEvent - ApplicationStop

这似乎指的是较早版本的appspec.yml文件,试图在不同的位置运行这些脚本。即使我已更改了部署包中的appspec.yml文件的内容,此错误消息在每次部署时仍保持不变。



除了appspec.yml文件,我也尝试进行以下更改:




  • 不会列出 runas

  • 在部署目录中引用脚本

  • 在部署目录外引用脚本

  • 版本参数最初设置为 0.0



要了解除了 AWS文档之外的appspec.yml问题排查条件。 / p>

我做错了什么很明显的事情?

解决方案

code>在尝试运行当前部署 appspec.yml 文件之前,从先前安装的部署调用ApplicationStop hook。



为了防止发生这种情况,您必须从服务器中删除任何以前安装的部署。




  • 停止代码deploy agent - sudo service codedeploy-agent stop

  • 清除 / opt / codedeploy-agent / deployment-root

  • 重新启动代码deploy agent - sudo service codedeploy-agent start


I have a Node.js application which is being automatically deployed to Amazon Web Service through Codeship using the CodeDeploy AWS deployment system.

During the deployment process I've set in my appspec.yml for the currently running web application to be stopped. Once the deployment is complete, I want the web application to be started up again.

os: linux
files:
  - source: /
    destination: /var/www/app2
hooks:
  AfterInstall:
      - location: bash_scripts/stop_forever.sh
        runas: ec2-user
  ApplicationStart:
      - location: bash_scripts/start_forever.sh
        runas: ec2-user

However I've not yet been able to have either of these scripts to be called successfully from the appspec.yml file during a deployment.

The current error I'm seeing in the AWS deployment agent log is

Error CodeScriptMissing
Script Name /var/scripts/stop_forever.sh
MessageScript does not exist at specified location: /var/scripts/stop_forever.sh
Log TailLifecycleEvent - ApplicationStop

This seems to refer to an older version of the appspec.yml file which was attempting to run these scripts in a different location. Even though I've changed the contents of the appspec.yml file in the deployed package, this error message remains the same on each deploy.

In addition to appspec.yml file listed above, I've also tried making the following changes:

  • Not listing a runas parameter for each hook
  • Referencing a script inside the deployed directory
  • Referencing a script outside the deployed directory
  • Having a version parameter initially set to 0.0

Unfortunately there is very little online in terms of appspec.yml troubleshooting, other than the AWS documentation.

What very obvious thing I am doing wrong?

解决方案

The ApplicationStop hook is being called from the previously installed deployment before trying to run the current deployment appspec.yml file.

In order to prevent this from happening you'll have to remove any previously installed deployment from the server.

  • Stop the code deploy agent - sudo service codedeploy-agent stop
  • clear all deployments under /opt/codedeploy-agent/deployment-root
  • Restart the code deploy agent - sudo service codedeploy-agent start

这篇关于Amazon Web Service CodeDeploy的appspec.yml问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆