CodePipeline每次在CodeDeploy阶段失败。 每次我成功地将代码推送到CodeCommit CodePipeline时,都会在CodeDeploy阶段失败。
这是错误消息:
The overall deployment failed because too many individual instances failed deployment, too few healthy instances are available for deployment, or some instances in your deployment group are experiencing problems.
appspec.yml:
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/app
permissions:
- object: /
pattern: "**"
owner: ec2-user
group: ec2-user
hooks:
ApplicationStop:
- location: scripts/app-stop
timeout: 10
runas: ec2-user
AfterInstall:
- location: scripts/install-npm
timeout: 1200
runas: ec2-user
ApplicationStart:
- location: scripts/app-start
timeout: 60
runas: ec2-user
脚本: 应用启动:
#!/bin/bash
forever start /app/index.js
应用程序停止:
#!/bin/bash
forever stopall
install-npm:
#!/bin/bash
cd app && npm install
答案 0 :(得分:0)
对于代码部署,您必须确保实例上安装了codedeploy代理,否则它将给您类似“
的错误总体部署因单个实例过多而失败 部署失败,可用于运行的健康实例太少 部署或部署组中的某些实例是 遇到问题”
您可以按照此URL在您的EC2实例上安装codedeploy代理。 https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html