codedeploy appspec.yml无法将文件复制到目标

问题描述 投票:0回答:2

脚本appspe.yml:

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ubuntu/
permissions:
  - object: /home/ubuntu/
    owner: root
    group: root
    mode: 777
hooks:
  BeforeInstall:
    - location: scripts/install_dependencies.sh
      timeout: 300
      runas: root
    - location: scripts/start_server.sh
      timeout: 300
      runas: root
  ApplicationStop:
    - location: scripts/stop_server.sh
      timeout: 300
      runas: root

不幸的是,它没有将文件复制到/home/ubuntu/目录。有了这个,我通过codedeploy部署时收到以下错误

LifecycleEvent - BeforeInstall脚本 - scripts / install_dependencies.sh脚本 - scripts / start_server.sh [stderr] cp:不能统计'scripts / gunicorn.service':没有这样的文件或目录[stderr]无法启动gunicorn.service:Unit gunicorn。无法提供服务。 [stderr]无法执行操作:没有这样的文件或目录[stderr]无法重启gunicorn.service:找不到Unit gunicorn.service。 [stderr] cp:不能统计'scripts / LIMA':没有这样的文件或目录[stderr] ln:无法创建符号链接'/ etc / nginx / sites-enabled / LIMA':文件存在[stderr]错误:错误的端口

这里出了什么问题?

amazon-web-services aws-code-deploy aws-codepipeline
2个回答
0
投票

您的错误似乎属于以下类别:

  1. 丢失文件。 ([stderr] cp:不能统计'scripts / gunicorn.service':没有这样的文件或目录)。调试:检查文件是否实际存在于部署包中。在此处检查软件包本身和日志:less / opt / codedeploy-agent / deployment-root / deployment-group-ID / deployment-ID /。 See here
  2. 无法创建符号链接,因为它已经存在。 ([stderr] ln:无法创建符号链接'/ etc / nginx / sites-enabled / LIMA':文件存在)。这与文件覆盖无关。可能在脚本的某处有一个'ln'命令来创建符号链接。调试:修改脚本以测试符号链接是否存在,然后创建它。

我希望这有帮助。


0
投票

我遇到了同样的问题。 当我将“BeforeInstall”挂钩中的命令移动到“AfterInstall”挂钩时,它对我有效。

© www.soinside.com 2019 - 2024. All rights reserved.