Supervisord in Docker + AWS Elastic Beanstalk can't accept non-alphanumeric environment variables

假如想象 提交于 2019-12-12 05:37:25

问题


I am using custom Docker container in AWS Elastic beanstalk to deploy a wep application. I could set environment variables such as API key, API secret, etc.. on AWS web console.(Elastic beanstalk => Configuration => Software Configuration) It worked fine.

However, after I changed some variables to other values which contain special characters, it did not work with this error:

Docker container quit unexpectedly on Mon Oct 24 13:32:22 UTC 2016:
Error: Unexpected end of key/value pairs
For help, use /usr/bin/supervisord -h

Supervisord document says Values containing non-alphanumeric characters should be quoted.

My question is,

Are there any ways to make environment variables with special characters, which is set from AWS elastic beanstalk, properly reach to a docker container by quoting them?

I tried quoting them on web console:

Double quoting env vars on web console

But it did not work:

Escaped the double quotes

AWS Elastic beanstalk escapes double quotes by default, I guess.

For more info. my ebextension config file:

option_settings:
  "aws:elasticbeanstalk:application:environment":
    MY_VARIABLE: ""
    MY_VARIABLE_QUOTED: ""

Supervisord config file:

[program:run_app]
environment=MY_VARIABLE=%(ENV_MY_VARIABLE)s,MY_VARIABLE_QUOTED=%(ENV_MY_VARIABLE_QUOTED)s
command=gunicorn my_app.wsgi:application -w 2 -b 0.0.0.0:8000 -t 300 --max-requests=100
directory=/var/www/my_app
user=root
stdout_logfile=/var/www/my_app/logs/django_stdout.log
stderr_logfile=/var/www/my_app/logs/django_stderr.log
autorestart=true
redirect_stderr=true
stopwaitsecs = 600

来源:https://stackoverflow.com/questions/40231143/supervisord-in-docker-aws-elastic-beanstalk-cant-accept-non-alphanumeric-envi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!