将 Elastic Beanstalk 与 Amazon Linux 2 结合使用,我尝试为部署(代码部署)和配置部署执行相同的挂钩,而不必在两个不同的位置复制我的代码。
\n根据AWS文档, eb将在.platform/hooks/prebuild部署初始步骤中运行挂钩,但将在.platform/confighooks/prebuild,但在配置部署时将运行挂钩。
我的文件看起来像这样。
\n.platform\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hooks\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 prebuild\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 00_hookname.sh\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 01_hookname.sh\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 99_basic_auth.sh\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 httpd\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 conf.d\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 elasticbeanstalk\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 directory.conf\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hardening.conf\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 headers.conf\nRun Code Online (Sandbox Code Playgroud)\n我正在尝试找到一种方法来运行 99_basic_auth.sh 进行部署并配置部署,而无需复制该代码。
\n我有什么办法可以实现这一目标吗?
\n干杯!
\n我发现执行此类操作的最简单方法是简单地从第二个脚本调用第一个脚本。
\n.platform\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hooks\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 prebuild\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 00_hookname.sh\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 01_hookname.sh\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 99_basic_auth.sh\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 confighooks\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 prebuild\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 99_basic_auth.sh\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 httpd\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 conf.d\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 elasticbeanstalk\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 directory.conf\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hardening.conf\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 headers.conf\nRun Code Online (Sandbox Code Playgroud)\n内容在哪里.platform/confighooks/prebuild/99_basic_auth.sh是:
#!/bin/bash\n\nset -e\n\n/bin/bash "/var/app/current/.platform/hooks/prebuild/99_basic_auth.sh"\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
1745 次 |
| 最近记录: |