AWS ElasticBeanstalk符号链接
问题描述:
我不想把我的config /在Github上database.yml文件,而是要在某处某处有它,做像下面AWS ElasticBeanstalk符号链接
配置/ databse.yml符号链接 - >/VAR /www/database.yml
在.elasticbeanstalk/00packages.config,我有以下的东西
commands:
# install WKHTML
03_command:
command: yum install xz urw-fonts libXext openssl-devel libXrender
04_command:
command: wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
05_command:
command: tar -xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
06_command:
command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
07_command:
command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
我可以在这里添加符号链接的东西,它的工作原理
答
不幸的是, EB自定义配置中没有一个允许您在部署应用程序后执行操作。在运行commands
时,您的应用程序仍在/var/app/ondeck
中,因此如果您在/var/app/current
下创建符号链接,则在将ondeck
重命名为current
时,它将被删除。
我知道的唯一解决此限制的方法是将文件放入appdeploy/post
挂钩目录中。在你的情况下,它会是这个样子:
.ebextensions/01symlink.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_create_symlink.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
ln -sf /var/www/database.yml /var/app/current/config/database.yml
另外,还可以在使用来自/var/www
一个commands
进入副本的文件/var/app/ondeck
部署。