python - wsgi user permissions on elastic beanstalk -
i'm using elastic beanstalk , django. 1 of dependencies in requirements.txt file has setup performs when it's imported. part of setup check whether dir exists else create it. i'm getting permissions errors because user ( assume it's wsgi) not have permissions create dir.
oserror: [errno 13] permission denied: '/home/wsgi/.newspaper_scraper/memoized'
how can setup permissions allow these dirs created in way persistent across instances create in future?
this happening because uwsgi worker running under user limited permissions. need create .newspaper_scraper/memoized
directory first, , set correct permissions on (allow others r/w). can on deployment making script in .ebextensions
eb executes upon deployment.
create file in .ebextensions/setup_newspaper.config
, add following it:
.ebextensions/setup_newspaper.config
packages: yum: libxslt-devel: [] libxml2-devel: [] libjpeg-devel: [] zlib1g-devel: [] libpng12-devel: [] container_commands: 01_setup_newspaper: command: mkdir -p /home/wsgi/.newspaper_scraper/memoized && chmod 644 /home/wsgi/.newspaper_scraper/memoized
ps: looks newspaper
requires packages installed, added them too.
read more info on .ebextensions here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-container.html#create-deploy-python-custom-container
Comments
Post a Comment