Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS CodeDeploy Appspec.yml files are not being copied to destination

My files are properly copied to an EC2 instance for deployments, but they are not copied to the destination. I've got at appspec.yml file like this:

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

I've also tried setting source to source: / with the same result; nothing's copied

And I see my files are all in that /opt/coded* etc. path. But why isn't the CodeDeploy agent copying my files to the destination? The Download bundle hook is good, and the only error I get is in the ApplicationStart hook when I need to actually access my files.

Note: I'm using GitHub as my revision storage, not S3, if that helps

Edit: something that might be useful to know is in my install_dependencies script, I run something along the lines of:

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

where the pip installation is the line where it can't find the files

like image 419
acw Avatar asked Oct 27 '25 11:10

acw


1 Answers

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

The order of the hooks. The files are copied before the AfterInstall hook.

like image 103
acw Avatar answered Oct 29 '25 01:10

acw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!