我在python 2.7弹性beanstalk环境中工作。
我尝试使用.ebextensions .config文件中的sources密钥将tgz存档复制到我的应用程序根目录中的目录 - /opt/python/current/app/utility
。我这样做是因为此文件夹中的文件太大而无法包含在我的github存储库中。
但是,看起来source key是在创建ondeck符号链接到当前bundle目录之前执行的,所以在使用sources命令时我不能引用/opt/python/ondeck/app
因为它创建了文件夹然后尝试创建ondeck符号链接时beanstalk错误。
以下是我尝试过的.ebextensions/utility.config
个文件的副本:
sources:
/opt/python/ondeck/app/utility: http://[bucket].s3.amazonaws.com/utility.tgz
上面成功复制到/ opt / python / ondec / app / utility但是beanstalk错误因为它无法从/ opt / python / bundle / x创建符号链接 - >的/ opt /蟒/ ondeck。
sources:
utility: http://[bucket].s3.amazonaws.com/utility.tgz
上面将文件夹与/ etc。
并行地从根目录下复制到/ utility答案 0 :(得分:0)
在设置应用程序后,您可以使用container_commands
代替sources
。
使用container_commands
,您无法使用sources
自动获取文件并将其解压缩,因此您必须使用wget或curl等命令来获取文件并解压缩他们之后。
示例:curl http://[bucket].s3.amazonaws.com/utility.tgz | tar xz
答案 1 :(得分:0)
在我的环境(php)中没有临时ondeck
目录,并且在运行命令后会重新创建最终部署我的应用程序的current
目录。
因此,我需要在部署后运行脚本。搜索显示我可以在/opt/elasticbeanstalk/hooks/appdeploy/post/
中放置一个脚本,它将在部署后运行。
所以我使用sources
以最简单的方式将我的文件从S3下载/解压缩到临时目录。然后我创建了一个文件,它将在部署后复制我的文件并将其放在post deploy hook目录中。
sources:
/some/existing/directory: https://s3-us-west-2.amazonaws.com/my-bucket/vendor.zip
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_move_my_files_on_deploy.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
mv /some/existing/directory /var/app/current/where/the/files/belong