我正在使用AWS Elastic beantalk来提供自定义python应用程序。除更新环境变量外,其他所有操作均正常。
如果我尝试通过eb setenv FOO=bar
进行更改(或在控制台中进行更改),则应用程序将停止识别 all 所有env变量。重新启动服务器或发送新的部署可以解决该问题,但是客户端可能会遇到停机或400/500错误。
我几乎确定我需要使用configdeploy挂钩,但是不知道如何使用。
谢谢!
配置:
在64位Amazon Linux / 2.7.3上运行的Python 3.4
0_python.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: 'configs/wsgi.py'
NumProcesses: 6
NumThreads: 15
container_commands:
01_wsgipass:
command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'
02_traceenable:
command: 'echo "TraceEnable Off" >> ../wsgi.conf'
1_apache.config
container_commands:
01_setup_apache:
command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
files:
"/etc/httpd/conf.d/ssl_rewrite.conf":
mode: "000644"
owner: root
group: root
content: |
RewriteEngine On
<If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'">
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</If>
"/etc/httpd/conf.d/wsgi_custom.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIApplicationGroup %{GLOBAL}
答案 0 :(得分:0)
您可以使用{p>在.config
文件中设置环境变量
option_settings:
aws:elasticbeanstalk:application:environment:
FOO: bar