2

我的文件已正确复制到 EC2 实例以进行部署,但未复制到目标。我有这样的 appspec.yml 文件:

ubuntu@ip:~$ cat /opt/coded*/deployment-root/*/*/de*/appspec.yml
version: 0.0
os: linux
# I also tried with source: /
files:
  - source: .
    destination: /home/ubuntu/
file_exists_behavior: OVERWRITE
# notes

# ------------------------------------------------------------------------------------

# To learn more about hooks, visit the docs here:
# https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-server
hooks:
  BeforeInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: root
  ApplicationStart:
    - location: scripts/start_server
      timeout: 300
      runas: root
  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: root

我也尝试将 source 设置为 source: / ,结果相同;没有任何东西被复制

我看到我的文件都在 /opt/coded* 等路径中。但为什么 CodeDeploy 代理不将我的文件复制到目标?下载捆绑钩子很好,当我需要实际访问我的文件时,我得到的唯一错误是在 ApplicationStart 钩子中。

注意:我使用 GitHub 作为我的修订存储,而不是 S3,如果有帮助的话

编辑:可能有用的信息在我的 install_dependencies 脚本中,我按照以下方式运行:

cd /home/ubuntu/
pip install -r requirements.txt

pip安装在哪里找不到文件

4

1 回答 1

3

推理:https ://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-example.html#appspec-file-example-server

钩子的顺序。在 AfterInstall 挂钩之前复制文件。

于 2021-08-08T15:30:07.560 回答