I have developed a simple Python web service using WSGI and would like to deploy it to AWS cloud using Elastic Beanstalk. My problem is I cannot make all the options I specify in Elastic Beanstalk configuration to be correctly configured in the cloud.
For deployment, I use Elastic Beanstalk CLI utility. I have run eb init
command and set up the required parameters. After this, a directory named .elasticbeanstalk
was created in my source tree. It has two config files that are used for deployment, namely config
and optionsettings
. The latter one among the other options contains the WSGI configuration that has to update /etc/httpd/conf.d/wsgi.conf
at the instances. After some of my adjustments the file has the following settings:
[aws:elasticbeanstalk:application:environment] DJANGO_SETTINGS_MODULE = PARAM1 = PARAM2 = PARAM4 = PARAM3 = PARAM5 = [aws:elasticbeanstalk:container:python] WSGIPath = handler.py NumProcesses = 2 StaticFiles = /static= NumThreads = 10 [aws:elasticbeanstalk:container:python:staticfiles] /static = static/ [aws:elasticbeanstalk:hostmanager] LogPublicationControl = false [aws:autoscaling:launchconfiguration] InstanceType = t1.micro EC2KeyName = zmicier-aws [aws:elasticbeanstalk:application] Application Healthcheck URL = [aws:autoscaling:asg] MaxSize = 10 MinSize = 1 Custom Availability Zones = [aws:elasticbeanstalk:monitoring] Automatically Terminate Unhealthy Instances = true [aws:elasticbeanstalk:sns:topics] Notification Endpoint = Notification Protocol = email
It turns out that not all of these options are considered when I start the environment or update it. Thus, when I update NumThreads
or NumProcesses
, the respective parameters get changed in wsgi.conf
as expected. But whatever I write to the WSGIPath
and StaticFiles
parameters, I'm not able to automatically change the respective values of wsgi.conf
, they remain
Alias /static /opt/python/current/app/
WSGIScriptAlias / /opt/python/current/app/application.py
which drives me nuts. Moreover, when I deploy my application using git aws.push
and having the following contents of .ebextensions/python.config
file, neither of options I specify in it affects the deployment.
option_settings: - namespace: aws:elasticbeanstalk:container:python option_name: WSGIPath value: mysite/wsgi.py - namespace: aws:elasticbeanstalk:container:python option_name: NumProcesses value: 5 - namespace: aws:elasticbeanstalk:container:python option_name: NumThreads value: 25 - namespace: aws:elasticbeanstalk:container:python:staticfiles option_name: /static/ value: app/static/
I wonder what I should do to force AWS use all the parameters I specify in the configuration, namely the WSGI Path and path to my static data.